Delete files
am: ea972da6b7
Change-Id: I2c97181b96dcf55cfcfdbd64fe34e5f62d947b19
diff --git a/.hgignore b/.hgignore
deleted file mode 100644
index e05f093..0000000
--- a/.hgignore
+++ /dev/null
@@ -1,5 +0,0 @@
-^build/
-^dist/
-/nbproject/private/
-^.hgtip
-.DS_Store
diff --git a/.hgtags b/.hgtags
deleted file mode 100644
index a71bf33..0000000
--- a/.hgtags
+++ /dev/null
@@ -1,729 +0,0 @@
-55540e827aef970ecc010b7e06b912d991c8e3ce jdk7-b24
-5e61d5df62586474414d1058e9186441aa908f51 jdk7-b25
-0043eb3d4e628f049ff80a8c223b5657136085e7 jdk7-b26
-e84e9018bebbf3e5bafc5706e7882a15cb1c7d99 jdk7-b27
-27509b7d21ed783b3f6eb7b7612781c675a30c2f jdk7-b28
-8b71960f79ce0a6fb8ddfeec03f03d400a361747 jdk7-b29
-c0252adbb2abbfdd6c35595429ac6fbdd98e20ac jdk7-b30
-ef6af34d75a7b44e77083f1d4ee47631fa09d3b4 jdk7-b31
-80a0f46a6203e727012bd579fe38a609b83decce jdk7-b32
-6a5b9d2f8b20de54e3bfe33cd12bd0793caedc4e jdk7-b33
-0a812b9824e5d17b073765d1505594b49ff88a10 jdk7-b34
-3867c4d14a5bfdbb37c97b4874ccb0ee5343111c jdk7-b35
-0723891eb8d1c27e67c54163af0b4cea05a4e036 jdk7-b36
-59d5848bdedebe91cc2753acce78911bcb4a66db jdk7-b37
-08be802754b0296c91a7713b6d85a015dbcd5349 jdk7-b38
-55078b6661e286e90387d1d9950bd865f5cc436e jdk7-b39
-184e21992f47a8d730df1adc5b21a108f3125489 jdk7-b40
-c90eeda9594ed2983403e2049aed8d503126c62e jdk7-b41
-ccd6a16502e0650d91d85c4b86be05cbcd461a87 jdk7-b42
-9cd740d48a4855321d69f137a7109c00bcda76be jdk7-b43
-9803dac7254041b30ca65e3852d4c566b9757c3b jdk7-b44
-68814aa5b44b1f16931a97e7cd4028c70eb9586b jdk7-b45
-1691dbfc08f8ee3f4e23a1ff30cdff920718696c jdk7-b46
-167ad0164301f318b069a947e1c9c07ed667748a jdk7-b47
-0be222241fd405e48915647facfaa176621b39b9 jdk7-b48
-d70978bc64bc7a04be7797ab0dcd9b7b1b3a6bff jdk7-b49
-0edbd0074b02b42b2b83cc47cb391d4869b7a8ec jdk7-b50
-3eb8f1047a7402a9a79937d1c39560e931e91da2 jdk7-b51
-bec82237d694f9802b820fa11bbb4f7fa9bf8e77 jdk7-b52
-3c4d73194f6f89f040ae3b2d257335dfa8a1b2b5 jdk7-b53
-8130ac858d6789d5853d23044ba4a992afda574a jdk7-b54
-7a869f16ba83060c34b77620406cfa89d1cd7084 jdk7-b55
-553a664b807bb3a3c93f3b5a3c20ff0a90e08371 jdk7-b56
-972c6157fae57850694675da82fd58a17930db0a jdk7-b57
-2e3b8edab3ef55406494d3dd562e06882e6fc15e jdk7-b58
-7e6b2b55c00cc523b468272353ada3979adbbf16 jdk7-b59
-f1e1cccbd13aa96d2d8bd872782ff764010bc22c jdk7-b60
-e906b16a12a9a63b615898afa5d9673cbd1c5ab8 jdk7-b61
-65b66117dbd70a493e9644aeb4033cf95a4e3c99 jdk7-b62
-d20e45cd539f20405ff843652069cfd7550c5ab3 jdk7-b63
-047dd27fddb607f8135296b3754131f6e13cb8c7 jdk7-b64
-97fd9b42f5c2d342b90d18f0a2b57e4117e39415 jdk7-b65
-a821e059a961bcb02830280d51f6dd030425c066 jdk7-b66
-a12ea7c7b497b4ba7830550095ef633bd6f43971 jdk7-b67
-5182bcc9c60cac429d1f7988676cec7320752be3 jdk7-b68
-8120d308ec4e805c5588b8d9372844d781c4112d jdk7-b69
-175bd68779546078dbdb6dacd7f0aced79ed22b1 jdk7-b70
-3f1ef7f899ea2aec189c4fb67e5c8fa374437c50 jdk7-b71
-c793a31209263fbb867c23c752599d85c21abb73 jdk7-b72
-b751c528c55560cf2adeaeef24b39ca1f4d1cbf7 jdk7-b73
-5d0cf59a3203b9f57aceebc33ae656b884987955 jdk7-b74
-0fb137085952c8e47878e240d1cb40f14de463c4 jdk7-b75
-937144222e2219939101b0129d26a872a7956b13 jdk7-b76
-6881f0383f623394b5ec73f27a5f329ff55d0467 jdk7-b77
-a7f7276b48cd74d8eb1baa83fbf3d1ef4a2603c8 jdk7-b78
-ec0421b5703b677e2226cf4bf7ae4eaafd8061c5 jdk7-b79
-0336e70ca0aeabc783cc01658f36cb6e27ea7934 jdk7-b80
-e08a42a2a94d97ea8eedb187a94dbff822c8fbba jdk7-b81
-1e8c1bfad1abb4b81407a0f2645e0fb85764ca48 jdk7-b82
-fde0df7a2384f7fe33204a79678989807d9c2b98 jdk7-b83
-68c8961a82e4a3ad2a67991e5d834192a81eb4cd jdk7-b84
-c67a9df7bc0ca291f08f9a9cc05cb78ea15d25e6 jdk7-b85
-6253e28826d16cf1aecc39ce04c8de1f6bf2df5f jdk7-b86
-09a41111a401d327f65e453384d976a10154d9ea jdk7-b87
-39e14d2da687c7e592142137517aaf689544820f jdk7-b88
-bb4424c5e778b842c064a8b1aa902b35f4397654 jdk7-b89
-56ce07b0eb47b93a98a72adef0f21e602c460623 jdk7-b90
-bcd2fc089227559ac5be927923609fac29f067fa jdk7-b91
-930582f667a13391cd0b3e41e8cb760f55e3a5c0 jdk7-b92
-9718d624864c29dca44373d541e93cdd309a994f jdk7-b93
-533c11186b44e3a02d6c5fe69a73260505fcfe5e jdk7-b94
-06dbf406818c789bb586c1de4c002024cd26ecd2 jdk7-b95
-edc2a2659c77dabc55cb55bb617bad89e3a05bb3 jdk7-b96
-4ec9d59374caa1e5d72fa802291b4d66955a4936 jdk7-b97
-3b99409057e4c255da946f9f540d051a5ef4ab23 jdk7-b98
-95db968660e7d87c345d5cf3dc2e3db037fb7220 jdk7-b99
-a56d734a1e970e1a21a8f4feb13053e9a33674c7 jdk7-b100
-86a239832646a74811695428984b6947c0bd6dc8 jdk7-b101
-78561a95779090b5106c8d0f1a75360a027ef087 jdk7-b102
-11e7678c3eb169b77d9a9892fe5e3dfa1d1a0d51 jdk7-b103
-9607213481d400ac477183191cc080e1bef6f475 jdk7-b104
-6f21b030092fb61244cc8a0aedf8058f7c022b81 jdk7-b105
-519daea48888196af76a975a3b31258efa860bad jdk7-b106
-232adb83eae8375439ccff65b6e205ca0da0510d jdk7-b107
-8d810527b499a67153365db74421a03c12b46f35 jdk7-b108
-c3dd858e09b20206459d9e7b0ead99d27ab00eab jdk7-b109
-0e1f80fda2271f53d4bbb59ec3f301dfbcef6a0a jdk7-b110
-640fa4d4e2ad4c2d7e4815c955026740d8c52b7a jdk7-b111
-cc67fdc4fee9a5b25caee4e71b51a8ff24ae7d1a jdk7-b112
-a89a6c5be9d1a754868d3d359cbf7ad36aa95631 jdk7-b113
-88fddb73c5c4a4b50c319cbae9380caf5172ab45 jdk7-b114
-da7561d479e0ddaa4650d8023ac0fc7294e014e3 jdk7-b115
-98c028de4301106f2285ac0e128a1bb9b4c24f5c jdk7-b116
-fa502e4834dac2176499cc1f44794d5dc32a11b9 jdk7-b117
-42e77836fded7c2a3080d27316b96634ea9e33c6 jdk7-b118
-39829414ae31a0080578a49b751899edd518cd7d jdk7-b119
-cff5a173ec1e89013359e804a3e31736ef6fb462 jdk7-b120
-2cc9f32992101732b23730b737740e64ebc5fa89 jdk7-b121
-1523a060032c8a5b7840198da8911abeff88118f jdk7-b122
-a230c142628cea22475ab9dc5cd544266ddf2466 jdk7-b123
-f90b3e014e831eb4f32ef035a1dad2b8ba87949f jdk7-b124
-1ce58c72b7892cb813eb920276c7e7f17a1b79fe jdk7-b125
-d7532bcd3742f1576dd07ff9fbb535c9c9a276e9 jdk7-b126
-64775e83f4df894355f45555f50c410de6727b4e jdk7-b127
-9baa8f94a11d6c5cab3f9f0e5a20106326d0932e jdk7-b128
-66fa0fcc779296c99746b09efce6109944f82f30 jdk7-b129
-563a8f8b5be3940e9346cffac4eff9ed02b3c69f jdk7-b130
-9d6dd2cdfcb92612dbd836ecded87770d52b49db jdk7-b131
-1b1e75e8f476e5c07f0d2b035993895e2603e1f0 jdk7-b132
-671fe2e623ffefb4b7c312be919fc71eb48c1df1 jdk7-b133
-918003855fa0dba5acf4bf1fe36526d2fc4c1ba8 jdk7-b134
-e0b72ae5dc5e824b342801c8d1d336a55eb54e2c jdk7-b135
-48ef0c712e7cbf272f47f9224db92a3c6a9e2612 jdk7-b136
-a66c01d8bf895261715955df0b95545c000ed6a8 jdk7-b137
-78d8cf04697e9df54f7f11e195b7da29b8e345a2 jdk7-b138
-60b074ec6fcf5cdf9efce22fdfb02326ed8fa2d3 jdk7-b139
-cdf5d19ec142424489549025e9c42e51f32cf688 jdk7-b140
-a58635cdd921bafef353f4864184a0481353197b jdk7-b141
-a2f340a048c88d10cbedc0504f5cf03d39925a40 jdk7-b142
-51ed32f6f4de56f16e910ac54ba6c6f6606f4f17 jdk7-b143
-7033a5756ad552d88114594d8e2d2e4dc2c05963 jdk7-b144
-77ec0541aa2aa4da27e9e385a118a2e51e7fca24 jdk7-b145
-770227a4087e4e401fe87ccd19738440111c3948 jdk7-b146
-73323cb3396260d93e0ab731fd2d431096ceed0f jdk7-b147
-949fb60ca830364571e7c4c9964e6b351ca929ec jdk8-b01
-ed8d94519a87b4adac270c3eec9134ff1f62bff5 jdk8-b02
-cd0da00694fbce642db9be936d3e4909a71d911d jdk8-b03
-60a68d688e24473cf84dedd1e60901a61ab82555 jdk8-b04
-cc1b599b986a37cb57de4584c5e58169766ca535 jdk8-b05
-45c43dde7ba7f176333a51a98f086275478836fa jdk8-b06
-3d61f0856f349e2163bf98146465dab3b7437f63 jdk8-b07
-0d52b1c87aa8fdea7fdc9c4126ea58f95ca6b351 jdk8-b08
-a891732c1a83082177ff7a4cf1506068d9cc0a47 jdk8-b09
-cda87f7fefcee3b89742a57ce5ad9b03a54c210d jdk8-b10
-0199e4fef5cc2bd234c65b93220459ef7a3bb3b1 jdk8-b11
-31d70911b712c6b4e580a3110363d5f044cfed7a jdk8-b12
-5b9d9b839d3d7fe02347827221c97c6d242a6f96 jdk8-b13
-e59c47de1ad8982ff3b0e843773a6902b36c2337 jdk8-b14
-7da69e7175a7c7564ee6d0e52255cbb8a57ef577 jdk8-b15
-82dc033975bb9b553b4ef97b6d483eda8de32e0f jdk8-b17
-82dc033975bb9b553b4ef97b6d483eda8de32e0f jdk8-b16
-312cf15d16577ef198b033d2a4cc0a52369b7343 jdk8-b18
-e1366c5d84ef984095a332bcee70b3938232d07d jdk8-b19
-51d8b6cb18c0978ecfa4f33e1537d35ee01b69fa jdk8-b20
-f157fc2a71a38ce44007a6f18d5b011824dce705 jdk8-b21
-a11d0062c445d5f36651c78650ab88aa594bcbff jdk8-b22
-5218eb256658442b62b05295aafa5b5f35252972 jdk8-b23
-b98f0e6dddf987df565029a1f58417fc1844c3f3 jdk8-b24
-e45d6b406d5f91ff5256a5c82456ab1e7eb8becd jdk8-b25
-79f709a099f40c08f76567fa6d813f9009a69826 jdk8-b26
-4fffe75e4edd39a2517f10b743941bf94edb143d jdk8-b27
-2082eb35d49a9c2aab90b8d4fd31cefb7a23b82e jdk8-b28
-6117395d422682f89d228347e319fcaac7edc729 jdk8-b29
-4605f8418bf562e78be79b25b6b8a5110281acae jdk8-b30
-1954151dfae8f73db24e396380f7c02bdd47c486 jdk8-b31
-5d820cb6b1afd75b619e7fd69e4f2b0eb1d5d6a1 jdk8-b32
-1e2ac1ea3f6c32a62bf88f3fa330120c30db59cb jdk8-b33
-e24c5cc8b0f7cc48374eef0f995838fb4823e0eb jdk8-b34
-e3d735914edd0a621b16bb85417423f8e6af5d51 jdk8-b35
-a5a61f259961a7f46b002e5cc50b4a9bf86927b6 jdk8-b36
-83fac66442cf680bb59ec9e3a71cc4729322b595 jdk8-b37
-b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38
-785af00e2827990f149b32ec37f523dbca3efdd1 jdk8-b39
-56d030e5035fdee5bba6cf318a06287fda5d67ec jdk8-b40
-113f0d5f0a08aa0947b3edf783b603e7f042748a jdk8-b41
-79cc42c9c71bbd6630ede681642e98f5e4a841fa jdk8-b42
-cd879aff5d3cc1f58829aab3116880aa19525b78 jdk8-b43
-439d9bf8e4ff204cc89c9974c1515a508b2cc6ff jdk8-b44
-747dad9e9d37d244a5c765a1afe9194f7ddae118 jdk8-b45
-30141e598d72a6146126cb86b034ed6d0bd191b3 jdk8-b46
-21e46ea21c6a26246fb7a1926ac7fe8d580d0518 jdk8-b47
-7e2b179a5b4dbd3f097e28daa00abfcc72ba3e0b jdk8-b48
-fe44e58a6bdbeae350ce96aafb49770a5dca5d8a jdk8-b49
-d20d9eb9f093adbf392918c703960ad24c93a331 jdk8-b50
-9b0f841ca9f7ee9bacf16a5ab41c4f829276bc6b jdk8-b51
-80689ff9cb499837513f18a1136dac7f0686cd55 jdk8-b52
-63aeb7a2472fb299134ad7388e0a111a5340b02d jdk8-b53
-16c82fc74695bab9b9e0fb05c086a5a08ba0082f jdk8-b54
-e8a0e84383d6fbd303ce44bd355fb25972b13286 jdk8-b55
-bf1bb47414e178beff67dc255fc3b97bf401f679 jdk8-b56
-f3ab4163ae012965fc8acdfc25ce0fece8d6906d jdk8-b57
-18462a19f7bd66d38015f61ea549a5e0c0c889a3 jdk8-b58
-d54dc53e223ed9ce7d5f4d2cd02ad9d5def3c2db jdk8-b59
-207ef43ba69ead6cbbab415d81834545e4d46747 jdk8-b60
-0e08ba7648fb3faa0986cb217887d7c4990977f3 jdk8-b61
-08afb9c6f44f11c3595b01fd0985db64b29834dd jdk8-b62
-6ccbf67b68bfed1ab9c44ab8748a5bdc7df33506 jdk8-b63
-54d599a5b4aad83c235d590652fc81f41c2824fb jdk8-b64
-5132f7900a8f0c30c3ca7f7a32f9433f4fee7745 jdk8-b65
-65771ad1ca557ca26e4979d4dc633cf685435cb8 jdk8-b66
-394515ad2a55d4d54df990b36065505d3e7a3cbb jdk8-b67
-82000531feaa7baef76b6406099e5cd88943d635 jdk8-b68
-22ddcac208a8dea894a16887d04f3ca4d3c5d267 jdk8-b69
-603cceb495c8133d47b26a7502d51c7d8a67d76b jdk8-b70
-8171d23e914d758836527b80b06debcfdb718f2d jdk8-b71
-cb40427f47145b01b7e53c3e02b38ff7625efbda jdk8-b72
-191afde59e7be0e1a1d76d06f2a32ff17444f0ec jdk8-b73
-2132845cf5f717ff5c240a2431c0c0e03e66e3a5 jdk8-b74
-d4e68ce17795601017ac2f952baad7272942c36e jdk8-b75
-58be6ca3c0603882a1ec478724e337aac85e0da0 jdk8-b76
-35684a40c5845782324dbcc9ac8969528020ff61 jdk8-b77
-27d6368ae8ba570c31c2f0e696d39c99fa2f4538 jdk8-b78
-e41fb1aa0329767b2737303c994e38bede1baa07 jdk8-b79
-5f3d4a6bdd027a1631d97e2dfff63fd5e46987a4 jdk8-b80
-2a00aeeb466b9dee22508f6261f63b70f9c696fe jdk8-b81
-48e1bc77004d9af575b733c04637b98fd17603c2 jdk8-b82
-a45bb25a67c7517b45f00c9682e317f46fecbba9 jdk8-b83
-928f8b888deb785cbd7bbd5f951cd6880f11f14e jdk8-b84
-9583a6431596bac1959d2d8828f5ea217843dd12 jdk8-b85
-44a8ce4a759f2668ff434661a93ff462ea472478 jdk8-b86
-f1709874d55a06bc3d5dfa02dbcdfbc59f4cba34 jdk8-b87
-4e3a881ebb1ee96ce0872508b0066d74f310dbfa jdk8-b88
-fe4150590ee597f4e125fea950aa3b352622cc2d jdk8-b89
-c8286839d0df04aba819ec4bef12b86babccf30e jdk8-b90
-8f7ffb296385f85a4a6d53f9f2d4a7b13a8fa1ff jdk8-b91
-717aa26f8e0a1c0e768aebb3a763aca56db0c83e jdk8-b92
-8dc9d7ccbb2d77fd89bc321bb02e67c152aca257 jdk8-b93
-22f5d7f261d9d61a953d2d9a53f2e9ce0ca361d1 jdk8-b94
-2cf36f43df36137980d9828cec27003ec10daeee jdk8-b95
-3357c2776431d51a8de326a85e0f41420e40774f jdk8-b96
-469995a8e97424f450c880606d689bf345277b19 jdk8-b97
-3370fb6146e47a6cc05a213fc213e12fc0a38d07 jdk8-b98
-3f67804ab61303782df57e54989ef5e0e4629beb jdk8-b99
-8d492f1dfd1b131a4c7886ee6b59528609f7e4fe jdk8-b100
-a013024b07475782f1fa8e196e950b34b4077663 jdk8-b101
-528c7e76eaeee022817ee085668459bc97cf5665 jdk8-b102
-49c4a777fdfd648d4c3fffc940fdb97a23108ca8 jdk8-b103
-d411c60a8c2fe8fdc572af907775e90f7eefd513 jdk8-b104
-4e38de7c767e34104fa147b5b346d9fe6b731279 jdk8-b105
-2e3a056c84a71eba78945c18b05397858ffd7ad0 jdk8-b106
-23fc34133152692b725db4bd617b4c8dfd6ccb05 jdk8-b107
-a4bb3b4500164748a9c33b2283cfda76d89f25ab jdk8-b108
-428428cf5e06163322144cfb5367e1faa86acf20 jdk8-b109
-3d2b7ce93c5c2e3db748f29c3d29620a8b3b748a jdk8-b110
-85c1c94e723582f9a1dd0251502c42b73d6deea7 jdk8-b111
-43cec76d1d62587a07af07e2d9bec93aba2a506b jdk8-b112
-a259ff3e42d91da68f4d4f09d7eb9dc22bc024fc jdk8-b113
-0bbccf77c23e566170b88b52c2cf28e5d31ce927 jdk8-b114
-8d07115924b7d703a5048adb24e8aba751442f13 jdk8-b115
-5fdc4465208933ba704825b2b05e1afd062235fb jdk8-b116
-e53d1ee4d2ae898f1cf58688d45a5afe7c482173 jdk8-b117
-d6820a414f182a011a53a29a52370c696cd58dab jdk8-b118
-379fc7609beb7a3d85ebc0cc21a8a51c60d3c7d3 jdk8-b119
-53fd772d28c8a9f0f43adfc06f75f6b3cfa93cb5 jdk8-b120
-a7d3638deb2f4e33217b1ecf889479e90f9e5b50 jdk8-b121
-0cd687347540b1d14e9cc653ba6af5f6807eb379 jdk8-b122
-1ecd4619f60c2432120821e805e64bdb45de66cc jdk8-b123
-afecd2878aee29c2d0282d2c6b3ba56e91b0b2de jdk8u20-b00
-7b45151c7a05764b87ca088ba70448d39de6d41f jdk8-b124
-7547c6a90a9e06b11ec1dca943b30c09c1665aa8 jdk8u20-b01
-7b45151c7a05764b87ca088ba70448d39de6d41f jdk8-b125
-8ceb68fd9e107767edf949c6b3ac9d425ca93cac jdk8-b126
-b8c71dae05574f8eca7ca6d703b16b450850b033 jdk8-b127
-113e7569b49bca18846e5e5b74e644580b805902 jdk8-b128
-5c72d74c6805d1b4f6192f7a3550d126acf37005 jdk8-b129
-0683ee308085785d0455f4153e764e062843f178 jdk8-b130
-5e5c8f0c45dd75a08089586ca50835393f00c2cb jdk8-b131
-84fed37bbe640666bfc022c2e8b9fde468de35d2 jdk8-b132
-5de8d42f9eb7ddcdc741445f3c21a63887d694b6 jdk8u5-b01
-c750098a3ef18de28a6d739666559f0333c76c78 jdk8u5-b02
-3d9b40a53134aa33031bf13581dff9fccade9048 jdk8u5-b03
-596f4e4c5587c29767345555c4e48a5be0a58b83 jdk8u5-b04
-1f95c888e5efe010550d95ef59020ddb15876463 jdk8u11-b00
-1f95c888e5efe010550d95ef59020ddb15876463 jdk8u5-b05
-edfa8bc86fda1b2fd064abbafb4506c80a47587e jdk8u5-b06
-0a25d1c162bc046aa230577736429935716a2243 jdk8u5-b07
-df6e5fc3b585a6829c98bb91546b81dc28f8e2b4 jdk8u5-b08
-f5058197fa91153b7702214154d37b00f9714aaa jdk8u5-b09
-d9031b5525f777299554080d6beb8b077df0a614 jdk8u5-b10
-a2f7b36bfc1bc8df033fe5721b48fac1c3928a5b jdk8u5-b11
-475b96f6d8cecf720ca9fd6d332dd4bafb0f654c jdk8u5-b12
-897088ef059f53a8aa73267985666ad319223064 jdk8u5-b13
-0355626e88639a9b51b209f26f48dee28c924c72 jdk8u5-b31
-e2cfebaf3b9d0eae06c2d5ee7669180f1723f897 jdk8u11-b01
-152d1b91e5c5dfc940cccef1bfeae60a6604032a jdk8u11-b02
-60b073836311720d4f013d4493af2729ebe663f6 jdk8u11-b03
-4a0c834de2827b753e5ba2972ca3d9125a5c80eb jdk8u11-b04
-08aa9f55fe5bce1f04cfd2958f71e8df18643e29 jdk8u11-b05
-d6f052f3ad5d9244452d40236efdabe13be24716 jdk8u11-b06
-3052e1208958022173a6bf752edb88c7ad188797 jdk8u11-b07
-fff1b1687ed60d3d398b3d55c0dc71ee3450a601 jdk8u11-b08
-f846c0c1c330545b8a85fc05a36fa95f48757525 jdk8u11-b09
-3e4b895d06e8d292f7338aa2155849173722062f jdk8u11-b10
-ce324096c5626997634df1e5fa68f206909431ab jdk8u11-b11
-c4d817051c6a620a4f748e9e057423a774f172c7 jdk8u11-b12
-c79def3415b9c36e925d71d247de6bf60240a29b jdk8u11-b31
-bfafb13aac1c8b2d9184d59ec510b45d965b7667 jdk8u20-b02
-9059a1c857044ad5ce7564ddb71a064364f8fcf5 jdk8u20-b03
-abe5b0157c367a72f9059269ca633ecfe15732d2 jdk8u20-b04
-17d296953274eb110f284035ddb6c588f8b61823 jdk8u20-b05
-0683ee308085785d0455f4153e764e062843f178 jdk8-b130
-5e5c8f0c45dd75a08089586ca50835393f00c2cb jdk8-b131
-84fed37bbe640666bfc022c2e8b9fde468de35d2 jdk8-b132
-bcdc679d86aa752ccb62f6ecb182ff10ea09dce1 jdk8u20-b06
-32b9c4f0ab3c6d33f70724b775cb9d12c004be6d jdk8u20-b07
-4e4a75376185ca1a712cc9fef5a340e6927cf5e2 jdk8u20-b08
-0344396d09b0e20d4a8d1bdff9f129250a60f365 jdk8u20-b09
-e930c4fa31586b0f21887f7b50fba927550f17fb jdk8u20-b10
-9a6092124c7c926d380a5f3b0f899fd1427c6e69 jdk8u20-b11
-673829390271e51f8bc442ffbd4726833a7b1c06 jdk8u20-b12
-d9985581e2a4973b48817103cd006f70863bc776 jdk8u20-b13
-1680797c869e6e6df965c83a854fe7633ab94aa7 jdk8u20-b14
-5949c13039299a0052343e81bb7da2e2068282fa jdk8u20-b15
-db1b47c1102e31fe649e0ca13a85dc4f13281df4 jdk8u20-b16
-90a428aa799d843cfc923031bd79f9e3896b49fa jdk8u20-b17
-2c5113522ce5b887ce060b6accf225095349fc3c jdk8u20-b18
-b078cb18ef95fe1afeacab70c2c313b6abbc959c jdk8u20-b19
-aca1d25d10812c86024d9dbb7ec529876cca55e8 jdk8u20-b20
-7d1e0f0b63f1d66c77924d8b2a1accdf8f7480db jdk8u20-b21
-7677bf14d105ca23ab045f5041ceb19ee88b86c6 jdk8u20-b22
-919405d7316dfcbddee5ad8dd08905916df88e04 jdk8u20-b23
-34c930eaa6b591621afde05ca2e24571c91cdc9b jdk8u20-b24
-34c930eaa6b591621afde05ca2e24571c91cdc9b jdk8u20-b25
-37bde23c96f66912c44b1b893c08d4ad4cff5f4e jdk8u20-b26
-83bebea0c36c6ee9e663b41f9103ddcf1216ef55 jdk8u20-b31
-117f50127c27826dbe4c9e6fe1916aeab4bceef9 jdk8u20-b32
-08aa9f55fe5bce1f04cfd2958f71e8df18643e29 jdk8u25-b00
-31f50e3c0dcbdfa7f11a895179065e6888c2cf3c jdk8u25-b01
-162703b7c2f16ce00d1b54a8f95d12eda9753eba jdk8u25-b02
-ddaa2a3e452c8fbb1a7046e743096d0f9489290e jdk8u25-b03
-a76e6e02711edbfab4931dc679cbd3df6169ec84 jdk8u25-b04
-2fab01326282ee9033c089933b2dc46aef127abd jdk8u25-b05
-76068779ea16c40a9d3c14751a3bbd6c21f09cfd jdk8u25-b06
-db4d845d6a4d71ef5e48a8888f71375b0e21959f jdk8u25-b07
-afd9d9e1bbb5ab77c95a8750d2df164e05088d09 jdk8u25-b08
-1322b445ab39930c50c3901f6c439aad99a62fe8 jdk8u25-b09
-2e6da97d338ad5a65bf07f9d9648dcb74b5776b4 jdk8u25-b10
-11f77cdff0b2a07fd89f439b044d9f10a15f8fd5 jdk8u25-b11
-f560274aec4f42283c10070921afae403a153de2 jdk8u25-b12
-987bd55824c4794c8784a47fc45ecd18a9c2a5c8 jdk8u25-b13
-7e9a2027d0214019d66325fa7ca59cf8281fb43e jdk8u25-b14
-5b2cb4935667cd02d7974b3b6fb6bf4092b5acae jdk8u25-b15
-28d7f90e04e46ce8c633a2fbf0157d9e77db17c3 jdk8u25-b16
-f46df0af2ca8c7d896de375c8edac8ce09318318 jdk8u25-b17
-ee069d67c12df902cdb06ecf1747f8ff9d495a61 jdk8u25-b18
-8d0faa0eac61c04c6a5bbff2e084c9da0bd5251c jdk8u25-b31
-6617e1de7aa536d2e3671e3c50c340262b2b053e jdk8u25-b32
-c123ac2adfdc6049034d5970bec89b51ce5d8889 jdk8u25-b33
-69793b08060c9d216fa84d679c48b9e22d2400ac jdk8u31-b00
-fd5f8e3713803ca2d7898407a53996f3aa41521e jdk8u31-b01
-b6e2d1b1b24585bd02512e360d842d4713afa644 jdk8u31-b02
-1a7cc737d8081ffef73d88e94995f80d6a3dc8e0 jdk8u31-b03
-f24241b85fc90618d243f54202904ee202c44b7e jdk8u31-b04
-a3b616778301fe101bf3dcfa145d3bb4e8fc8941 jdk8u31-b05
-3de6161377bf492953260c7bf756f3ec0c6e6d60 jdk8u31-b06
-3d42c53301dd951992a32613173dd6fbb13a28a8 jdk8u31-b07
-b47677f7c1d122a2d05e03dec70de86feaedcd4c jdk8u31-b08
-95163f85c9e961c5bf37ceac645a0e7de505ca3e jdk8u31-b09
-474bf60980443dfae2fe6e121fef0caea4e014b3 jdk8u31-b10
-7e2056eba0b62247407e065f3f88a89358fc26a6 jdk8u31-b11
-285b0e589c50e46ca7ad3434221335901a547d66 jdk8u31-b12
-f89b454638d89ee5f44422b7a5b8e5651260e68f jdk8u31-b13
-705d3a4298f44f0a14925bfee5017f5824b6c0ca jdk8u31-b31
-072d325a052a5894019b74118803bf5fb9e30692 jdk8u31-b32
-bfd820cde577ba687222196e6c5159d9763df887 jdk8u31-b33
-f45b782d5583cb36a45329ce4d54f3975be8cd81 jdk8u31-b34
-7d1e0f0b63f1d66c77924d8b2a1accdf8f7480db jdk8u40-b00
-c5d9822a3c18cd9e274dfe99e91c33e02bd8f8f4 jdk8u40-b01
-504b4455570e14b7fc0a837a09c6401c603516d9 jdk8u40-b02
-91cd0ecdbe08eadf09ee89e64bf45360da8f2413 jdk8u40-b03
-f3969243c71a0f1c90f312ac755faad1deff3412 jdk8u40-b04
-740fea207f7045ab8ccc790867657d5c03a99eec jdk8u40-b05
-ced787f7545f26c3b1fdd35119ff41aa79fe6e03 jdk8u40-b06
-0d09cb188d39b5abb759977b9020ef957a0374ed jdk8u40-b07
-8d4971881c6661c51276ddb84b8e314b37d8d742 jdk8u40-b08
-bf87d71911661f583b9300795c9472179b4b3506 jdk8u40-b09
-a6d92ff8b962af32e2a9d66e956ff885d4c574b1 jdk8u40-b10
-a6dd66098734f58bc0bf847e2ca6f9b335689b9c jdk8u40-b11
-f5c47f0074b4822486c97709503b8885078c80f0 jdk8u40-b12
-7f8454e2f02fc296661a083dd4373d582980a86f jdk8u40-b13
-d36513f2cf934eb2f6f665a259cbbf2af82930c0 jdk8u40-b14
-46bf2b74baf4fc2f27b4c9238f8da94b7fcb8fe5 jdk8u40-b15
-0d3a452720a58bc203869ad606a4ea346c14c291 jdk8u40-b16
-bff1a326ac97c543b9c271adebc9deeda974edb1 jdk8u40-b17
-a1e2c13de84e00f2aedf4c40e96347306ede84f3 jdk8u40-b18
-8bbc2bb414b7e9331c2014c230553d72c9d161c5 jdk8u40-b19
-445eceffc829e205037098115c26e38e85ea5f7c jdk8u40-b20
-9c54cc92c0beb29179abbce272d3f5c8ba4ffd0e jdk8u40-b21
-4c7421f74674ebefb8e91eba59ab2a2db8c1abd7 jdk8u40-b22
-62f7faef5ed956cd481cae6216b22fdb4b6e3e46 jdk8u40-b23
-472aa5bae0e78614e873d56bcc31e7caba49963c jdk8u40-b24
-2220744100b8487976debff79e5d0c7d70738bda jdk8u40-b25
-cab2b99c6bb2e15165a58eaa36157788f82592f1 jdk8u40-b26
-bd0186cd2419129357b110fe3f13519f68b29774 jdk8u40-b27
-28a1dbd4bb9ec97427790c88d21514af2f878c94 jdk8u40-b31
-663a3151c688bc3f4c092bcad21cc81e29139d62 jdk8u40-b32
-5b700e0c00471ba1b7575fc6d03d6b0a0e041b50 jdk8u40-b33
-5761efbc739fdedcbff224e22f920e88b29af4cf jdk8u45-b00
-6a52852476c9ccb2d52153d1b94b675e863bb28c jdk8u45-b01
-3b9d342f9f584465ea5976e06357b45682f9681d jdk8u45-b02
-d3678799ed35f162928f387308d72f5401b37e84 jdk8u45-b03
-9dd8c8e1b0facfcf21657c91fc99bcb5319d1196 jdk8u45-b04
-b82ecb056ae3fd6ee06e765995c564b17a761221 jdk8u45-b05
-f538a9334f09535ef8fe13072f6a4a52e3187e1c jdk8u45-b06
-4dec7b828f1ee3adbf3c2b6430400db8b1abb5ad jdk8u45-b07
-16cb989c8b6220330a54fe78ae27b2f50fc5e794 jdk8u45-b08
-ace36a054b7faadb702d6f23e569efb77f0a7513 jdk8u45-b09
-b9ef43c59b425961526b04e92d7fa66014ec25eb jdk8u45-b10
-08c2ce4b6d59bc6b29e61fd8562b9e3d39b257a5 jdk8u45-b11
-c9bf2543c0c045ef31f0296bc355381e1a4bd4ac jdk8u45-b12
-326f02235e7a9a6da78428410320dcc980827d40 jdk8u45-b13
-50fb9bed64c9366b7bf68bddcdc553cd7295d905 jdk8u45-b14
-4afc048fe6ff7fc3fdbdadd8027549805c426d0d jdk8u45-b15
-e67045c893eaf5e3336c4fd849786fa15b81b601 jdk8u45-b31
-f2aeb52cb7cef1f984661a583baac67402f633a5 jdk8u45-b32
-e26a2620b5d206837fedab74fc84f068c7f47fa2 jdk8u45-b33
-c1399b5a4592414a8b8e6f64be019e8cf1f46074 jdk8u45-b34
-2f010018174e90b8673e5c4a3cdfed0a3c4c2fe2 jdk8u45-b35
-e953ae033f0c530f3588df430589582b6b7108d7 jdk8u45-b36
-883940e19107877d2b8c486b003253d2433fd59d jdk8u45-b37
-72d116eea419824044f8dd4ae9d3a012946f72a4 jdk8u51-b00
-b9638b9fe23876fd2413f336ee1d4e05d409e6a9 jdk8u51-b01
-bc5562ed3c2d69ffbff357e96d9e383479042000 jdk8u51-b02
-75c09ffd6c62f90153e4b043e0b40db4fa03954d jdk8u51-b03
-66908961baaec267141b1e80d04feed0c93f68fe jdk8u51-b04
-1c0a26d561f3a6b2d5a4c91161d7c92409d5f227 jdk8u51-b05
-dba5c9ee56abce73e1f6ed99a36a99d6907266c6 jdk8u51-b06
-00d57e68b59879ee59352ae18c7e40216d9e2243 jdk8u51-b07
-47492841bb10e6c995c68be533d2b4905856a17e jdk8u51-b08
-b9e5fa1d3f251d5cce02d1e7ff97279064aecdb1 jdk8u51-b09
-0011162b38bf4dab36c72bf25640c59d7128274a jdk8u51-b10
-4d59046bdb8a05cfb9e07d8e18d44956f700fe29 jdk8u51-b11
-e51a2deadf774452d98b339d65d33c72a466a453 jdk8u51-b12
-4886143e8749caf2ec42a6e77c70a98516e140a3 jdk8u51-b13
-1fbfa02e524872a75e98ee3a80e2472fa7012fde jdk8u51-b14
-d6e1f914c954f98caa31edd0037837830774dfb6 jdk8u51-b15
-3b9b39af6c36216418b78c449dd3af17b865a952 jdk8u51-b16
-5980dad8f264bb5ec3982d64a7c0af86fc5b3d16 jdk8u51-b31
-eb269a395660200c33cd58acca2df20da03567ab jdk8u51-b32
-b0daf4d3eb5f5de0f073ec9d264b1964b1920c67 jdk8u51-b33
-bd928a0bfc2c0f14eaa6a86e8d5937f9e94fd514 jdk8u51-b34
-8bbc2bb414b7e9331c2014c230553d72c9d161c5 jdk8u60-b00
-15ae8298b34beb30f2bd7baa7ff895af2bec13f6 jdk8u60-b01
-a98524c04cbd24bbc3029b21c033abf9108e92b4 jdk8u60-b02
-50cef81aa68539d0af7c5c48e370108a5b0d5a4f jdk8u60-b03
-d0e7c0ba4671c6a20ba5885e075ffa7196b738a1 jdk8u60-b04
-983825f6835055c24ed7580b6d4bd2f4e17e5425 jdk8u60-b05
-587b011966468537b1ff40a007aa51e52c823bc8 jdk8u60-b06
-058a6dd8d04cbb3d3bcc0b9d60dd05111fb37b22 jdk8u60-b07
-b184ceca742eb1a6469442af91f918ac1e1cf95c jdk8u60-b08
-e8af97f98cad81672e713c1af68d9059792a4ef2 jdk8u60-b09
-bd691208dfd6c97ffd10e2314f457d7badc47dab jdk8u60-b10
-43892f96d79eea91e67c193141f76ec31eb351d8 jdk8u60-b11
-449f9a900771900310a3f49e034c4cca478c6aff jdk8u60-b12
-b4e22b44d44664a3aa4fc2737cd63115328084b1 jdk8u60-b13
-c4108e15fbde9c67f5085aa60cd9f03e69d245dd jdk8u60-b14
-68b50073c52a2c77aa35f90d6cfdec966effc4ef jdk8u60-b15
-3b19c17ea11c3831a8a0099d6d7a1a3c7e4897c4 jdk8u60-b16
-7ef66778231f234b69515202b2dc2287143ecb49 jdk8u60-b17
-cf83b578af1935db8474d01b8642e4803a534d3a jdk8u60-b18
-eb0caffe34c6bea2ff40966757142b3dcd3a2a4c jdk8u60-b19
-4f3a29adbf4cfa2127e1108d82aaaa0d29f3c583 jdk8u60-b20
-d68de92de3bad991546b11d77de6e9c17edf7ec2 jdk8u60-b21
-3a04901d83880634ecd70c8be992189228ccd746 jdk8u60-b22
-0828bb6521738ad5a7fe11f0aa3495465f002848 jdk8u60-b23
-b0779099d006fcb2a0af493e2a2f828411bfad33 jdk8u60-b24
-c665dd5d32b04c1dbc2cf21a595fe73330849c03 jdk8u60-b25
-7828b9af7733eeaf2cafa8e05e68a2661dc3c7a8 jdk8u60-b26
-be922f27d05991e3099f42988b8ea4ad89809749 jdk8u60-b27
-1c146aed705a76fd488402219b0b7740e2aeb5e2 jdk8u60-b31
-dccb1de9712dd6aa2a1edafba861af9998ad3e62 jdk8u60-b32
-8e247b5216a5a4623c1bef7331585d78e7c0fb15 jdk8u52-b06
-974e2fd9b5b3cec38cceb35c93bcc3b5bedbe91c jdk8u52-b07
-8e247b5216a5a4623c1bef7331585d78e7c0fb15 jdk8u65-b00
-31ceb15b19bee8e02aa2cf4be5c3f147ad6afb22 jdk8u65-b01
-4c8bc7757f825f9fe0806fa13f0fe85b1a20982a jdk8u65-b02
-7a98523691a9657d4f5ecf8fb71476cecc6d5c4d jdk8u65-b03
-771cf2ce97e332e1ecffe4818d0fbe77f11e28a2 jdk8u65-b04
-5b6ff67eed5f25cc710a53026e706597c9193f56 jdk8u65-b05
-05084f644c07a81e2b246db38917df253f5e2882 jdk8u65-b06
-bc23767d08cf1e2ba8793106882a3ec9b926d9e0 jdk8u65-b07
-cc1eef73fb58c59317a0be13f31ef7a77b46b8e3 jdk8u65-b08
-db639a8f026b01059114cd32d9e44dfad2b55de0 jdk8u65-b09
-98ad80b71e1fb5c3343c33dffd40e9e92e65f087 jdk8u65-b10
-98ad80b71e1fb5c3343c33dffd40e9e92e65f087 jdk8u65-b10
-0000000000000000000000000000000000000000 jdk8u65-b10
-0000000000000000000000000000000000000000 jdk8u65-b10
-6b5f81fcbdde7bca924364448e7d98912992ac2f jdk8u65-b10
-2dcd36bfa8a4e5d789cd86ee24bdc1045bac4e06 jdk8u65-b11
-55f0343bcba5f486f955ffe7b25aac261c0003b4 jdk8u65-b12
-d7ec3a9f57de2e6c403410f7b45aa69171f18892 jdk8u65-b13
-4d70db073f332c38b861585b46fe7252b1c5b9fa jdk8u65-b14
-ac282c2b32cdc6c8f8948fca6980cb1505b36c80 jdk8u65-b15
-a844676401a206b1e98f4b5b69141b784a559766 jdk8u65-b16
-d9c2dcdd835ca332c9c44430747f9f2633c2dfd9 jdk8u65-b17
-3a04901d83880634ecd70c8be992189228ccd746 jdk8u66-b00
-3717d70ac87f5e5579e540cd990b4e958c5990a4 jdk8u66-b01
-15851994f9f81f6de37b63683c8cd9b19ae90ed1 jdk8u66-b02
-8e9e5c715064a55865975ec3626b17e0439613c7 jdk8u66-b07
-6802a364b568ce4f4398c0fc90ee0f675337a3c2 jdk8u66-b08
-81d11adaf5aa0b37ffabf45fbeb8fa19f13de596 jdk8u66-b09
-12e44aa2069b20ecbff03285dea4681325b9c05f jdk8u66-b10
-ebe5ae51f625a9d3f5e1aac835a416502c71a4a0 jdk8u66-b11
-3acb9f1828c5e9ed64a45c0101d1c59d1e784ee0 jdk8u66-b12
-f71aabee169f8342298e38923848bdb863c0f37a jdk8u66-b13
-0db478b43d7fcf26dc613241654737756ec982c5 jdk8u66-b14
-b88ba0b818831eb6f3a7954e218b371ed6f5d154 jdk8u66-b15
-606448f919ad288412669c3e78482b99d8f5f416 jdk8u66-b16
-c53412824d4ef81343418a71877172776b0980af jdk8u66-b17
-efb736c1edb983bd231617a2619d68a3eee4d850 jdk8u66-b18
-d555fb895611d083724442be79e5592ba676825c jdk8u66-b31
-4436283ad3bd05910df5f7d44321b5b581ae1004 jdk8u66-b32
-b0392e7c5b0712e00341e32c3c1e8f78d56e3695 jdk8u66-b33
-39be7bf168202244171cea701baf4986e423a86b jdk8u66-b34
-9dfa25a760c6d3785276f4372dd4eda586308e3b jdk8u66-b35
-1dfa7f7ec9853fac73ad1acc8fbff382f4ecc951 jdk8u66-b36
-cd1b3e5a3126d0808c845d2df518095b10a98059 jdk8u71-b00
-8c21767afa1a241e8312a1d4280efadfded4883d jdk8u71-b01
-c775f50c022007b4f482f51dafb95224886aca8b jdk8u71-b02
-c58d76c5ebf109d600073c919c7cd07fab8b22da jdk8u71-b03
-40c0d0766618ce3bf465b97e9effed131c4327b0 jdk8u71-b04
-ca7c15cd6f1d31067b7f29cf21d96ff69e5a9728 jdk8u71-b05
-a48ae298304c929b8952eaae45cbc91d8872bcff jdk8u71-b06
-cdc7f7d08434d1219016a0098d27c0e528a0f3dd jdk8u71-b07
-68e0b5479460cbce7b91f3eec723a652bbd2f3b8 jdk8u71-b08
-a6d5b4ad93ac5c0d53ee956ff6c121708eae1804 jdk8u71-b09
-45eccf50c18385dad143f0969671bb715c7defc5 jdk8u71-b10
-661364a8ca3415f0380a14270b69314113edcf7a jdk8u71-b11
-df868f22501c87aac038325cf1592d9677e467ed jdk8u71-b12
-82a6eb78e6a804650c5f51ffef68ba47081241ad jdk8u71-b13
-f8923f3121241a28f5107497df4c499ae4808adc jdk8u71-b14
-01490a24fddd040179bb11da9d3aabc26acd3253 jdk8u71-b15
-81296d52090354da1eb9748d63a29d30bb1230f7 jdk8u72-b00
-f0c760a2a888db7c84ec7d7a11892b8de867b2ae jdk8u72-b01
-4483a58cf74e7c237208059f94eced2ac9e2ed89 jdk8u72-b02
-c7110d67f536f9ff356ab5d871cf8316962da096 jdk8u72-b03
-948d562cd00d4a94264c5f97e55e16ce763a6367 jdk8u72-b04
-c752f355ace8127ef54b1e02968fcab934e199bd jdk8u72-b05
-ad9ef5b972345cdb79ebaf688dd026f8c2ecfd8c jdk8u72-b06
-812a4a1c5cf055413e5035ddc5ea6bff35d6ef57 jdk8u72-b07
-163f56ecf17237f326b3175a825762bae5149ce5 jdk8u72-b08
-f0d5b961f6992333074f9fe314c3e09b9d8eb43b jdk8u72-b09
-474cc933bc1ad7a3b63163aa09f4bb3fe978eda3 jdk8u72-b10
-afc6230d35e74394b14d10ec915bbdf4037e1da9 jdk8u72-b11
-3eb18c06118e0bc2fca1e1ea6c1cbddd21a27479 jdk8u72-b12
-0d9849ba664dc3381d8d6d85d5e04c00fdd476b1 jdk8u72-b13
-baa49bb35fc1798a5951fcfd3f9232332651d4e9 jdk8u72-b14
-91e3b8e2e00618f237f571fbefdfee3f4134026f jdk8u72-b15
-e3b496b6ae52f2c018e9c628c31be984bb4907e7 jdk8u73-b00
-5e484ab4b05f1398e924ab90874f7fe2ddf20731 jdk8u73-b01
-0cfcffb354bb4c76cac46f52b16a50e3b57794b9 jdk8u73-b02
-9e88cf03fe09fbf33045f43489be6f9c00e80c35 jdk8u74-b00
-0ce690c17329bde61998e5cd30b1beec9872262f jdk8u74-b01
-5eb60567655e15d7ba4c349658d707f5bde0c2b8 jdk8u74-b02
-d82cbb7a4bfe21b146f7b91ce833ac5a579c94eb jdk8u72-b31
-e3b496b6ae52f2c018e9c628c31be984bb4907e7 jdk8u73-b00
-5e484ab4b05f1398e924ab90874f7fe2ddf20731 jdk8u73-b01
-0cfcffb354bb4c76cac46f52b16a50e3b57794b9 jdk8u73-b02
-9e88cf03fe09fbf33045f43489be6f9c00e80c35 jdk8u74-b00
-0ce690c17329bde61998e5cd30b1beec9872262f jdk8u74-b01
-5eb60567655e15d7ba4c349658d707f5bde0c2b8 jdk8u74-b02
-3d00f5689b6c6e71fb1a230b7a746b61569b90ec jdk8u74-b31
-0cec2665affa36496b906c566e22ba7048ae6087 jdk8u74-b32
-7b719c1dec62535c34030cf3457abe6f478f13a0 jdk8u77-b00
-cafc1648f432eff2c392040af2db4505c3d290b6 jdk8u77-b01
-0f0077ee5e53365562ff77a01aa97d0c7374f447 jdk8u77-b02
-e8dc6eb11c761f20b44d8c4b8acb0846268872f1 jdk8u77-b03
-af6ddd4cd94c9353cc053b888de6d42d4d0faf47 jdk8u77-b31
-073b951904b3ee7c54fb79a169478fa66d925320 jdk8u75-b00
-5b48f7defe40eab668fe554df0afd87d84d60722 jdk8u75-b01
-0015f4a7f0d02a9bb79b7a0c737590f01feaabd4 jdk8u75-b02
-74b2903babf0f4138c367e3f9eea8958f5d71b94 jdk8u75-b03
-aa99436ccf826b3a2eecdaf646814e58cf514efb jdk8u75-b04
-e4dd4a6a2e67aa42d1e22246216f56a5280f83fb jdk8u75-b05
-6ca185377097c44ee1768f2f817b1b9e3b89068c jdk8u75-b06
-77880a70d92dbfc0ab1dab1aefad179c711ea852 jdk8u75-b07
-d267b16e3ecc006200ec6478904b7ea119df5b19 jdk8u75-b08
-1030aea873cdecfb6f55ab652abc67c901f61f60 jdk8u75-b09
-964fe4bba121592325cb346e3a4fa677b277d0ec jdk8u75-b10
-f7cfd44464c3c3efd6d6f29921fad4ed0de75d83 jdk8u75-b12
-7b719c1dec62535c34030cf3457abe6f478f13a0 jdk8u77-b00
-cafc1648f432eff2c392040af2db4505c3d290b6 jdk8u77-b01
-0f0077ee5e53365562ff77a01aa97d0c7374f447 jdk8u77-b02
-e8dc6eb11c761f20b44d8c4b8acb0846268872f1 jdk8u77-b03
-cd7cec8fd295c0462a813b5f54dc5457c2bade2d jdk8u91-b00
-4ea02753e66e348ee4639e157061bcbdef1d7ff3 jdk8u91-b13
-f8d0cfaa9900ebda679fa9df8319fb753858f283 jdk8u91-b14
-9f89788050d38ba4e19e24894eb8b3dd24c1a9d0 jdk8u91-b15
-7b719c1dec62535c34030cf3457abe6f478f13a0 jdk8u77-b00
-cafc1648f432eff2c392040af2db4505c3d290b6 jdk8u77-b01
-0f0077ee5e53365562ff77a01aa97d0c7374f447 jdk8u77-b02
-e8dc6eb11c761f20b44d8c4b8acb0846268872f1 jdk8u77-b03
-7deeb4f70404e4f52306f9d0bcfc482fc5f16fb3 jdk8u76-b00
-5786892e7c7d512ef9104a469ff7eafeaac12c38 jdk8u76-b01
-239155e48af89968b62e695a3233d42bed1a3282 jdk8u76-b02
-137e5c45fd5422ecd6c758c6b83a2f184abef91b jdk8u76-b03
-7bbceb589f5ddb6eefab2b23de0003de67cfc667 jdk8u76-b04
-ca66a2dd5cfd6d4d0d05ee9861ff3cadd7166761 jdk8u76-b05
-f8453e7a3185060e5625127fe76b5cd7ae64150a jdk8u76-b06
-dd1d572083b0b11f70f03408f6bb154bbdef4272 jdk8u76-b07
-fc122918583747b114b246babc82841a827c56c7 jdk8u76-b08
-afb55372bcc787b75e24afd28b00cfaaa45bb77d jdk8u76-b09
-d2f26e6433db89354b028fb75abcc6ca266d035f jdk8u76-b10
-df2dcefb08f9e3c65a4cbea75e54600649d063d0 jdk8u76-b11
-94c775e05eb053b8440d82298927a144ed73f340 jdk8u76-b12
-e0fbd6a51e061025f2d6ad0311a587f7ce3c2b43 jdk8u92-b00
-8f0466c0dce60b1df3bc01785b01a7f09fa7b564 jdk8u92-b13
-5617f9bec354fb2c60bbb816d175f4cee7d2c56e jdk8u92-b14
-fe88377e18b0c5f3da8e6741e0d5b9bfd45d2648 jdk8u92-b31
-11e4e7e901bc86d14163afbc5d28345e36737344 jdk8u92-b32
-9ed665d319590e0b9997b3703314c6b0341d4362 jdk8u92-b33
-5b5f76caf6e4ffa51f25e64d0d79a3f0913c633e jdk8u92-b34
-073b951904b3ee7c54fb79a169478fa66d925320 jdk8u75-b00
-5b48f7defe40eab668fe554df0afd87d84d60722 jdk8u75-b01
-0015f4a7f0d02a9bb79b7a0c737590f01feaabd4 jdk8u75-b02
-74b2903babf0f4138c367e3f9eea8958f5d71b94 jdk8u75-b03
-aa99436ccf826b3a2eecdaf646814e58cf514efb jdk8u101-b00
-aa99436ccf826b3a2eecdaf646814e58cf514efb jdk8u75-b04
-e4dd4a6a2e67aa42d1e22246216f56a5280f83fb jdk8u75-b05
-6ca185377097c44ee1768f2f817b1b9e3b89068c jdk8u75-b06
-77880a70d92dbfc0ab1dab1aefad179c711ea852 jdk8u75-b07
-d267b16e3ecc006200ec6478904b7ea119df5b19 jdk8u75-b08
-1030aea873cdecfb6f55ab652abc67c901f61f60 jdk8u75-b09
-964fe4bba121592325cb346e3a4fa677b277d0ec jdk8u75-b10
-f7cfd44464c3c3efd6d6f29921fad4ed0de75d83 jdk8u75-b12
-7b719c1dec62535c34030cf3457abe6f478f13a0 jdk8u77-b00
-cafc1648f432eff2c392040af2db4505c3d290b6 jdk8u77-b01
-0f0077ee5e53365562ff77a01aa97d0c7374f447 jdk8u77-b02
-e8dc6eb11c761f20b44d8c4b8acb0846268872f1 jdk8u77-b03
-cd7cec8fd295c0462a813b5f54dc5457c2bade2d jdk8u91-b00
-4ea02753e66e348ee4639e157061bcbdef1d7ff3 jdk8u91-b13
-7deeb4f70404e4f52306f9d0bcfc482fc5f16fb3 jdk8u76-b00
-5786892e7c7d512ef9104a469ff7eafeaac12c38 jdk8u76-b01
-239155e48af89968b62e695a3233d42bed1a3282 jdk8u76-b02
-137e5c45fd5422ecd6c758c6b83a2f184abef91b jdk8u76-b03
-7bbceb589f5ddb6eefab2b23de0003de67cfc667 jdk8u76-b04
-ca66a2dd5cfd6d4d0d05ee9861ff3cadd7166761 jdk8u76-b05
-f8453e7a3185060e5625127fe76b5cd7ae64150a jdk8u76-b06
-dd1d572083b0b11f70f03408f6bb154bbdef4272 jdk8u76-b07
-fc122918583747b114b246babc82841a827c56c7 jdk8u76-b08
-afb55372bcc787b75e24afd28b00cfaaa45bb77d jdk8u76-b09
-d2f26e6433db89354b028fb75abcc6ca266d035f jdk8u76-b10
-df2dcefb08f9e3c65a4cbea75e54600649d063d0 jdk8u76-b11
-94c775e05eb053b8440d82298927a144ed73f340 jdk8u76-b12
-e0fbd6a51e061025f2d6ad0311a587f7ce3c2b43 jdk8u92-b00
-8f0466c0dce60b1df3bc01785b01a7f09fa7b564 jdk8u92-b13
-aa99436ccf826b3a2eecdaf646814e58cf514efb jdk8u81-b00
-8674aec1be6459f33451690fb106eec314964116 jdk8u101-b01
-96a43945cb6a69989294b511ecdfc0493ea09bf1 jdk8u101-b02
-371b0c5477d8613c06fd1206deed27759f18e42e jdk8u101-b03
-52cca1ce8b473ecd751da2350d4b3ef111b5676e jdk8u101-b04
-3edb6296456161d67bf33a73faf18dc57ef548de jdk8u101-b05
-37bd092c2a7a9e71c027a33757429e02e00050de jdk8u101-b06
-df3cd274d224e22e156556bc0d7b8927b72a7608 jdk8u101-b07
-b8914ce62047d20076a64fd43a6ca8f5bb470047 jdk8u101-b08
-317ccda98b74d445f6d3b241783a22cc167cedbf jdk8u101-b09
-7c90acc432738bdc1506d510daeadf9376279dfa jdk8u101-b10
-4942432b3da1afbc2c2c87bdf896b112800e537c jdk8u101-b11
-f8511bfb19c35d8d396dc53245c06cc3710657b1 jdk8u101-b12
-2bb2aec4b3e51aab96e9c25603c7c92fcbac46de jdk8u101-b13
-223d0e48a55b92255f5a613743a99e7deacaf455 jdk8u102-b00
-223d0e48a55b92255f5a613743a99e7deacaf455 jdk8u82-b00
-9d09a2f1395561fe71b1a83f53907ddc52e699d6 jdk8u102-b01
-564fbe28cbb0ff2e6f55623807ea816042de00ff jdk8u102-b02
-ab7dbd58a766fb01c6643f3a80c9e96ac1278a06 jdk8u102-b03
-626d8fa7a1bfd9e65b94117a526ba57b25ec3d14 jdk8u102-b04
-3c35b66b5345f615a3ff626111587c452c8c3893 jdk8u102-b05
-2a265ab91dd234348630dab92f622a616ab76a0e jdk8u102-b06
-8d44271dd11dd4bdc88ef647fd144e544791ecc4 jdk8u102-b07
-329501e6cc220884f005afc7cd330e227931fb21 jdk8u102-b08
-e108e30edcca932832e4e5edf1a15349d3be2fed jdk8u102-b09
-e0d70741f35cd16289de3fd6049834879725dae5 jdk8u102-b10
-360a2772486dd1aa818132222ea0b7fcfa5707ef jdk8u102-b11
-57546b5b575dec9ecfbb1e9a77d87c391a44ab96 jdk8u102-b12
-a7c292080d5ed76ea5e3b123c0dee4c340aa174f jdk8u102-b13
-56b133772ec1aa4f44f2eee2c4103c645f764935 jdk8u102-b14
-8ba5a41487af9fe72aeb92e790327d12dce0de8c jdk8u102-b31
-8f015ee0842df021532a4b88c436ea9daed785b6 jdk8u102-b32
-f98a2ad119c097d532b013c275f67ad50a4236b7 jdk8u102-b33
-4da84a2c86c336c06265a2a7e9e3b7b7b4596f74 jdk8u102-b34
-ea8f493651778ad4f577839b28d6484b3a89b6c1 jdk8u102-b35
-52cca1ce8b473ecd751da2350d4b3ef111b5676e jdk8u111-b00
-d123c31c3bc21ccf02ac7368f5476dd9975e15e3 jdk8u111-b01
-981c4d9dab16b3fa7333e5baa5497c299acd5172 jdk8u111-b02
-893adc105044c14abfb54de32a79f2f21981cafa jdk8u111-b03
-ec7b9aafd7e1e9763925e8b794834612bbe0e19b jdk8u111-b04
-3a25f8a752524bad7e78800158c485b890be3982 jdk8u111-b05
-d5dabec41733e59f00dd456f88fb00b3803bed8b jdk8u111-b06
-d8a1e50ce110d18b3ad01ee5c997425bfe90b2a1 jdk8u111-b07
-560812b6d1948df7794f22840e4e3976258b034e jdk8u111-b08
-dbbb2551c63687d9c4a2bb38c42864503cf06465 jdk8u111-b09
-36ccdd95d018368c8a1d70fd40cc8ca3a2c0590f jdk8u111-b10
-dad7b1a59da60d68ff26bf7414b87995fecaaba6 jdk8u111-b11
-a42cdfaa1218a636d2cd0b89a233362cdf32dd4b jdk8u111-b12
-2214875a44e52789acf404b56543f613516ee498 jdk8u111-b13
-7898951ff63c9ea721b8f669b9c749d6c3a2db99 jdk8u111-b14
-b87d82f5c33dfb55bfc81254044f28eea5d7424a jdk8u112-b00
-1f2394102288d9073652064784e31a3f52fc5d4b jdk8u112-b01
-40c934289deefd68915f6519d71a4e315c69117a jdk8u112-b02
-ddb3a8afe0ad50e04d360efa96aee78cb599ea72 jdk8u112-b03
-1d0047d03f04c0c15c7856e0f177b9e15e94a692 jdk8u112-b04
-b6cdfd0b4a9cff1ed1bb43ef7fb21dc4d2dfe7d8 jdk8u112-b06
-9d09ca09ea33e6af774914606f94960e5af4fc9b jdk8u112-b07
-0ac6b67980512ce025a280d42c05156293613dbb jdk8u112-b08
-0d9ae87a0dfe893922b730312d9173ad5dd5f0d6 jdk8u112-b09
-09fb07ae151729154a2dd253d06bdad8955c2685 jdk8u112-b10
-4363b0b339a482ec9eefee11dc5877a618e8c681 jdk8u112-b11
-be34a52805408eb5edaf3d8de4fae47632a757c5 jdk8u112-b12
-4d45315307323fcb9dd84c3f0b0a1dc76f2b3b5f jdk8u112-b13
-18bbb95d097e04ea2b88df8910056fe294da0149 jdk8u112-b14
-30f83ac389f06c38dc0b6f71b1d8344c01436a16 jdk8u112-b15
-8ef3cc2bbc7dc687e9502ae957337b1ded1b32d4 jdk8u112-b16
-7d4291146927c3430652a07f506d530c2eff7eb9 jdk8u112-b31
-3a25f8a752524bad7e78800158c485b890be3982 jdk8u121-b00
-1ebd97292358cd158b6f7d5884526207fbfe796e jdk8u121-b01
-349d130d7a7f2bcaaed8dd2696030022eb4e7b75 jdk8u121-b02
-2090928e4b80e849fff4797ee05b99c076f14667 jdk8u121-b03
-a80781c494079d7d92f806f1f4cf57e856435781 jdk8u121-b04
-cf1b7263a217eb891597aa5b64edde94970600c6 jdk8u121-b05
-f98001da328ffdb5de76c4ba6672f3bda4c22e51 jdk8u121-b06
-367d1b35f2b2ccf47ba0c1c565613c4741b58056 jdk8u121-b07
-43598d9344e383d039eabeb3ee59316d0cc3e4c6 jdk8u121-b08
-c0210b2071599fa54aec59576ca942461ed8160a jdk8u121-b09
-e24a55876a79b630e8cfca7a1b38a0ee372f8533 jdk8u121-b10
-acbfa2934b2411dd20aacb42d1c8dd198fe9f8e9 jdk8u121-b11
-cc9a5d631b77582d52aceaf6d6066e99533d1756 jdk8u121-b12
-386e9b79fcf5bfad5ff7b0fc991a7c6c5cbfed17 jdk8u121-b13
-58d0ffe75dc5597310d422e214dc077476bd2338 jdk8u122-b00
-a87b06da783bb5a11f7857220789979129e39e7c jdk8u122-b01
-8684348ae5eb6f895d19e4752dea567642dbcec4 jdk8u122-b02
-117a593d021502529821afbd7e0d695c170449f8 jdk8u122-b03
-117a593d021502529821afbd7e0d695c170449f8 jdk8u122-b03
-0000000000000000000000000000000000000000 jdk8u122-b03
-0000000000000000000000000000000000000000 jdk8u122-b03
-f8661a76fe475b1d7653493e407086830fde81f8 jdk8u122-b03
-7bd4195b17aa0a268eee4bc4b89f30ed3b096898 jdk8u122-b04
-f86d6064d7cfa022425c3df03d4335511ab33ecb jdk8u132-b00
-ea3d3c26102dcb82d9b140f729308395310dae7a jdk8u152-b00
-1819d008129b31df8c74b5d16e9daabc2bdcc10c jdk8u152-b01
diff --git a/.jcheck/conf b/.jcheck/conf
deleted file mode 100644
index 5bd24b1..0000000
--- a/.jcheck/conf
+++ /dev/null
@@ -1,2 +0,0 @@
-project=jdk8
-bugids=dup
diff --git a/ASSEMBLY_EXCEPTION b/ASSEMBLY_EXCEPTION
deleted file mode 100644
index 065b8d9..0000000
--- a/ASSEMBLY_EXCEPTION
+++ /dev/null
@@ -1,27 +0,0 @@
-
-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/LICENSE b/LICENSE
deleted file mode 100644
index 8b400c7..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,347 +0,0 @@
-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/README b/README
deleted file mode 100644
index 56825f5..0000000
--- a/README
+++ /dev/null
@@ -1,14 +0,0 @@
-README:
- This file should be located at the top of the corba Mercurial repository.
-
- See http://openjdk.java.net/ for more information about the OpenJDK.
-
- See ../README-builds.html for complete details on build machine requirements.
-
-Simple Build Instructions:
-
- cd make && gnumake
-
- The files that will be imported into the jdk build will be in the "dist"
- directory.
-
diff --git a/THIRD_PARTY_README b/THIRD_PARTY_README
deleted file mode 100644
index 2b20da2..0000000
--- a/THIRD_PARTY_README
+++ /dev/null
@@ -1,3574 +0,0 @@
-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/make/BuildCorba.gmk b/make/BuildCorba.gmk
deleted file mode 100644
index 3190ce8..0000000
--- a/make/BuildCorba.gmk
+++ /dev/null
@@ -1,265 +0,0 @@
-#
-# Copyright (c) 2007, 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.
-#
-
-#
-# Makefile for building the corba workspace.
-#
-
-# This must be the first rule
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
-include IdlCompilation.gmk
-
-# The Corba sources are old and generates a LOT of warnings.
-# Disable these using Xlint, until someone cares to fix them.
-DISABLE_CORBA_WARNINGS := -Xlint:all,-deprecation,-unchecked,-serial,-fallthrough,-cast,-rawtypes,-static,-dep-ann
-
-# The "generate old bytecode" javac setup uses the new compiler to compile for the
-# boot jdk to generate tools that need to be run with the boot jdk.
-# Thus we force the target bytecode to the boot jdk bytecode.
-$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
- JVM := $(JAVA), \
- JAVAC := $(NEW_JAVAC), \
- FLAGS := $(BOOT_JDK_SOURCETARGET) \
- -bootclasspath "$(BOOT_RTJAR)$(PATH_SEP)$(BOOT_TOOLSJAR)" \
- $(DISABLE_CORBA_WARNINGS), \
- SERVER_DIR := $(SJAVAC_SERVER_DIR), \
- SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
-
-# The "generate new bytecode" uses the new compiler to generate bytecode
-# for the new jdk that is being built. The code compiled by this setup
-# cannot necessarily be run with the boot jdk.
-$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE, \
- JVM := $(JAVA), \
- JAVAC := $(NEW_JAVAC), \
- FLAGS := -cp $(BOOT_TOOLSJAR) -XDignore.symbol.file=true $(DISABLE_CORBA_WARNINGS), \
- SERVER_DIR := $(SJAVAC_SERVER_DIR), \
- SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
-
-$(eval $(call SetupJavaCompilation,BUILD_STRIPPROP, \
- SETUP := GENERATE_OLDBYTECODE, \
- SRC := $(CORBA_TOPDIR)/make/tools/src, \
- BIN := $(CORBA_OUTPUTDIR)/btclasses/stripprop_classes))
-
-$(eval $(call SetupArchive,ARCHIVE_STRIPPROP, $(BUILD_STRIPPROP), \
- SRCS := $(CORBA_OUTPUTDIR)/btclasses/stripprop_classes, \
- JAR := $(CORBA_OUTPUTDIR)/btjars/stripproperties.jar, \
- JARMAIN := build.tools.stripproperties.StripPropertiesCorba))
-
-$(eval $(call SetupJavaCompilation,BUILD_IDLJ, \
- SETUP := GENERATE_OLDBYTECODE, \
- SRC := $(CORBA_TOPDIR)/src/share/classes, \
- BIN := $(CORBA_OUTPUTDIR)/btclasses/idlj_classes, \
- COPY := .prp, \
- INCLUDES := com/sun/tools/corba/se/idl, \
- EXCLUDE_FILES := ResourceBundleUtil.java))
-
-$(eval $(call SetupArchive,ARCHIVE_IDLJ, $(BUILD_IDLJ), \
- SRCS := $(CORBA_OUTPUTDIR)/btclasses/idlj_classes, \
- SUFFIXES := .class .prp, \
- JAR := $(CORBA_OUTPUTDIR)/btjars/idlj.jar, \
- JARMAIN := com.sun.tools.corba.se.idl.toJavaPortable.Compile))
-
-$(eval $(call SetupJavaCompilation,BUILD_LOGUTIL, \
- SETUP := GENERATE_OLDBYTECODE, \
- SRC := $(CORBA_TOPDIR)/src/share/classes, \
- BIN := $(CORBA_OUTPUTDIR)/btclasses/logutil_classes, \
- INCLUDES := com/sun/tools/corba/se/logutil))
-
-$(eval $(call SetupArchive,ARCHIVE_LOGUTIL, $(BUILD_LOGUTIL), \
- SRCS := $(CORBA_OUTPUTDIR)/btclasses/logutil_classes, \
- JAR := $(CORBA_OUTPUTDIR)/btjars/logutil.jar, \
- JARMAIN := com.sun.tools.corba.se.logutil.MC))
-
-# Generate LogWrapper classes
-$(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/%SystemException.java: \
- $(CORBA_TOPDIR)/src/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
- $(CORBA_OUTPUTDIR)/btjars/logutil.jar
- $(MKDIR) -p $(@D)
- $(RM) -f $(@D)/_the_wrappers.d
- $(ECHO) $(LOG_INFO) Generating class file from $*.mc
- $(JAVA) -jar $(CORBA_OUTPUTDIR)/btjars/logutil.jar make-class $< $(@D)
-
-# Generate LogWrapper properties file by concatening resource files
-$(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/LogStrings.properties: \
- $(CORBA_OUTPUTDIR)/logwrappers/ActivationSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/IORSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/InterceptorsSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/NamingSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/OMGSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/ORBUtilSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/POASystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/UtilSystemException.resource
- $(MKDIR) -p $(@D)
- $(ECHO) $(LOG_INFO) Concatenating 8 resource files into $(@F)
- $(CAT) $^ > $@
-
-# The resources files are generated from lisp-like .mc files.
-$(CORBA_OUTPUTDIR)/logwrappers/%SystemException.resource: $(CORBA_TOPDIR)/src/share/classes/com/sun/corba/se/spi/logging/data/%.mc $(CORBA_OUTPUTDIR)/btjars/logutil.jar
- $(MKDIR) -p $(@D)
- $(RM) -f $(@D)/_the_wrappers.d
- $(ECHO) $(LOG_INFO) Generating resource file from $*.mc
- $(JAVA) -jar $(CORBA_OUTPUTDIR)/btjars/logutil.jar make-resource $< $(@D)
-
-
-$(CORBA_OUTPUTDIR)/logwrappers/_the_wrappers.d: $(CORBA_OUTPUTDIR)/btjars/logutil.jar \
- $(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/ActivationSystemException.java \
- $(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/IORSystemException.java \
- $(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/InterceptorsSystemException.java \
- $(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/NamingSystemException.java \
- $(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/OMGSystemException.java \
- $(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/ORBUtilSystemException.java \
- $(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/POASystemException.java \
- $(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/UtilSystemException.java \
- $(CORBA_OUTPUTDIR)/logwrappers/com/sun/corba/se/impl/logging/LogStrings.properties
- $(MKDIR) -p $(@D)
- $(ECHO) LOGWRAPPERS_ARE_CREATED = yes > $@
-
-# Trigger the generation of the logwrappers. After the logwrapper classes and
-# resources have been created, then the makefile will restart and the newly
-# created java files will become part of the build further along in the makefile.
--include $(CORBA_OUTPUTDIR)/logwrappers/_the_wrappers.d
-
-ifeq ($(LOGWRAPPERS_ARE_CREATED), yes)
-
- $(eval $(call SetupIdlCompilation,BUILD_IDLS, \
- IDLJ := $(JAVA) -jar $(CORBA_OUTPUTDIR)/btjars/idlj.jar, \
- SRC := $(CORBA_TOPDIR)/src/share/classes, \
- BIN := $(CORBA_OUTPUTDIR)/gensrc, \
- EXCLUDES := com/sun/tools/corba/se/idl/% \
- org/omg/CORBA/% \
- com/sun/corba/se/GiopIDL/% \
- org/omg/PortableServer/corba.idl, \
- INCLUDES := %, \
- OLDIMPLBASES := com/sun/corba/se/PortableActivationIDL/activation.idl \
- com/sun/corba/se/spi/activation/activation.idl, \
- DELETES := DYNANYDELETEFILES org/omg/DynamicAny/*POA* org/omg/DynamicAny/*Holder* org/omg/DynamicAny/DynValueBoxHelper.java org/omg/DynamicAny/DynValueCommonHelper.java org/omg/DynamicAny/_DynValueCommonStub.java org/omg/DynamicAny/_DynValueBoxStub.java org/omg/DynamicAny/DynAnyPackage/TypeMismatchHolder.java org/omg/DynamicAny/DynAnyPackage/InvalidValueHolder.java org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHolder.java IOPDELETEFILES org/omg/IOP/BI_DIR_IIOP.java org/omg/IOP/ChainBypassCheck.java org/omg/IOP/ChainBypassInfo.java org/omg/IOP/FORWARDED_IDENTITY.java org/omg/IOP/INVOCATION_POLICIES.java org/omg/IOP/LogicalThreadId.java org/omg/IOP/SendingContextRunTime.java org/omg/IOP/UnknownExceptionInfo.java org/omg/IOP/TaggedComponentSeqHolder.java POAHELHOLFILES org/omg/PortableServer/CurrentPackage/NoContextHolder.java org/omg/PortableServer/ForwardRequestHolder.java org/omg/PortableServer/IdAssignmentPolicyValueHelper.java org/omg/PortableServer/IdAssignmentPolicyValueHolder.java org/omg/PortableServer/IdUniquenessPolicyValueHelper.java org/omg/PortableServer/IdUniquenessPolicyValueHolder.java org/omg/PortableServer/ImplicitActivationPolicyValueHelper.java org/omg/PortableServer/ImplicitActivationPolicyValueHolder.java org/omg/PortableServer/LifespanPolicyValueHelper.java org/omg/PortableServer/LifespanPolicyValueHolder.java org/omg/PortableServer/ServantRetentionPolicyValueHelper.java org/omg/PortableServer/ServantRetentionPolicyValueHolder.java org/omg/PortableServer/ObjectIdHelper.java org/omg/PortableServer/ObjectIdHolder.java org/omg/PortableServer/POAListHelper.java org/omg/PortableServer/POAListHolder.java org/omg/PortableServer/POAManagerPackage/AdapterInactiveHolder.java org/omg/PortableServer/POAManagerPackage/StateHelper.java org/omg/PortableServer/POAManagerPackage/StateHolder.java org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHolder.java org/omg/PortableServer/POAPackage/AdapterNonExistentHolder.java org/omg/PortableServer/POAPackage/InvalidPolicyHolder.java org/omg/PortableServer/POAPackage/NoServantHolder.java org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHolder.java org/omg/PortableServer/POAPackage/ObjectNotActiveHolder.java org/omg/PortableServer/POAPackage/ServantAlreadyActiveHolder.java org/omg/PortableServer/POAPackage/ServantNotActiveHolder.java org/omg/PortableServer/POAPackage/WrongAdapterHolder.java org/omg/PortableServer/POAPackage/WrongPolicyHolder.java org/omg/PortableServer/RequestProcessingPolicyValueHelper.java org/omg/PortableServer/RequestProcessingPolicyValueHolder.java org/omg/PortableServer/ServantActivatorHolder.java org/omg/PortableServer/ServantLocatorHolder.java org/omg/PortableServer/ThreadPolicyValueHelper.java org/omg/PortableServer/ThreadPolicyValueHolder.java PIHELHOLFILES org/omg/PortableInterceptor/ClientRequestInfoHelper.java org/omg/PortableInterceptor/ClientRequestInterceptorHelper.java org/omg/PortableInterceptor/IORInfoHelper.java org/omg/PortableInterceptor/IORInterceptorHelper.java org/omg/PortableInterceptor/InterceptorHelper.java org/omg/PortableInterceptor/ORBInitInfoHelper.java org/omg/PortableInterceptor/ORBInitializerHelper.java org/omg/PortableInterceptor/PolicyFactoryHelper.java org/omg/PortableInterceptor/ReplyStatusHelper.java org/omg/PortableInterceptor/RequestInfoHelper.java org/omg/PortableInterceptor/ServerRequestInfoHelper.java org/omg/PortableInterceptor/ServerRequestInterceptorHelper.java org/omg/PortableInterceptor/SlotIdHelper.java org/omg/PortableInterceptor/ClientRequestInfoHolder.java org/omg/PortableInterceptor/ClientRequestInterceptorHolder.java org/omg/PortableInterceptor/CurrentHolder.java org/omg/PortableInterceptor/ForwardRequestHolder.java org/omg/PortableInterceptor/IORInfoHolder.java org/omg/PortableInterceptor/IORInterceptorHolder.java org/omg/PortableInterceptor/InterceptorHolder.java org/omg/PortableInterceptor/InvalidSlotHolder.java org/omg/PortableInterceptor/ORBInitInfoHolder.java org/omg/PortableInterceptor/ORBInitializerHolder.java org/omg/PortableInterceptor/PolicyFactoryHolder.java org/omg/PortableInterceptor/RequestInfoHolder.java org/omg/PortableInterceptor/ServerRequestInfoHolder.java org/omg/PortableInterceptor/ServerRequestInterceptorHolder.java org/omg/PortableInterceptor/TaggedComponentSeqHolder.java org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHolder.java org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHolder.java org/omg/IOP/CodecPackage/FormatMismatchHolder.java org/omg/IOP/CodecPackage/InvalidTypeForEncodingHolder.java org/omg/IOP/CodecPackage/TypeMismatchHolder.java org/omg/IOP/CodecHelper.java org/omg/IOP/EncodingFormatHelper.java org/omg/IOP/EncodingHelper.java org/omg/IOP/CodecFactoryPackage/UnknownEncodingHolder.java org/omg/IOP/CodecFactoryHolder.java org/omg/IOP/CodecHolder.java org/omg/IOP/EncodingHolder.java org/omg/IOP/TaggedComponentSeqHelper.java org/omg/Dynamic/ContextListHelper.java org/omg/Dynamic/ExceptionListHelper.java org/omg/Dynamic/ParameterHolder.java org/omg/Dynamic/ParameterListHolder.java org/omg/Dynamic/ExceptionListHolder.java org/omg/Dynamic/ParameterHelper.java org/omg/Dynamic/ParameterListHelper.java org/omg/Dynamic/RequestContextHelper.java CORBAX org/omg/CORBA/OctetSeqHelper.java org/omg/CORBA/OctetSeqHolder.java org/omg/CORBA/PolicyError.java org/omg/CORBA/RepositoryIdHelper.java))
-
- $(BUILD_IDLS): $(CORBA_OUTPUTDIR)/btjars/idlj.jar
-
- $(CORBA_OUTPUTDIR)/gensrc/_the_idls.d: $(BUILD_IDLS) $(CORBA_OUTPUTDIR)/btjars/idlj.jar
- $(MKDIR) -p $(@D)
- $(ECHO) IDLS_ARE_CREATED = yes > $@
-
- -include $(CORBA_OUTPUTDIR)/gensrc/_the_idls.d
-
- ifeq ($(IDLS_ARE_CREATED), yes)
-
- $(eval $(call SetupJavaCompilation,BUILD_CORBA, \
- SETUP := GENERATE_NEWBYTECODE, \
- SRC := $(CORBA_TOPDIR)/src/share/classes $(CORBA_OUTPUTDIR)/gensrc $(CORBA_OUTPUTDIR)/logwrappers, \
- EXCLUDES := com/sun/corba/se/PortableActivationIDL \
- com/sun/tools/corba/se/logutil, \
- EXCLUDE_FILES := com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java \
- com/sun/corba/se/spi/presentation/rmi/StubWrapper.java \
- com/sun/org/omg/CORBA/IDLTypeOperations.java \
- com/sun/org/omg/CORBA/IRObjectOperations.java \
- org/omg/PortableInterceptor/UNKNOWN.java \
- com/sun/tools/corba/se/idl/ResourceBundleUtil.java \
- com/sun/corba/se/impl/presentation/rmi/jndi.properties, \
- COPY := .prp LogStrings.properties, \
- BIN := $(CORBA_OUTPUTDIR)/classes))
-
- $(eval $(call SetupJavaCompilation,BUILD_BOOTSTRAP_CORBA, \
- SETUP := GENERATE_OLDBYTECODE, \
- SRC := $(BUILD_CORBA_SRC), \
- EXCLUDES := $(BUILD_CORBA_EXCLUDES), \
- EXCLUDE_FILES := $(BUILD_CORBA_EXCLUDE_FILES), \
- COPY := $(BUILD_CORBA_COPY), \
- BIN := $(CORBA_OUTPUTDIR)/btclasses/corba_classes, \
- JAR := $(CORBA_OUTPUTDIR)/btjars/btcorba.jar))
-
- # Separate src.zip call to include sources that were excluded in the build to
- # mimic behavior in old build system.
- $(eval $(call SetupZipArchive,ARCHIVE_BUILD_CORBA, \
- SRC := $(CORBA_TOPDIR)/src/share/classes $(CORBA_OUTPUTDIR)/gensrc $(CORBA_OUTPUTDIR)/logwrappers, \
- ZIP := $(CORBA_OUTPUTDIR)/dist/lib/src.zip))
-
- $(BUILD_CORBA): $(BUILD_IDLS) $(LOGWRAPPER_DEPENDENCIES)
-
- # Run stripproperties on all sunorb resource files.
- STRIP_PROP_SRC_FILES := $(shell $(FIND) $(CORBA_TOPDIR)/src/share/classes -name "sunorb*.properties")
- STRIP_PROP_FILES := $(patsubst $(CORBA_TOPDIR)/src/share/classes/%, $(CORBA_OUTPUTDIR)/classes/%, \
- $(STRIP_PROP_SRC_FILES))
- # Simple delivery of zh_HK properties files just copies zh_TW properties files
- STRIP_PROP_FILES += $(patsubst $(CORBA_TOPDIR)/src/share/classes/%_zh_TW.properties, \
- $(CORBA_OUTPUTDIR)/classes/%_zh_HK.properties, \
- $(shell $(FIND) $(CORBA_TOPDIR)/src/share/classes -name "sunorb_zh_TW.properties"))
- STRIP_PROP_SRC_FILES += $(shell $(FIND) $(CORBA_TOPDIR)/src/share/classes -name "sunorb_zh_TW.properties")
- STRIP_PROP_CMDLINE := $(subst _SPACE_, $(SPACE), \
- $(join $(addprefix -clean_SPACE_, $(STRIP_PROP_SRC_FILES)), \
- $(addprefix _SPACE_, $(STRIP_PROP_FILES))))
-
- $(CORBA_OUTPUTDIR)/_the.stripped_properties: $(STRIP_PROP_SRC_FILES) \
- $(CORBA_OUTPUTDIR)/btjars/stripproperties.jar
- $(MKDIR) -p $(sort $(dir $(STRIP_PROP_FILES)))
- $(call ListPathsSafely,STRIP_PROP_CMDLINE,\n, >> $(CORBA_OUTPUTDIR)/_the.strip_prop.cmdline)
- $(JAVA) -jar $(CORBA_OUTPUTDIR)/btjars/stripproperties.jar \
- @$(CORBA_OUTPUTDIR)/_the.strip_prop.cmdline
- $(TOUCH) $@
-
- $(eval $(call SetupArchive,ARCHIVE_CORBA, \
- $(BUILD_CORBA) $(CORBA_OUTPUTDIR)/_the.stripped_properties, \
- SRCS := $(CORBA_OUTPUTDIR)/classes, \
- SUFFIXES := .class .prp .properties, \
- JAR := $(CORBA_OUTPUTDIR)/dist/lib/classes.jar))
-
- # The created classes.jar now contains Corba compiled to run on the target JDK
- # and is ready for inclusion in jdk rt.jar.
-
- # The created src.zip now contains .java and .properties files used to create the classes in classes.jar
- # and is ready for inclusion into the jdk src.zip
-
- BIN_FILES := $(CORBA_TOPDIR)/src/share/classes/com/sun/tools/corba/se/idl/orb.idl \
- $(CORBA_TOPDIR)/src/share/classes/com/sun/tools/corba/se/idl/ir.idl
-
- $(CORBA_OUTPUTDIR)/dist/lib/bin.zip: $(BIN_FILES) $(CORBA_OUTPUTDIR)/dist/lib/classes.jar
- $(MKDIR) -p $(CORBA_OUTPUTDIR)/dist/lib
- $(MKDIR) -p $(CORBA_OUTPUTDIR)/lib
- $(RM) -f $@
- $(ECHO) Creating `basename $@`
- $(CP) $(BIN_FILES) $(CORBA_OUTPUTDIR)/lib
- $(CHMOD) ug+w $(CORBA_OUTPUTDIR)/lib/*
- (cd $(CORBA_OUTPUTDIR); $(ZIP) -q $@ lib/orb.idl lib/ir.idl)
-
- # The created bin.zip now contains the corba specific binaries: orb.idl, ir.idl
-
- all: $(CORBA_OUTPUTDIR)/btjars/stripproperties.jar \
- $(CORBA_OUTPUTDIR)/btjars/idlj.jar \
- $(CORBA_OUTPUTDIR)/btjars/logutil.jar \
- $(CORBA_OUTPUTDIR)/btjars/btcorba.jar \
- $(CORBA_OUTPUTDIR)/dist/lib/classes.jar \
- $(CORBA_OUTPUTDIR)/dist/lib/src.zip \
- $(CORBA_OUTPUTDIR)/dist/lib/bin.zip
- endif
-endif
-
-clean:
- $(RM) -rf $(CORBA_OUTPUTDIR)
-
-.PHONY: default all clean clobber
diff --git a/make/Makefile b/make/Makefile
deleted file mode 100644
index 4570070..0000000
--- a/make/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# Copyright (c) 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.
-#
-
-# Locate this Makefile
-ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), )
- makefile_path := $(CURDIR)/$(lastword $(MAKEFILE_LIST))
-else
- makefile_path := $(lastword $(MAKEFILE_LIST))
-endif
-repo_dir := $(patsubst %/make/Makefile, %, $(makefile_path))
-
-# What is the name of this subsystem (langtools, corba, etc)?
-subsystem_name := $(notdir $(repo_dir))
-
-# Try to locate top-level makefile
-top_level_makefile := $(repo_dir)/../Makefile
-ifneq ($(wildcard $(top_level_makefile)), )
- $(info Will run $(subsystem_name) target on top-level Makefile)
- $(info WARNING: This is a non-recommended way of building!)
- $(info ===================================================)
-else
- $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?)
- $(error Build from top-level Makefile instead)
-endif
-
-all:
- @$(MAKE) -f $(top_level_makefile) $(subsystem_name)
diff --git a/make/tools/src/build/tools/stripproperties/StripPropertiesCorba.java b/make/tools/src/build/tools/stripproperties/StripPropertiesCorba.java
deleted file mode 100644
index b5c7ecb..0000000
--- a/make/tools/src/build/tools/stripproperties/StripPropertiesCorba.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-package build.tools.stripproperties;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedWriter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * Reads a properties file from standard input and writes an equivalent
- * properties file without comments to standard output.
- */
-public class StripPropertiesCorba {
-
- private static void error(String msg, Exception e) {
- System.err.println("ERROR: stripproperties: " + msg);
- if ( e != null ) {
- System.err.println("EXCEPTION: " + e.toString());
- e.printStackTrace();
- }
- }
-
- private static List<String> infiles = new ArrayList<String>();
- private static List<String> outfiles = new ArrayList<String>();
-
- private static boolean parseOptions(String args[]) {
- boolean ok = true;
-
- for ( int i = 0; i < args.length ; i++ ) {
- if ( "-clean".equals(args[i]) && i+2 < args.length ) {
- infiles.add(args[++i]);
- outfiles.add(args[++i]);
- } else if ( args[i].charAt(0)=='@') {
- String filename = args[i].substring(1);
- FileInputStream finput = null;
- byte contents[] = null;
- try {
- finput = new FileInputStream(filename);
- int byteCount = finput.available();
- if ( byteCount <= 0 ) {
- error("The @file is empty", null);
- ok = false;
- } else {
- contents = new byte[byteCount];
- int bytesRead = finput.read(contents);
- if ( byteCount != bytesRead ) {
- error("Cannot read all of @file", null);
- ok = false;
- }
- }
- } catch ( IOException e ) {
- error("cannot open " + filename, e);
- ok = false;
- }
- if ( finput != null ) {
- try {
- finput.close();
- } catch ( IOException e ) {
- ok = false;
- error("cannot close " + filename, e);
- }
- }
- if ( ok && contents != null ) {
- String tokens[] = (new String(contents)).split("\\s+");
- if ( tokens.length > 0 ) {
- ok = parseOptions(tokens);
- }
- }
- if ( !ok ) {
- break;
- }
- } else {
- infiles.add(args[i]);
- outfiles.add(args[i]);
- }
- }
- return ok;
- }
-
- private static boolean stripFiles(List<String> infiles, List<String> outfiles) {
- boolean ok = true;
- Iterator<String> inIter = infiles.iterator();
- Iterator<String> outIter = outfiles.iterator();
-
- for (; inIter.hasNext(); ) {
- String infile = inIter.next();
- String outfile = outIter.next();
-
- Properties prop = new Properties();
- InputStream in = null;
- try {
- in = new BufferedInputStream(new FileInputStream(infile));
- prop.load(in);
- } catch ( FileNotFoundException e ) {
- error("Cannot access file " + infile, e);
- ok = false;
- } catch ( IOException e ) {
- error("IO exception processing file " + infile, e);
- ok = false;
- }
- if ( in != null ) {
- try {
- in.close();
- } catch ( IOException e ) {
- error("IO exception closing file " + infile, e);
- ok = false;
- }
- }
- if ( !ok ) {
- break;
- }
-
- OutputStream out = null;
- try {
- out = new FileOutputStream(outfile);
- storeProperties(prop, out);
- out.flush();
- } catch ( IOException e ) {
- error("IO exception processing file " + outfile, e);
- ok = false;
- }
- if ( out != null ) {
- try {
- out.close();
- } catch ( IOException e ) {
- error("IO exception closing file " + outfile, e);
- ok = false;
- }
- }
- if ( !ok ) {
- break;
- }
-
- }
- return ok;
- }
-
- /**
- * Strip the properties filenames supplied, replacing their contents.
- * @param args Names of properties files to process and replace contents
- */
- public static void main(String args[]) {
- boolean ok = parseOptions(args);
- if ( !ok || !stripFiles(infiles, outfiles) ) {
- System.exit(1);
- }
- }
-
- // --- code below here is adapted from java.util.Properties ---
-
- private static final String specialSaveChars = "=: \t\r\n\f#!";
-
- /*
- * Converts unicodes to encoded \uxxxx
- * and writes out any of the characters in specialSaveChars
- * with a preceding slash
- */
- private static String saveConvert(String theString, boolean escapeSpace) {
- int len = theString.length();
- StringBuffer outBuffer = new StringBuffer(len*2);
-
- for(int x=0; x<len; x++) {
- char aChar = theString.charAt(x);
- switch(aChar) {
- case ' ':
- if (x == 0 || escapeSpace) {
- outBuffer.append('\\');
- }
- outBuffer.append(' ');
- break;
- case '\\':
- outBuffer.append('\\');
- outBuffer.append('\\');
- break;
- case '\t':
- outBuffer.append('\\');
- outBuffer.append('t');
- break;
- case '\n':
- outBuffer.append('\\');
- outBuffer.append('n');
- break;
- case '\r':
- outBuffer.append('\\');
- outBuffer.append('r');
- break;
- case '\f':
- outBuffer.append('\\');
- outBuffer.append('f');
- break;
- default:
- if ((aChar < 0x0020) || (aChar == 0x007e) || (aChar > 0x00ff)) {
- outBuffer.append('\\');
- outBuffer.append('u');
- outBuffer.append(toHex((aChar >> 12) & 0xF));
- outBuffer.append(toHex((aChar >> 8) & 0xF));
- outBuffer.append(toHex((aChar >> 4) & 0xF));
- outBuffer.append(toHex( aChar & 0xF));
- } else {
- if (specialSaveChars.indexOf(aChar) != -1) {
- outBuffer.append('\\');
- }
- outBuffer.append(aChar);
- }
- }
- }
- return outBuffer.toString();
- }
-
- /**
- * Writes the content of <code>properties</code> to <code>out</code>.
- * The format is that of Properties.store with the following modifications:
- * <ul>
- * <li>No header or date is written
- * <li>Latin-1 characters are written as single bytes, not escape sequences
- * <li>Line breaks are indicated by a single \n independent of platform
- * <ul>
- */
- private static void storeProperties(Properties properties, OutputStream out)
- throws IOException {
- BufferedWriter awriter;
- awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
- for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) {
- String key = (String)e.nextElement();
- String val = (String)properties.get(key);
- key = saveConvert(key, true);
-
- /* No need to escape embedded and trailing spaces for value, hence
- * pass false to flag.
- */
- val = saveConvert(val, false);
- writeln(awriter, key + "=" + val);
- }
- awriter.flush();
- }
-
- private static void writeln(BufferedWriter bw, String s) throws IOException {
- bw.write(s);
- bw.write("\n");
- }
-
- /**
- * Convert a nibble to a hex character
- * @param nibble the nibble to convert.
- */
- private static char toHex(int nibble) {
- return hexDigit[(nibble & 0xF)];
- }
-
- /** A table of hex digits */
- private static final char[] hexDigit = {
- '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
- };
-}
diff --git a/src/share/classes/com/sun/corba/se/GiopIDL/GIOP.idl b/src/share/classes/com/sun/corba/se/GiopIDL/GIOP.idl
deleted file mode 100644
index 7f2d54f..0000000
--- a/src/share/classes/com/sun/corba/se/GiopIDL/GIOP.idl
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 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.
- */
-
-#include "IOP.idl"
-
-module GIOP { // IDL extended for version 1.1 and 1.2
-
- struct Version {
- octet major;
- octet minor;
- };
-
-
- // GIOP 1.0
-
- struct MessageHeader_1_0 { // Renamed from MessageHeader
- char magic [4];
- Version GIOP_version;
- boolean byte_order;
- octet message_type;
- unsigned long message_size;
- };
-
- // GIOP 1.1
-
- struct MessageHeader_1_1 {
- char magic [4];
- Version GIOP_version;
- octet flags; // GIOP 1.1 change
- octet message_type;
- unsigned long message_size;
- };
-
- // GIOP 1.2
- // Same Header contents for 1.1 and 1.2
- typedef MessageHeader_1_1 MessageHeader_1_2;
-
-
- // GIOP 1.0
- struct RequestHeader_1_0 { // Renamed from RequestHeader
- IOP::ServiceContextList service_context;
- unsigned long request_id;
- boolean response_expected;
- sequence<octet> object_key;
- string operation;
- sequence<octet> requesting_principal;
- };
-
- // GIOP 1.1
- struct RequestHeader_1_1 {
- IOP::ServiceContextList service_context;
- unsigned long request_id;
- boolean response_expected;
- octet reserved[3]; // Added in GIOP 1.1
- sequence <octet> object_key;
- string operation;
- sequence<octet> requesting_principal;
- };
-
- // GIOP 1.2
- typedef short AddressingDisposition;
- const short KeyAddr = 0;
- const short ProfileAddr = 1;
- const short ReferenceAddr = 2;
- struct IORAddressingInfo {
- unsigned long selected_profile_index;
- IOP::IOR ior;
- };
- union TargetAddress switch (AddressingDisposition) {
- case KeyAddr: sequence <octet> object_key;
- case ProfileAddr: IOP::TaggedProfile profile;
- case ReferenceAddr: IORAddressingInfo ior;
- };
- struct RequestHeader_1_2 {
- unsigned long request_id;
- octet response_flags;
- octet reserved[3];
- TargetAddress target;
- string operation;
- IOP::ServiceContextList service_context;
- // Principal not in GIOP 1.2
- };
-
-
- #ifndef GIOP_1_2 //We're supporting all versions
-
- // GIOP 1.0 and 1.1
- enum ReplyStatusType_1_0 { // Renamed from ReplyStatusType
- NO_EXCEPTION,
- USER_EXCEPTION,
- SYSTEM_EXCEPTION,
- LOCATION_FORWARD
- };
-
- // GIOP 1.0
- struct ReplyHeader_1_0 { // Renamed from ReplyHeader
- IOP::ServiceContextList service_context;
- unsigned long request_id;
- ReplyStatusType_1_0 reply_status;
- };
-
- // GIOP 1.1
- // Same Header contents for 1.0 and 1.1
- typedef ReplyHeader_1_0 ReplyHeader_1_1;
-
- #else
-
- // GIOP 1.2
- enum ReplyStatusType_1_2 {
- NO_EXCEPTION,
- USER_EXCEPTION,
- SYSTEM_EXCEPTION,
- LOCATION_FORWARD,
- LOCATION_FORWARD_PERM,// new value for 1.2
- NEEDS_ADDRESSING_MODE // new value for 1.2
- };
-
- struct ReplyHeader_1_2 {
- unsigned long request_id;
- ReplyStatusType_1_2 reply_status;
- IOP::ServiceContextList service_context;
- };
-
- #endif // GIOP_1_2
-
-
- struct SystemExceptionReplyBody {
- string exception_id;
- unsigned long minor_code_value;
- unsigned long completion_status;
- };
-
-
-
- struct CancelRequestHeader {
- unsigned long request_id;
- };
-
-
-
- // GIOP 1.0
- struct LocateRequestHeader_1_0 { // Renamed LocationRequestHeader
- unsigned long request_id;
- sequence <octet> object_key;
- };
-
- // GIOP 1.1
- // Same Header contents for 1.0 and 1.1
- typedef LocateRequestHeader_1_0 LocateRequestHeader_1_1;
-
- // GIOP 1.2
- struct LocateRequestHeader_1_2 {
- unsigned long request_id;
- TargetAddress target;
- };
-
-
- #ifndef GIOP_1_2 // We're supporting all versions
-
- // GIOP 1.0 and 1.1
- enum LocateStatusType_1_0 { // Renamed from LocateStatusType
- UNKNOWN_OBJECT,
- OBJECT_HERE,
- OBJECT_FORWARD
- };
-
-
- // GIOP 1.0
- struct LocateReplyHeader_1_0 { // Renamed from LocateReplyHeader
- unsigned long request_id;
- LocateStatusType_1_0 locate_status;
- };
-
- // GIOP 1.1
- // same Header contents for 1.0 and 1.1
- typedef LocateReplyHeader_1_0 LocateReplyHeader_1_1;
-
- #else
-
- // GIOP 1.2
- enum LocateStatusType_1_2 {
- UNKNOWN_OBJECT,
- OBJECT_HERE,
- OBJECT_FORWARD,
- OBJECT_FORWARD_PERM, // new value for GIOP 1.2
- LOC_SYSTEM_EXCEPTION, // new value for GIOP 1.2
- LOC_NEEDS_ADDRESSING_MODE // new value for GIOP 1.2
- };
-
- struct LocateReplyHeader_1_2 {
- unsigned long request_id;
- LocateStatusType_1_2 locate_status;
- };
-
- #endif // GIOP_1_2
-
-
- // GIOP 1.2
- struct FragmentHeader_1_2 {
- unsigned long request_id;
- };
-};
diff --git a/src/share/classes/com/sun/corba/se/GiopIDL/messages.idl b/src/share/classes/com/sun/corba/se/GiopIDL/messages.idl
deleted file mode 100644
index c9b0ddf..0000000
--- a/src/share/classes/com/sun/corba/se/GiopIDL/messages.idl
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 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.
- */
-
-/*
- * @(#)GIOP.idl 1.0 00/05/21
- *
- */
-
-#include "IOP.idl"
-
-module messages {
-
- typedef short AddressingDisposition;
- const short KeyAddr = 0;
- const short ProfileAddr = 1;
- const short ReferenceAddr = 2;
- struct IORAddressingInfo {
- unsigned long selected_profile_index;
- IOP::IOR ior;
- };
- union TargetAddress switch (AddressingDisposition) {
- case KeyAddr: sequence <octet> object_key;
- case ProfileAddr: IOP::TaggedProfile profile;
- case ReferenceAddr: IORAddressingInfo ior;
- };
-};
diff --git a/src/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl b/src/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl
deleted file mode 100644
index 9ca22d7..0000000
--- a/src/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-#include "Interceptors.idl"
-
-module PortableActivationIDL {
- /** Possible values for endpointType argument on Server.getEndpoint()
- * If you change the value of this constant then update
- * core.EndPoint accordingly. It has a duplicate definition
- * to avoid a compilation dependency.
- */
- const string IIOP_CLEAR_TEXT = "IIOP_CLEAR_TEXT";
-
- /** Raised if getEndpoint is called on a server callback object for
- * an invalid endpoint type
- */
- exception NoSuchEndPoint {} ;
-
- /** Raised if an attempt is made to retrieve ports corresponding to
- * non-registered ORB
- */
- exception InvalidORBid {} ;
-
- /** Raised if an operation is attempted against an invalid server ID.
- */
- exception ServerNotRegistered {
- PortableInterceptor::ServerId serverId ;
- };
-
- /** Raised if an operation is attempted for a server that is not running,
- * and the server is required to be running for the operation.
- */
- exception ServerNotActive {
- PortableInterceptor::ServerId serverId ;
- };
-
- /** Raised if an operation is attempted against a server that is in a
- * hold down state. A server becomes held down if it fails to activate
- * within 10 seconds.
- */
- exception ServerHeldDown {
- PortableInterceptor::ServerId serverId ;
- };
-
- /** Raised if an attempt is made to activate a server that is already
- * running.
- */
- exception ServerAlreadyActive{
- PortableInterceptor::ServerId serverId ;
- };
-
- /** Raised if an attempt is made to register a serverdef with the
- * same applicationName as an existing serverdef.
- */
- exception ServerAlreadyRegistered {
- PortableInterceptor::ServerId serverId;
- };
-
- /** Raised if an attempt is made to install a server that is currently
- * installed. Note that a newly created server starts out in an uninstalled
- * state.
- */
- exception ServerAlreadyInstalled {
- PortableInterceptor::ServerId serverId;
- } ;
-
- /** Raised if an attempt is made to uninstall a server that is currently
- * uninstalled. Note that a newly created server starts out in an
- * uninstalled
- * state.
- */
- exception ServerAlreadyUninstalled {
- PortableInterceptor::ServerId serverId;
- } ;
-
- /** Raised if an attempt is made to register an invalid serverdef.
- */
- exception BadServerDefinition {
- string reason;
- };
-
- /** Raised if an attempt is made to register endpoints for the
- * same ORB again
- */
- exception ORBAlreadyRegistered {
- PortableInterceptor::ORBId orbId;
- };
-
- /** Type of TCP port number, used in structures that describe
- * transport endpoints. The valid range is actually 0-65535, but
- * we use a long here to avoid signed/unsigned conversion headaches
- * in Java.
- */
- typedef long TCPPort ;
-
- /** Sequence of server Ids, used for queries about servers.
- */
- typedef sequence<PortableInterceptor::ServerId> ServerIds;
-
- /** End point information for one particular kind of port associated with an
- * an ORB. This is only used in the
- * Activator interface, which must always run on the same host as the daemon,
- * therefore we do not need the host name here.
- */
- struct EndPointInfo {
- string endpointType;
- TCPPort port;
- };
-
- /** A list of endpoint information for a particular ORB.
- */
- typedef sequence<EndPointInfo> EndpointInfoList;
-
- /** struct contain ORB and port info for a particular type of endpoint.
- * This is only used in the
- * Activator interface, which must always run on the same host as the daemon,
- * therefore we do not need the host name here.
- */
- struct ORBPortInfo {
- PortableInterceptor::ORBId orbId;
- TCPPort port;
- };
-
- /** A list of ORB and port information for a particular endpoint type.
- */
- typedef sequence<ORBPortInfo> ORBPortInfoList;
-
- /** A list of ORB IDs.
- */
- typedef sequence<PortableInterceptor::ORBId> ORBidList;
-
- /** Server callback interface, passed to Activator in registerServer method.
- */
- interface ServerProxy {
- /** Shutdown this server. Returns after orb.shutdown() completes.
- */
- void shutdown();
-
- /** Install the server. Returns after the install hook completes
- * execution in the server.
- */
- void install();
-
- /** Uninstall the server. Returns after the uninstall hook
- * completes execution.
- */
- void uninstall();
- };
-
- /** ORB callback interface, passed to Activator in registerORB method.
- */
- interface ORBProxy {
- /** Method used to cause ORB to activate the named adapter, if possible.
- * This will cause the named POA to register itself with the activator as
- * a side effect. This should always happen before this call can complete.
- * This method returns true if adapter activation succeeded, otherwise it
- * returns false.
- */
- boolean activate_adapter( in PortableInterceptor::AdapterName name ) ;
- } ;
-
- interface Activator {
- /*******************************************************
- * Server State Change Methods
- ********************************************************/
-
- /** A new ORB started server registers itself with the Activator
- */
- void registerServer(in PortableInterceptor::ServerId serverId, in ServerProxy serverObj)
- raises (ServerNotRegistered);
-
- /** A server is shutting down that was started by this activator.
- * Complete termination of the server is detected by the death of the
- * process implementing the server.
- */
- void serverGoingDown( in PortableInterceptor::ServerId serverId ) ;
-
- /** Called whenever an ORB instance is created. This registers
- * the transport endpoints and the ORB proxy callback object.
- * Note that we cannot detect when an ORB shuts down, although
- * all of the POA shutdowns should still be reported.
- */
- void registerORB( in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId,
- in ORBProxy orb, in EndpointInfoList endPointInfo)
- raises (ServerNotRegistered,NoSuchEndPoint, ORBAlreadyRegistered) ;
-
- /** Construct or find an ORBD object template corresponding to the
- * server's object template and return it. Called whenever a
- * persistent POA is created.
- */
- PortableInterceptor::ObjectReferenceTemplate registerPOA(
- in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId,
- in PortableInterceptor::ObjectReferenceTemplate poaTemplate ) ;
-
- /** Called whenever a POA is destroyed.
- */
- void poaDestroyed(
- in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId,
- in PortableInterceptor::ObjectReferenceTemplate poaTemplate ) ;
-
- /*******************************************************
- * Server Control Methods
- ********************************************************/
-
- /** If the server is not running, start it up. This is allowed
- * whether or not the server has been installed.
- */
- void activate(in PortableInterceptor::ServerId serverId)
- raises (ServerAlreadyActive, ServerNotRegistered, ServerHeldDown);
-
- /** If the server is running, shut it down
- */
- void shutdown(in PortableInterceptor::ServerId serverId)
- raises (ServerNotActive, ServerNotRegistered);
-
- /** Invoke the server install hook. If the server is not
- * currently running, this method will activate it.
- */
- void install(in PortableInterceptor::ServerId serverId)
- raises (ServerNotRegistered, ServerHeldDown,
- ServerAlreadyInstalled);
-
- /** Invoke the server uninstall hook. If the server is not
- * currently running, this method will activate it.
- * After this hook completes, the server may still be running.
- */
- void uninstall(in PortableInterceptor::ServerId serverId)
- raises (ServerNotRegistered, ServerHeldDown,
- ServerAlreadyUninstalled);
-
- /*******************************************************
- * Accessors
- ********************************************************/
-
- /** list active servers
- */
- ServerIds getActiveServers();
-
- /** list all registered ORBs for a server
- */
- ORBidList getORBNames(in PortableInterceptor::ServerId serverId)
- raises (ServerNotRegistered);
-
- /** Find the server template that corresponds to the ORBD's
- * adapter id.
- */
- PortableInterceptor::ObjectReferenceTemplate lookupPOATemplate(
- in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId,
- in PortableInterceptor::AdapterName orbAdapterName ) ;
- };
-
- interface Locator {
- /** struct to return the list of endpoints for a server for a specific
- * endpoint type.
- */
- struct ServerLocationPerType {
- string hostname;
- ORBPortInfoList ports;
- };
-
- /** struct to return the list of endpoints for a server for a specific
- * ORB
- */
- struct ServerLocationPerORB {
- string hostname;
- EndpointInfoList ports;
- };
-
- /** locate server - returns the port with a specific type for all registered
- * ORBs of an active server.
- * Starts the server if it is not already running.
- */
- ServerLocationPerType locateServer(
- in PortableInterceptor::ServerId serverId,
- in string endPoint)
- raises(NoSuchEndPoint, ServerNotRegistered, ServerHeldDown);
-
- /** locate server - returns all ports registered with a specified ORB for
- * an active server
- * Starts the server if it is not already running.
- */
- ServerLocationPerORB locateServerForORB(
- in PortableInterceptor::ServerId serverId,
- in PortableInterceptor::ORBId orbId)
- raises(InvalidORBid, ServerNotRegistered, ServerHeldDown);
-
- /** get the port for the endpoint of the locator
- */
- TCPPort getEndpoint(in string endPointType)
- raises(NoSuchEndPoint);
-
- /** Useful from external BadServerIdHandlers which need
- * to pick a particular port type.
- */
- TCPPort getServerPortForType(
- in ServerLocationPerORB location,
- in string endPointType)
- raises(NoSuchEndPoint);
- };
-
- /** Interface used to combine the Activator and Locator when both are
- * implemented together in the same process, as is currently the case
- * for our implementation.
- */
- interface ServerManager : Activator, Locator { };
-
- /** Interface used to support binding references in the bootstrap name
- * service.
- */
- interface InitialNameService {
- exception NameAlreadyBound {};
-
- /** bind initial name
- */
- void bind (
- in string name,
- in Object obj,
- in boolean isPersistant) raises (NameAlreadyBound);
- };
-
- interface Repository {
- /** server program definition.
- */
- struct ServerDef {
- string applicationName; // alias used for servers with identical
- // serverName values.
- string serverName; // Class name of server's main class.
- string serverClassPath; // class path used to run the server.
- string serverArgs; // arguments passed to the server
- string serverVmArgs; // arguments passed to the server's Java VM1
- boolean isInstalled; // Whether or not the server has been installed
- };
-
- /** register server definition.
- * This returns the serverId of the server. A newly created server is
- * always uninstalled.
- */
- PortableInterceptor::ServerId registerServer (in ServerDef serverDef)
- raises (ServerAlreadyRegistered, BadServerDefinition);
-
- /** unregister server definition
- */
- void unregisterServer (in PortableInterceptor::ServerId serverId)
- raises (ServerNotRegistered);
-
- /** get server definition
- */
- ServerDef getServer(in PortableInterceptor::ServerId serverId)
- raises (ServerNotRegistered);
-
- /** Return whether the server has been installed
- */
- boolean isInstalled( in PortableInterceptor::ServerId serverId )
- raises (ServerNotRegistered);
-
- /** Mark the server as being installed. Raises ServerAlreadyInstalled
- * if the server is currently marked as installed.
- */
- void install( in PortableInterceptor::ServerId serverId )
- raises (ServerNotRegistered, ServerAlreadyInstalled) ;
-
- /** Mark the server as being uninstalled. Raises ServerAlreadyUninstalled
- * if the server is currently marked as uninstalled.
- */
- void uninstall( in PortableInterceptor::ServerId serverId )
- raises (ServerNotRegistered, ServerAlreadyUninstalled) ;
-
- /** list registered servers
- */
- ServerIds listRegisteredServers ();
-
- /** Type used for a list of application names
- */
- typedef sequence<string> AppNames ;
-
- /** Returns list of ALL applicationNames defined in ServerDefs of registered
- * servers.
- */
- AppNames getApplicationNames();
-
- /** Find the ServerID associated with the given application name.
- */
- PortableInterceptor::ServerId getServerID( in string applicationName )
- raises (ServerNotRegistered) ;
- };
-};
diff --git a/src/share/classes/com/sun/corba/se/impl/activation/CommandHandler.java b/src/share/classes/com/sun/corba/se/impl/activation/CommandHandler.java
deleted file mode 100644
index d307a0f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/activation/CommandHandler.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 1997, 2002, 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.
- */
-package com.sun.corba.se.impl.activation;
-
-import org.omg.CORBA.ORB;
-
-import java.io.PrintStream;
-
-/**
- * @author Rohit Garg
- * @since JDK1.2
- */
-
-public interface CommandHandler
-{
- String getCommandName();
-
- public final static boolean shortHelp = true;
- public final static boolean longHelp = false;
-
- void printCommandHelp(PrintStream out, boolean helpType);
-
- public final static boolean parseError = true;
- public final static boolean commandDone = false;
-
- boolean processCommand(String[] cmd, ORB orb, PrintStream out);
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/activation/NameServiceStartThread.java b/src/share/classes/com/sun/corba/se/impl/activation/NameServiceStartThread.java
deleted file mode 100644
index d4d2cf4..0000000
--- a/src/share/classes/com/sun/corba/se/impl/activation/NameServiceStartThread.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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.
- */
-
-package com.sun.corba.se.impl.activation;
-
-
-import java.io.File;
-
-import org.omg.CosNaming.NamingContext;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.naming.pcosnaming.NameService;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-// REVISIT: After Merlin to see if we can get rid of this Thread and
-// make the registration of PNameService for INS and BootStrap neat.
-public class NameServiceStartThread extends java.lang.Thread
-{
- private ORB orb;
- private File dbDir;
-
- public NameServiceStartThread( ORB theOrb, File theDir )
- {
- orb = theOrb;
- dbDir = theDir;
- }
-
- public void run( )
- {
- try {
- // start Name Service
- NameService nameService = new NameService(orb, dbDir );
- NamingContext rootContext = nameService.initialNamingContext();
- orb.register_initial_reference(
- ORBConstants.PERSISTENT_NAME_SERVICE_NAME, rootContext );
- } catch( Exception e ) {
- System.err.println(
- "NameService did not start successfully" );
- e.printStackTrace( );
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/activation/ORBD.java b/src/share/classes/com/sun/corba/se/impl/activation/ORBD.java
deleted file mode 100644
index bb08fd7..0000000
--- a/src/share/classes/com/sun/corba/se/impl/activation/ORBD.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- *
- * Copyright (c) 1997, 2004, 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.
- *
- */
-
-package com.sun.corba.se.impl.activation;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.omg.CORBA.INITIALIZE;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CosNaming.NamingContext;
-import org.omg.PortableServer.POA;
-
-import com.sun.corba.se.pept.transport.Acceptor;
-
-import com.sun.corba.se.spi.activation.Repository;
-import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef;
-import com.sun.corba.se.spi.activation.Locator;
-import com.sun.corba.se.spi.activation.LocatorHelper;
-import com.sun.corba.se.spi.activation.Activator;
-import com.sun.corba.se.spi.activation.ActivatorHelper;
-import com.sun.corba.se.spi.activation.ServerAlreadyRegistered;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
-import com.sun.corba.se.spi.transport.SocketInfo;
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl;
-import com.sun.corba.se.impl.naming.cosnaming.TransientNameService;
-import com.sun.corba.se.impl.naming.pcosnaming.NameService;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.CorbaResourceUtil;
-import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
-
-/**
- *
- * @author Rohit Garg
- * @since JDK1.2
- */
-public class ORBD
-{
- private int initSvcPort;
-
- protected void initializeBootNaming(ORB orb)
- {
- // create a bootstrap server
- initSvcPort = orb.getORBData().getORBInitialPort();
-
- Acceptor acceptor;
- // REVISIT: see ORBConfigurator. use factory in TransportDefault.
- if (orb.getORBData().getLegacySocketFactory() == null) {
- acceptor =
- new SocketOrChannelAcceptorImpl(
- orb,
- initSvcPort,
- LegacyServerSocketEndPointInfo.BOOT_NAMING,
- SocketInfo.IIOP_CLEAR_TEXT);
- } else {
- acceptor =
- new SocketFactoryAcceptorImpl(
- orb,
- initSvcPort,
- LegacyServerSocketEndPointInfo.BOOT_NAMING,
- SocketInfo.IIOP_CLEAR_TEXT);
- }
- orb.getCorbaTransportManager().registerAcceptor(acceptor);
- }
-
- protected ORB createORB(String[] args)
- {
- Properties props = System.getProperties();
-
- // For debugging.
- //props.put( ORBConstants.DEBUG_PROPERTY, "naming" ) ;
- //props.put( ORBConstants.DEBUG_PROPERTY, "transport,giop,naming" ) ;
-
- props.put( ORBConstants.SERVER_ID_PROPERTY, "1000" ) ;
- props.put( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
- props.getProperty( ORBConstants.ORBD_PORT_PROPERTY,
- Integer.toString(
- ORBConstants.DEFAULT_ACTIVATION_PORT ) ) ) ;
-
- // See Bug 4396928 for more information about why we are initializing
- // the ORBClass to PIORB (now ORBImpl, but should check the bugid).
- props.put("org.omg.CORBA.ORBClass",
- "com.sun.corba.se.impl.orb.ORBImpl");
-
- return (ORB) ORB.init(args, props);
- }
-
- private void run(String[] args)
- {
- try {
- // parse the args and try setting the values for these
- // properties
- processArgs(args);
-
- ORB orb = createORB(args);
-
- if (orb.orbdDebugFlag)
- System.out.println( "ORBD begins initialization." ) ;
-
- boolean firstRun = createSystemDirs( ORBConstants.DEFAULT_DB_DIR );
-
- startActivationObjects(orb);
-
- if (firstRun) // orbd is being run the first time
- installOrbServers(getRepository(), getActivator());
-
- if (orb.orbdDebugFlag) {
- System.out.println( "ORBD is ready." ) ;
- System.out.println("ORBD serverid: " +
- System.getProperty(ORBConstants.SERVER_ID_PROPERTY));
- System.out.println("activation dbdir: " +
- System.getProperty(ORBConstants.DB_DIR_PROPERTY));
- System.out.println("activation port: " +
- System.getProperty(ORBConstants.ORBD_PORT_PROPERTY));
-
- String pollingTime = System.getProperty(
- ORBConstants.SERVER_POLLING_TIME);
- if( pollingTime == null ) {
- pollingTime = Integer.toString(
- ORBConstants.DEFAULT_SERVER_POLLING_TIME );
- }
- System.out.println("activation Server Polling Time: " +
- pollingTime + " milli-seconds ");
-
- String startupDelay = System.getProperty(
- ORBConstants.SERVER_STARTUP_DELAY);
- if( startupDelay == null ) {
- startupDelay = Integer.toString(
- ORBConstants.DEFAULT_SERVER_STARTUP_DELAY );
- }
- System.out.println("activation Server Startup Delay: " +
- startupDelay + " milli-seconds " );
- }
-
- // The following two lines start the Persistent NameService
- NameServiceStartThread theThread =
- new NameServiceStartThread( orb, dbDir );
- theThread.start( );
-
- orb.run();
- } catch( org.omg.CORBA.COMM_FAILURE cex ) {
- System.out.println( CorbaResourceUtil.getText("orbd.commfailure"));
- System.out.println( cex );
- cex.printStackTrace();
- } catch( org.omg.CORBA.INTERNAL iex ) {
- System.out.println( CorbaResourceUtil.getText(
- "orbd.internalexception"));
- System.out.println( iex );
- iex.printStackTrace();
- } catch (Exception ex) {
- System.out.println(CorbaResourceUtil.getText(
- "orbd.usage", "orbd"));
- System.out.println( ex );
- ex.printStackTrace();
- }
- }
-
- private void processArgs(String[] args)
- {
- Properties props = System.getProperties();
- for (int i=0; i < args.length; i++) {
- if (args[i].equals("-port")) {
- if ((i+1) < args.length) {
- props.put(ORBConstants.ORBD_PORT_PROPERTY, args[++i]);
- } else {
- System.out.println(CorbaResourceUtil.getText(
- "orbd.usage", "orbd"));
- }
- } else if (args[i].equals("-defaultdb")) {
- if ((i+1) < args.length) {
- props.put(ORBConstants.DB_DIR_PROPERTY, args[++i]);
- } else {
- System.out.println(CorbaResourceUtil.getText(
- "orbd.usage", "orbd"));
- }
- } else if (args[i].equals("-serverid")) {
- if ((i+1) < args.length) {
- props.put(ORBConstants.SERVER_ID_PROPERTY, args[++i]);
- } else {
- System.out.println(CorbaResourceUtil.getText(
- "orbd.usage", "orbd"));
- }
- } else if (args[i].equals("-serverPollingTime")) {
- if ((i+1) < args.length) {
- props.put(ORBConstants.SERVER_POLLING_TIME, args[++i]);
- } else {
- System.out.println(CorbaResourceUtil.getText(
- "orbd.usage", "orbd"));
- }
- } else if (args[i].equals("-serverStartupDelay")) {
- if ((i+1) < args.length) {
- props.put(ORBConstants.SERVER_STARTUP_DELAY, args[++i]);
- } else {
- System.out.println(CorbaResourceUtil.getText(
- "orbd.usage", "orbd"));
- }
- }
- }
- }
-
- /**
- * Ensure that the Db directory exists. If not, create the Db
- * and the log directory and return true. Otherwise return false.
- */
- protected boolean createSystemDirs(String defaultDbDir)
- {
- boolean dirCreated = false;
- Properties props = System.getProperties();
- String fileSep = props.getProperty("file.separator");
-
- // determine the ORB db directory
- dbDir = new File (props.getProperty( ORBConstants.DB_DIR_PROPERTY,
- props.getProperty("user.dir") + fileSep + defaultDbDir));
-
- // create the db and the logs directories
- dbDirName = dbDir.getAbsolutePath();
- props.put(ORBConstants.DB_DIR_PROPERTY, dbDirName);
- if (!dbDir.exists()) {
- dbDir.mkdir();
- dirCreated = true;
- }
-
- File logDir = new File (dbDir, ORBConstants.SERVER_LOG_DIR ) ;
- if (!logDir.exists()) logDir.mkdir();
-
- return dirCreated;
- }
-
- protected File dbDir;
- protected File getDbDir()
- {
- return dbDir;
- }
-
- private String dbDirName;
- protected String getDbDirName()
- {
- return dbDirName;
- }
-
- protected void startActivationObjects(ORB orb) throws Exception
- {
- // create Initial Name Service object
- initializeBootNaming(orb);
-
- // create Repository object
- repository = new RepositoryImpl(orb, dbDir, orb.orbdDebugFlag );
- orb.register_initial_reference( ORBConstants.SERVER_REPOSITORY_NAME, repository );
-
- // create Locator and Activator objects
- ServerManagerImpl serverMgr =
- new ServerManagerImpl( orb,
- orb.getCorbaTransportManager(),
- repository,
- getDbDirName(),
- orb.orbdDebugFlag );
-
- locator = LocatorHelper.narrow(serverMgr);
- orb.register_initial_reference( ORBConstants.SERVER_LOCATOR_NAME, locator );
-
- activator = ActivatorHelper.narrow(serverMgr);
- orb.register_initial_reference( ORBConstants.SERVER_ACTIVATOR_NAME, activator );
-
- // start Name Service
- TransientNameService nameService = new TransientNameService(orb,
- ORBConstants.TRANSIENT_NAME_SERVICE_NAME);
- }
-
- protected Locator locator;
- protected Locator getLocator()
- {
- return locator;
- }
-
- protected Activator activator;
- protected Activator getActivator()
- {
- return activator;
- }
-
- protected RepositoryImpl repository;
- protected RepositoryImpl getRepository()
- {
- return repository;
- }
-
- /**
- * Go through the list of ORB Servers and initialize and start
- * them up.
- */
- protected void installOrbServers(RepositoryImpl repository,
- Activator activator)
- {
- int serverId;
- String[] server;
- ServerDef serverDef;
-
- for (int i=0; i < orbServers.length; i++) {
- try {
- server = orbServers[i];
- serverDef = new ServerDef(server[1], server[2],
- server[3], server[4], server[5] );
-
- serverId = Integer.valueOf(orbServers[i][0]).intValue();
-
- repository.registerServer(serverDef, serverId);
-
- activator.activate(serverId);
-
- } catch (Exception ex) {}
- }
- }
-
- public static void main(String[] args) {
- ORBD orbd = new ORBD();
- orbd.run(args);
- }
-
- /**
- * List of servers to be auto registered and started by the ORBd.
- *
- * Each server entry is of the form {id, name, path, args, vmargs}.
- */
- private static String[][] orbServers = {
- {""}
- };
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/activation/ProcessMonitorThread.java b/src/share/classes/com/sun/corba/se/impl/activation/ProcessMonitorThread.java
deleted file mode 100644
index c7caaba..0000000
--- a/src/share/classes/com/sun/corba/se/impl/activation/ProcessMonitorThread.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, 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.
- */
-
-package com.sun.corba.se.impl.activation;
-
-import java.util.*;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-/** ProcessMonitorThread is started when ServerManager is instantiated. The
- * thread wakes up every minute (This can be changed by setting sleepTime) and
- * makes sure that all the processes (Servers) registered with the ServerTool
- * are healthy. If not the state in ServerTableEntry will be changed to
- * De-Activated.
- * Note: This thread can be killed from the main thread by calling
- * interrupThread()
- */
-public class ProcessMonitorThread extends java.lang.Thread {
- private HashMap serverTable;
- private int sleepTime;
- private static ProcessMonitorThread instance = null;
-
- private ProcessMonitorThread( HashMap ServerTable, int SleepTime ) {
- serverTable = ServerTable;
- sleepTime = SleepTime;
- }
-
- public void run( ) {
- while( true ) {
- try {
- // Sleep's for a specified time, before checking
- // the Servers health. This will repeat as long as
- // the ServerManager (ORBD) is up and running.
- Thread.sleep( sleepTime );
- } catch( java.lang.InterruptedException e ) {
- break;
- }
- Iterator serverList;
- synchronized ( serverTable ) {
- // Check each ServerTableEntry to make sure that they
- // are in the right state.
- serverList = serverTable.values().iterator();
- }
- try {
- checkServerHealth( serverList );
- } catch( ConcurrentModificationException e ) {
- break;
- }
- }
- }
-
- private void checkServerHealth( Iterator serverList ) {
- if( serverList == null ) return;
- while (serverList.hasNext( ) ) {
- ServerTableEntry entry = (ServerTableEntry) serverList.next();
- entry.checkProcessHealth( );
- }
- }
-
- static void start( HashMap serverTable ) {
- int sleepTime = ORBConstants.DEFAULT_SERVER_POLLING_TIME;
-
- String pollingTime = System.getProperties().getProperty(
- ORBConstants.SERVER_POLLING_TIME );
-
- if ( pollingTime != null ) {
- try {
- sleepTime = Integer.parseInt( pollingTime );
- } catch (Exception e ) {
- // Too late to complain, Just use the default
- // sleepTime
- }
- }
-
- instance = new ProcessMonitorThread( serverTable,
- sleepTime );
- instance.setDaemon( true );
- instance.start();
- }
-
- static void interruptThread( ) {
- instance.interrupt();
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/activation/RepositoryImpl.java b/src/share/classes/com/sun/corba/se/impl/activation/RepositoryImpl.java
deleted file mode 100644
index 768ae16..0000000
--- a/src/share/classes/com/sun/corba/se/impl/activation/RepositoryImpl.java
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- * Copyright (c) 1997, 2004, 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.
- */
-
-package com.sun.corba.se.impl.activation;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Properties;
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INITIALIZE;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.SystemException;
-
-import com.sun.corba.se.spi.activation.BadServerDefinition;
-import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef;
-import com.sun.corba.se.spi.activation._RepositoryImplBase;
-import com.sun.corba.se.spi.activation.ServerAlreadyRegistered;
-import com.sun.corba.se.spi.activation.ServerAlreadyInstalled;
-import com.sun.corba.se.spi.activation.ServerAlreadyUninstalled;
-import com.sun.corba.se.spi.activation.ServerNotRegistered;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
-import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.ActivationSystemException;
-
-/**
- *
- * @author Rohit Garg
- * @since JDK1.2
- */
-public class RepositoryImpl extends _RepositoryImplBase
- implements Serializable
-{
-
- // added serialver computed by the tool
- private static final long serialVersionUID = 8458417785209341858L;
-
- RepositoryImpl(ORB orb, File dbDir, boolean debug)
- {
- this.debug = debug ;
- this.orb = orb;
- wrapper = ActivationSystemException.get( orb, CORBALogDomains.ORBD_REPOSITORY ) ;
-
- // if databse does not exist, create it otherwise read it in
- File dbFile = new File(dbDir, "servers.db");
- if (!dbFile.exists()) {
- db = new RepositoryDB(dbFile);
- db.flush();
- } else {
- try {
- FileInputStream fis = new FileInputStream(dbFile);
- ObjectInputStream ois = new ObjectInputStream(fis);
- db = (RepositoryDB) ois.readObject();
- ois.close();
- } catch (Exception e) {
- throw wrapper.cannotReadRepositoryDb( e ) ;
- }
- }
-
- // export the repository
- orb.connect(this);
- }
-
- private String printServerDef( ServerDef sd )
- {
- return "ServerDef[applicationName=" + sd.applicationName +
- " serverName=" + sd.serverName +
- " serverClassPath=" + sd.serverClassPath +
- " serverArgs=" + sd. serverArgs +
- " serverVmArgs=" + sd.serverVmArgs +
- "]" ;
- }
-
- public int registerServer(ServerDef serverDef, int theServerId)
- throws ServerAlreadyRegistered
- {
- int serverId;
- DBServerDef server = null;
-
- synchronized (db) {
-
- // check if server already registered
- Enumeration enumeration = db.serverTable.elements();
- while (enumeration.hasMoreElements()) {
- server = (DBServerDef) enumeration.nextElement();
- if (serverDef.applicationName.equals(server.applicationName)) {
- if (debug)
- System.out.println(
- "RepositoryImpl: registerServer called " +
- "to register ServerDef " +
- printServerDef( serverDef ) +
- " with " + ((theServerId==illegalServerId) ?
- "a new server Id" : ("server Id " + theServerId)) +
- " FAILED because it is already registered." ) ;
-
- throw (new ServerAlreadyRegistered(server.id));
- }
- }
-
- // generate a new server id
- if (theServerId == illegalServerId)
- serverId = db.incrementServerIdCounter();
- else
- serverId = theServerId;
-
- // add server def to the database
- server = new DBServerDef(serverDef, serverId);
- db.serverTable.put(new Integer(serverId), server);
- db.flush();
-
- if (debug)
- if (theServerId==illegalServerId)
- System.out.println( "RepositoryImpl: registerServer called " +
- "to register ServerDef " + printServerDef( serverDef ) +
- " with new serverId " + serverId ) ;
- else
- System.out.println( "RepositoryImpl: registerServer called " +
- "to register ServerDef " + printServerDef( serverDef ) +
- " with assigned serverId " + serverId ) ;
-
- return serverId;
- }
- }
-
- public int registerServer(ServerDef serverDef)
- throws ServerAlreadyRegistered, BadServerDefinition
- {
- // verify that the entry is valid
- LegacyServerSocketEndPointInfo endpoint =
- orb.getLegacyServerSocketManager()
- .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
- int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
- .getServerSocket().getLocalPort();
- ServerTableEntry entry = new ServerTableEntry( wrapper,
- illegalServerId, serverDef, (int) initSvcPort, "", true, debug );
-
- switch (entry.verify()) {
- case ServerMain.OK:
- break;
- case ServerMain.MAIN_CLASS_NOT_FOUND:
- throw new BadServerDefinition("main class not found.");
- case ServerMain.NO_MAIN_METHOD:
- throw new BadServerDefinition("no main method found.");
- case ServerMain.APPLICATION_ERROR:
- throw new BadServerDefinition("server application error.");
- default:
- throw new BadServerDefinition("unknown Exception.");
- }
-
- return registerServer(serverDef, illegalServerId);
- }
-
- public void unregisterServer(int serverId) throws ServerNotRegistered {
-
- DBServerDef server = null;
- Integer id = new Integer(serverId);
-
- synchronized (db) {
-
- // check to see if the server is registered
- server = (DBServerDef) db.serverTable.get(id);
- if (server == null) {
- if (debug)
- System.out.println(
- "RepositoryImpl: unregisterServer for serverId " +
- serverId + " called: server not registered" ) ;
-
- throw (new ServerNotRegistered());
- }
-
- // remove server from the database
- db.serverTable.remove(id);
- db.flush();
- }
-
- if (debug)
- System.out.println(
- "RepositoryImpl: unregisterServer for serverId " + serverId +
- " called" ) ;
- }
-
- private DBServerDef getDBServerDef(int serverId) throws ServerNotRegistered
- {
- Integer id = new Integer(serverId);
- DBServerDef server = (DBServerDef) db.serverTable.get(id);
-
- if (server == null)
- throw new ServerNotRegistered( serverId );
-
- return server ;
- }
-
- public ServerDef getServer(int serverId) throws ServerNotRegistered
- {
- DBServerDef server = getDBServerDef( serverId ) ;
-
- ServerDef serverDef = new ServerDef(server.applicationName, server.name,
- server.classPath, server.args, server.vmArgs);
-
- if (debug)
- System.out.println(
- "RepositoryImpl: getServer for serverId " + serverId +
- " returns " + printServerDef( serverDef ) ) ;
-
- return serverDef;
- }
-
- public boolean isInstalled(int serverId) throws ServerNotRegistered {
- DBServerDef server = getDBServerDef( serverId ) ;
- return server.isInstalled ;
- }
-
- public void install( int serverId )
- throws ServerNotRegistered, ServerAlreadyInstalled
- {
- DBServerDef server = getDBServerDef( serverId ) ;
-
- if (server.isInstalled)
- throw new ServerAlreadyInstalled( serverId ) ;
- else {
- server.isInstalled = true ;
- db.flush() ;
- }
- }
-
- public void uninstall( int serverId )
- throws ServerNotRegistered, ServerAlreadyUninstalled
- {
- DBServerDef server = getDBServerDef( serverId ) ;
-
- if (!server.isInstalled)
- throw new ServerAlreadyUninstalled( serverId ) ;
- else {
- server.isInstalled = false ;
- db.flush() ;
- }
- }
-
- public int[] listRegisteredServers() {
- synchronized (db) {
- int i=0;
-
- int servers[] = new int[db.serverTable.size()];
-
- Enumeration enumeration = db.serverTable.elements();
-
- while (enumeration.hasMoreElements()) {
- DBServerDef server = (DBServerDef) enumeration.nextElement();
- servers[i++] = server.id;
- }
-
- if (debug) {
- StringBuffer sb = new StringBuffer() ;
- for (int ctr=0; ctr<servers.length; ctr++) {
- sb.append( ' ' ) ;
- sb.append( servers[ctr] ) ;
- }
-
- System.out.println(
- "RepositoryImpl: listRegisteredServers returns" +
- sb.toString() ) ;
- }
-
- return servers;
- }
- }
-
- public int getServerID(String applicationName) throws ServerNotRegistered {
- synchronized (db) {
- int result = -1 ;
-
- for (Enumeration serverIds = db.serverTable.keys();
- serverIds.hasMoreElements();)
- {
- Integer nextServerId = (Integer) serverIds.nextElement();
- DBServerDef dbServerDef =
- (DBServerDef) db.serverTable.get(nextServerId);
-
- if (dbServerDef.applicationName.equals(applicationName)) {
- result = nextServerId.intValue();
- break ;
- }
- }
-
- if (debug)
- System.out.println("RepositoryImpl: getServerID for " +
- applicationName + " is " + result ) ;
-
- if (result == -1) {
- throw (new ServerNotRegistered());
- } else {
- return result ;
- }
- }
- }
-
- public String[] getApplicationNames() {
- synchronized (db) {
- Vector v = new Vector();
- for (Enumeration serverIds = db.serverTable.keys();
- serverIds.hasMoreElements();)
- {
- Integer nextServerId = (Integer) serverIds.nextElement();
-
- DBServerDef dbServerDef = (DBServerDef)db.serverTable.get(
- nextServerId);
-
- if (!dbServerDef.applicationName.equals(""))
- v.addElement( dbServerDef.applicationName ) ;
- }
-
- String[] apps = new String[v.size()];
- for (int i = 0; i < v.size(); i++) {
- apps[i] = (String)v.elementAt(i);
- }
-
- if (debug) {
- StringBuffer sb = new StringBuffer() ;
- for (int ctr=0; ctr<apps.length; ctr++) {
- sb.append( ' ' ) ;
- sb.append( apps[ctr] ) ;
- }
-
- System.out.println( "RepositoryImpl: getApplicationNames returns " +
- sb.toString() ) ;
- }
-
- return apps;
- }
- }
- /**
- * Typically the Repositoy is created within the ORBd VM but it can
- * be independently started as well.
- */
- public static void main(String args[]) {
- boolean debug = false ;
- for (int ctr=0; ctr<args.length; ctr++)
- if (args[ctr].equals("-debug"))
- debug = true ;
-
- try {
- // See Bug 4396928 for more information about why we are
- // initializing the ORBClass to PIORB (now ORBImpl, but see the bug).
- Properties props = new Properties();
- props.put("org.omg.CORBA.ORBClass",
- "com.sun.corba.se.impl.orb.ORBImpl");
- ORB orb = (ORB) ORB.init(args, props);
-
- // create the repository object
- String db = System.getProperty( ORBConstants.DB_PROPERTY,
- ORBConstants.DEFAULT_DB_NAME );
- RepositoryImpl repository = new RepositoryImpl(orb, new File(db),
- debug);
-
- // wait for shutdown
- orb.run();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- transient private boolean debug = false;
-
- final static int illegalServerId = -1;
-
- transient private RepositoryDB db = null;
-
- transient ORB orb = null;
-
- transient ActivationSystemException wrapper ;
-
- class RepositoryDB implements Serializable
- {
- File db;
- Hashtable serverTable;
- Integer serverIdCounter;
-
- RepositoryDB(File dbFile) {
-
- db = dbFile;
-
- // initialize the Server Id counter and hashtable.
- // the lower id range is reserved for system servers
- serverTable = new Hashtable(255);
- serverIdCounter = new Integer(256);
- }
-
- int incrementServerIdCounter()
- {
- int value = serverIdCounter.intValue();
- serverIdCounter = new Integer(++value);
-
- return value;
- }
-
- void flush()
- {
- try {
- db.delete();
- FileOutputStream fos = new FileOutputStream(db);
- ObjectOutputStream oos = new ObjectOutputStream(fos);
- oos.writeObject(this);
- oos.flush();
- oos.close();
- } catch (Exception ex) {
- throw wrapper.cannotWriteRepositoryDb( ex ) ;
- }
- }
- }
-
- class DBServerDef implements Serializable
- {
- public String toString() {
- return "DBServerDef(applicationName=" + applicationName +
- ", name=" + name +
- ", classPath=" + classPath +
- ", args=" + args +
- ", vmArgs=" + vmArgs +
- ", id=" + id +
- ", isInstalled=" + isInstalled + ")" ;
- }
-
- DBServerDef(ServerDef server, int server_id) {
- applicationName = server.applicationName ;
- name = server.serverName;
- classPath = server.serverClassPath;
- args = server.serverArgs;
- vmArgs = server.serverVmArgs;
- id = server_id;
- isInstalled = false ;
- }
-
- String applicationName;
- String name;
- String classPath;
- String args;
- String vmArgs;
- boolean isInstalled ;
- int id;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/activation/ServerMain.java b/src/share/classes/com/sun/corba/se/impl/activation/ServerMain.java
deleted file mode 100644
index cd6d534..0000000
--- a/src/share/classes/com/sun/corba/se/impl/activation/ServerMain.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.corba.se.impl.activation;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.io.*;
-import java.util.Date;
-import java.util.Properties ;
-
-import org.omg.CORBA.ORB ;
-import com.sun.corba.se.spi.activation.Activator ;
-import com.sun.corba.se.spi.activation.ActivatorHelper ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-/**
- * @author Ken Cavanaugh
- * @since JDK1.2
- */
-public class ServerMain
-{
- /* TODO:
- * 1. Rewrite all uses of ORB properties to use constants from someplace.
- * The strings are scattered between here, the ORB classes, and
- * ServerTableEntry.
- * 2. Consider a more general log facility.
- * 3. Remove ServerCallback from POAORB.
- * 4. Needs to be merged with Harold's changes to support SSL.
- * 5. Logs need to be internationalized.
- */
-
- public final static int OK = 0;
- public final static int MAIN_CLASS_NOT_FOUND = 1;
- public final static int NO_MAIN_METHOD = 2;
- public final static int APPLICATION_ERROR = 3;
- public final static int UNKNOWN_ERROR = 4;
- public final static int NO_SERVER_ID = 5 ;
- public final static int REGISTRATION_FAILED = 6;
-
- public static String printResult( int result )
- {
- switch (result) {
- case OK : return "Server terminated normally" ;
- case MAIN_CLASS_NOT_FOUND : return "main class not found" ;
- case NO_MAIN_METHOD : return "no main method" ;
- case APPLICATION_ERROR : return "application error" ;
- case NO_SERVER_ID : return "server ID not defined" ;
- case REGISTRATION_FAILED: return "server registration failed" ;
- default : return "unknown error" ;
- }
- }
-
- private void redirectIOStreams()
- {
- // redirect out and err streams
- try {
- String logDirName =
- System.getProperty( ORBConstants.DB_DIR_PROPERTY ) +
- System.getProperty("file.separator") +
- ORBConstants.SERVER_LOG_DIR +
- System.getProperty("file.separator");
-
- File logDir = new File(logDirName);
- String server = System.getProperty(
- ORBConstants.SERVER_ID_PROPERTY ) ;
-
- FileOutputStream foutStream =
- new FileOutputStream(logDirName + server+".out", true);
- FileOutputStream ferrStream =
- new FileOutputStream(logDirName + server+".err", true);
-
- PrintStream pSout = new PrintStream(foutStream, true);
- PrintStream pSerr = new PrintStream(ferrStream, true);
-
- System.setOut(pSout);
- System.setErr(pSerr);
-
- logInformation( "Server started" ) ;
-
- } catch (Exception ex) {}
- }
-
- /** Write a time-stamped message to the indicated PrintStream.
- */
- private static void writeLogMessage( PrintStream pstream, String msg )
- {
- Date date = new Date();
- pstream.print( "[" + date.toString() + "] " + msg + "\n");
- }
-
- /** Write information to standard out only.
- */
- public static void logInformation( String msg )
- {
- writeLogMessage( System.out, " " + msg ) ;
- }
-
- /** Write error message to standard out and standard err.
- */
- public static void logError( String msg )
- {
- writeLogMessage( System.out, "ERROR: " + msg ) ;
- writeLogMessage( System.err, "ERROR: " + msg ) ;
- }
-
- /** Write final message to log(s) and then terminate by calling
- * System.exit( code ). If code == OK, write a normal termination
- * message to standard out, otherwise write an abnormal termination
- * message to standard out and standard error.
- */
- public static void logTerminal( String msg, int code )
- {
- if (code == 0) {
- writeLogMessage( System.out, " " + msg ) ;
- } else {
- writeLogMessage( System.out, "FATAL: " +
- printResult( code ) + ": " + msg ) ;
-
- writeLogMessage( System.err, "FATAL: " +
- printResult( code ) + ": " + msg ) ;
- }
-
- System.exit( code ) ;
- }
-
- private Method getMainMethod( Class serverClass )
- {
- Class argTypes[] = new Class[] { String[].class } ;
- Method method = null ;
-
- try {
- method = serverClass.getDeclaredMethod( "main", argTypes ) ;
- } catch (Exception exc) {
- logTerminal( exc.getMessage(), NO_MAIN_METHOD ) ;
- }
-
- if (!isPublicStaticVoid( method ))
- logTerminal( "", NO_MAIN_METHOD ) ;
-
- return method ;
- }
-
- private boolean isPublicStaticVoid( Method method )
- {
- // check modifiers: public static
- int modifiers = method.getModifiers ();
- if (!Modifier.isPublic (modifiers) || !Modifier.isStatic (modifiers)) {
- logError( method.getName() + " is not public static" ) ;
- return false ;
- }
-
- // check return type and exceptions
- if (method.getExceptionTypes ().length != 0) {
- logError( method.getName() + " declares exceptions" ) ;
- return false ;
- }
-
- if (!method.getReturnType().equals (Void.TYPE)) {
- logError( method.getName() + " does not have a void return type" ) ;
- return false ;
- }
-
- return true ;
- }
-
- private Method getNamedMethod( Class serverClass, String methodName )
- {
- Class argTypes[] = new Class[] { org.omg.CORBA.ORB.class } ;
- Method method = null ;
-
- try {
- method = serverClass.getDeclaredMethod( methodName, argTypes ) ;
- } catch (Exception exc) {
- return null ;
- }
-
- if (!isPublicStaticVoid( method ))
- return null ;
-
- return method ;
- }
-
- private void run(String[] args)
- {
- try {
- redirectIOStreams() ;
-
- String serverClassName = System.getProperty(
- ORBConstants.SERVER_NAME_PROPERTY ) ;
-
- // determine the class loader to be used for loading the class
- // since ServerMain is going to be in JDK and we need to have this
- // class to load application classes, this is required here.
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
- if (cl == null)
- cl = ClassLoader.getSystemClassLoader();
-
- // determine the main class
- Class serverClass = null;
-
- try {
- // determine the main class, try loading with current class loader
- serverClass = Class.forName( serverClassName ) ;
- } catch (ClassNotFoundException ex) {
- // eat the exception and try to load using SystemClassLoader
- serverClass = Class.forName( serverClassName, true, cl);
- }
-
- if (debug)
- System.out.println("class " + serverClassName + " found");
-
- // get the main method
- Method mainMethod = getMainMethod( serverClass ) ;
-
- // This piece of code is required, to verify the server definition
- // without launching it.
-
- // verify the server
-
- boolean serverVerifyFlag = Boolean.getBoolean(
- ORBConstants.SERVER_DEF_VERIFY_PROPERTY) ;
- if (serverVerifyFlag) {
- if (mainMethod == null)
- logTerminal("", NO_MAIN_METHOD);
- else {
- if (debug)
- System.out.println("Valid Server");
- logTerminal("", OK);
- }
- }
-
-
- registerCallback( serverClass ) ;
-
- // build args to the main and call it
- Object params [] = new Object [1];
- params[0] = args;
- mainMethod.invoke(null, params);
-
- } catch (ClassNotFoundException e) {
- logTerminal("ClassNotFound exception: " + e.getMessage(),
- MAIN_CLASS_NOT_FOUND);
- } catch (Exception e) {
- logTerminal("Exception: " + e.getMessage(),
- APPLICATION_ERROR);
- }
- }
-
- public static void main(String[] args) {
- ServerMain server = new ServerMain();
- server.run(args);
- }
-
- private static final boolean debug = false;
-
- private int getServerId()
- {
- Integer serverId = Integer.getInteger( ORBConstants.SERVER_ID_PROPERTY ) ;
-
- if (serverId == null)
- logTerminal( "", NO_SERVER_ID ) ;
-
- return serverId.intValue() ;
- }
-
- private void registerCallback( Class serverClass )
- {
- Method installMethod = getNamedMethod( serverClass, "install" ) ;
- Method uninstallMethod = getNamedMethod( serverClass, "uninstall" ) ;
- Method shutdownMethod = getNamedMethod( serverClass, "shutdown" ) ;
-
- Properties props = new Properties() ;
- props.put( "org.omg.CORBA.ORBClass",
- "com.sun.corba.se.impl.orb.ORBImpl" ) ;
- // NOTE: Very important to pass this property, otherwise the
- // Persistent Server registration will be unsucessfull.
- props.put( ORBConstants.ACTIVATED_PROPERTY, "false" );
- String args[] = null ;
- ORB orb = ORB.init( args, props ) ;
-
- ServerCallback serverObj = new ServerCallback( orb,
- installMethod, uninstallMethod, shutdownMethod ) ;
-
- int serverId = getServerId() ;
-
- try {
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
- activator.active(serverId, serverObj);
- } catch (Exception ex) {
- logTerminal( "exception " + ex.getMessage(),
- REGISTRATION_FAILED ) ;
- }
- }
-}
-
-class ServerCallback extends
- com.sun.corba.se.spi.activation._ServerImplBase
-{
- private ORB orb;
- private transient Method installMethod ;
- private transient Method uninstallMethod ;
- private transient Method shutdownMethod ;
- private Object methodArgs[] ;
-
- ServerCallback(ORB orb, Method installMethod, Method uninstallMethod,
- Method shutdownMethod )
- {
- this.orb = orb;
- this.installMethod = installMethod ;
- this.uninstallMethod = uninstallMethod ;
- this.shutdownMethod = shutdownMethod ;
-
- orb.connect( this ) ;
-
- methodArgs = new Object[] { orb } ;
- }
-
- private void invokeMethod( Method method )
- {
- if (method != null)
- try {
- method.invoke( null, methodArgs ) ;
- } catch (Exception exc) {
- ServerMain.logError( "could not invoke " + method.getName() +
- " method: " + exc.getMessage() ) ;
- }
- }
-
- // shutdown the ORB and wait for completion
- public void shutdown()
- {
- ServerMain.logInformation( "Shutdown starting" ) ;
-
- invokeMethod( shutdownMethod ) ;
-
- orb.shutdown(true);
-
- ServerMain.logTerminal( "Shutdown completed", ServerMain.OK ) ;
- }
-
- public void install()
- {
- ServerMain.logInformation( "Install starting" ) ;
-
- invokeMethod( installMethod ) ;
-
- ServerMain.logInformation( "Install completed" ) ;
- }
-
- public void uninstall()
- {
- ServerMain.logInformation( "uninstall starting" ) ;
-
- invokeMethod( uninstallMethod ) ;
-
- ServerMain.logInformation( "uninstall completed" ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java b/src/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java
deleted file mode 100644
index 745f0aa..0000000
--- a/src/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java
+++ /dev/null
@@ -1,645 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.corba.se.impl.activation;
-
-/**
- *
- * @author Rohit Garg
- * @author Ken Cavanaugh
- * @author Hemanth Puttaswamy
- * @since JDK1.2
- */
-
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import org.omg.CORBA.OBJECT_NOT_EXIST;
-import org.omg.CORBA.SystemException;
-
-import com.sun.corba.se.spi.activation.EndPointInfo;
-import com.sun.corba.se.spi.activation.IIOP_CLEAR_TEXT;
-import com.sun.corba.se.spi.activation.ORBPortInfo;
-import com.sun.corba.se.spi.activation.Repository;
-import com.sun.corba.se.spi.activation.LocatorPackage.ServerLocation;
-import com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB;
-import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef;
-import com.sun.corba.se.spi.activation._ServerManagerImplBase;
-import com.sun.corba.se.spi.activation.ServerAlreadyActive;
-import com.sun.corba.se.spi.activation.ServerAlreadyInstalled;
-import com.sun.corba.se.spi.activation.ServerAlreadyUninstalled;
-import com.sun.corba.se.spi.activation.ServerNotRegistered;
-import com.sun.corba.se.spi.activation.ORBAlreadyRegistered;
-import com.sun.corba.se.spi.activation.ServerHeldDown;
-import com.sun.corba.se.spi.activation.ServerNotActive;
-import com.sun.corba.se.spi.activation.NoSuchEndPoint;
-import com.sun.corba.se.spi.activation.InvalidORBid;
-import com.sun.corba.se.spi.activation.Server;
-import com.sun.corba.se.spi.activation.IIOP_CLEAR_TEXT;
-import com.sun.corba.se.spi.ior.IORTemplate ;
-import com.sun.corba.se.spi.ior.IOR ;
-import com.sun.corba.se.spi.ior.ObjectKey ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.IORFactories ;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
-import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
-import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.protocol.ForwardException;
-import com.sun.corba.se.spi.transport.CorbaTransportManager;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ActivationSystemException ;
-
-import com.sun.corba.se.impl.oa.poa.BadServerIdHandler;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.util.Utility;
-
-public class ServerManagerImpl extends _ServerManagerImplBase
- implements BadServerIdHandler
-{
- // Using HashMap, since synchronization should be done by the calling
- // routines
- HashMap serverTable;
- Repository repository;
-
- CorbaTransportManager transportManager;
- int initialPort;
- ORB orb;
- ActivationSystemException wrapper;
- String dbDirName;
- boolean debug = false ;
-
- private int serverStartupDelay;
-
- ServerManagerImpl(ORB orb, CorbaTransportManager transportManager,
- Repository repository, String dbDirName, boolean debug)
- {
- this.orb = orb;
- wrapper = ActivationSystemException.get( orb, CORBALogDomains.ORBD_ACTIVATOR ) ;
-
- this.transportManager = transportManager; // REVISIT - NOT USED.
- this.repository = repository;
- this.dbDirName = dbDirName;
- this.debug = debug ;
-
- LegacyServerSocketEndPointInfo endpoint =
- orb.getLegacyServerSocketManager()
- .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
-
- initialPort = ((SocketOrChannelAcceptor)endpoint)
- .getServerSocket().getLocalPort();
- serverTable = new HashMap(256);
-
- // The ServerStartupDelay is the delay added after the Server registers
- // end point information. This is to allow the server to completely
- // initialize after ORB is instantiated.
- serverStartupDelay = ORBConstants.DEFAULT_SERVER_STARTUP_DELAY;
- String delay = System.getProperty( ORBConstants.SERVER_STARTUP_DELAY);
- if( delay != null ) {
- try {
- serverStartupDelay = Integer.parseInt( delay );
- } catch ( Exception e ) {
- // Just use the default 1000 milliseconds as the default
- }
- }
-
- Class cls = orb.getORBData( ).getBadServerIdHandler();
- if( cls == null ) {
- orb.setBadServerIdHandler( this );
- } else {
- orb.initBadServerIdHandler() ;
- }
-
- orb.connect(this);
- ProcessMonitorThread.start( serverTable );
- }
-
- public void activate(int serverId)
- throws ServerAlreadyActive, ServerNotRegistered, ServerHeldDown
- {
-
- ServerLocation location;
- ServerTableEntry entry;
- Integer key = new Integer(serverId);
-
- synchronized(serverTable) {
- entry = (ServerTableEntry) serverTable.get(key);
- }
-
- if (entry != null && entry.isActive()) {
- if (debug)
- System.out.println( "ServerManagerImpl: activate for server Id " +
- serverId + " failed because server is already active. " +
- "entry = " + entry ) ;
-
- throw new ServerAlreadyActive( serverId );
- }
-
- // locate the server
- try {
-
- // We call getEntry here so that state of the entry is
- // checked for validity before we actually go and locate a server
-
- entry = getEntry(serverId);
-
- if (debug)
- System.out.println( "ServerManagerImpl: locateServer called with " +
- " serverId=" + serverId + " endpointType="
- + IIOP_CLEAR_TEXT.value + " block=false" ) ;
-
- location = locateServer(entry, IIOP_CLEAR_TEXT.value, false);
-
- if (debug)
- System.out.println( "ServerManagerImpl: activate for server Id " +
- serverId + " found location " +
- location.hostname + " and activated it" ) ;
- } catch (NoSuchEndPoint ex) {
- if (debug)
- System.out.println( "ServerManagerImpl: activate for server Id " +
- " threw NoSuchEndpoint exception, which was ignored" );
- }
- }
-
- public void active(int serverId, Server server) throws ServerNotRegistered
- {
- ServerTableEntry entry;
- Integer key = new Integer(serverId);
-
- synchronized (serverTable) {
- entry = (ServerTableEntry) serverTable.get(key);
-
- if (entry == null) {
- if (debug)
- System.out.println( "ServerManagerImpl: active for server Id " +
- serverId + " called, but no such server is registered." ) ;
-
- throw wrapper.serverNotExpectedToRegister() ;
- } else {
- if (debug)
- System.out.println( "ServerManagerImpl: active for server Id " +
- serverId + " called. This server is now active." ) ;
-
- entry.register(server);
- }
- }
- }
-
- public void registerEndpoints( int serverId, String orbId,
- EndPointInfo [] endpointList ) throws NoSuchEndPoint, ServerNotRegistered,
- ORBAlreadyRegistered
- {
- // orbId is ignored for now
- ServerTableEntry entry;
- Integer key = new Integer(serverId);
-
- synchronized (serverTable) {
- entry = (ServerTableEntry) serverTable.get(key);
-
- if (entry == null) {
- if (debug)
- System.out.println(
- "ServerManagerImpl: registerEndpoint for server Id " +
- serverId + " called, but no such server is registered." ) ;
-
- throw wrapper.serverNotExpectedToRegister() ;
- } else {
- if (debug)
- System.out.println(
- "ServerManagerImpl: registerEndpoints for server Id " +
- serverId + " called. This server is now active." ) ;
-
- entry.registerPorts( orbId, endpointList );
-
- }
- }
- }
-
- public int[] getActiveServers()
- {
- ServerTableEntry entry;
- int[] list = null;
-
- synchronized (serverTable) {
- // unlike vectors, list is not synchronized
-
- ArrayList servers = new ArrayList(0);
-
- Iterator serverList = serverTable.keySet().iterator();
-
- try {
- while (serverList.hasNext()) {
- Integer key = (Integer) serverList.next();
- // get an entry
- entry = (ServerTableEntry) serverTable.get(key);
-
- if (entry.isValid() && entry.isActive()) {
- servers.add(entry);
- }
- }
- } catch (NoSuchElementException e) {
- // all done
- }
-
- // collect the active entries
- list = new int[servers.size()];
- for (int i = 0; i < servers.size(); i++) {
- entry = (ServerTableEntry) servers.get(i);
- list[i] = entry.getServerId();
- }
- }
-
- if (debug) {
- StringBuffer sb = new StringBuffer() ;
- for (int ctr=0; ctr<list.length; ctr++) {
- sb.append( ' ' ) ;
- sb.append( list[ctr] ) ;
- }
-
- System.out.println( "ServerManagerImpl: getActiveServers returns" +
- sb.toString() ) ;
- }
-
- return list;
- }
-
- public void shutdown(int serverId) throws ServerNotActive
- {
- ServerTableEntry entry;
- Integer key = new Integer(serverId);
-
- synchronized(serverTable) {
- entry = (ServerTableEntry) serverTable.remove(key);
-
- if (entry == null) {
- if (debug)
- System.out.println( "ServerManagerImpl: shutdown for server Id " +
- serverId + " throws ServerNotActive." ) ;
-
- throw new ServerNotActive( serverId );
- }
-
- try {
- entry.destroy();
-
- if (debug)
- System.out.println( "ServerManagerImpl: shutdown for server Id " +
- serverId + " completed." ) ;
- } catch (Exception e) {
- if (debug)
- System.out.println( "ServerManagerImpl: shutdown for server Id " +
- serverId + " threw exception " + e ) ;
- }
- }
- }
-
- private ServerTableEntry getEntry( int serverId )
- throws ServerNotRegistered
- {
- Integer key = new Integer(serverId);
- ServerTableEntry entry = null ;
-
- synchronized (serverTable) {
- entry = (ServerTableEntry) serverTable.get(key);
-
- if (debug)
- if (entry == null) {
- System.out.println( "ServerManagerImpl: getEntry: " +
- "no active server found." ) ;
- } else {
- System.out.println( "ServerManagerImpl: getEntry: " +
- " active server found " + entry + "." ) ;
- }
-
- if ((entry != null) && (!entry.isValid())) {
- serverTable.remove(key);
- entry = null;
- }
-
- if (entry == null) {
- ServerDef serverDef = repository.getServer(serverId);
-
- entry = new ServerTableEntry( wrapper,
- serverId, serverDef, initialPort, dbDirName, false, debug);
- serverTable.put(key, entry);
- entry.activate() ;
- }
- }
-
- return entry ;
- }
-
- private ServerLocation locateServer (ServerTableEntry entry, String endpointType,
- boolean block)
- throws NoSuchEndPoint, ServerNotRegistered, ServerHeldDown
- {
- ServerLocation location = new ServerLocation() ;
-
- // if server location is desired, then wait for the server
- // to register back, then return location
-
- ORBPortInfo [] serverORBAndPortList;
- if (block) {
- try {
- serverORBAndPortList = entry.lookup(endpointType);
- } catch (Exception ex) {
- if (debug)
- System.out.println( "ServerManagerImpl: locateServer: " +
- "server held down" ) ;
-
- throw new ServerHeldDown( entry.getServerId() );
- }
-
- String host =
- orb.getLegacyServerSocketManager()
- .legacyGetEndpoint(LegacyServerSocketEndPointInfo.DEFAULT_ENDPOINT).getHostName();
- location.hostname = host ;
- int listLength;
- if (serverORBAndPortList != null) {
- listLength = serverORBAndPortList.length;
- } else {
- listLength = 0;
- }
- location.ports = new ORBPortInfo[listLength];
- for (int i = 0; i < listLength; i++) {
- location.ports[i] = new ORBPortInfo(serverORBAndPortList[i].orbId,
- serverORBAndPortList[i].port) ;
-
- if (debug)
- System.out.println( "ServerManagerImpl: locateServer: " +
- "server located at location " +
- location.hostname + " ORBid " +
- serverORBAndPortList[i].orbId +
- " Port " + serverORBAndPortList[i].port) ;
- }
- }
-
- return location;
- }
-
- private ServerLocationPerORB locateServerForORB (ServerTableEntry entry, String orbId,
- boolean block)
- throws InvalidORBid, ServerNotRegistered, ServerHeldDown
- {
- ServerLocationPerORB location = new ServerLocationPerORB() ;
-
- // if server location is desired, then wait for the server
- // to register back, then return location
-
- EndPointInfo [] endpointInfoList;
- if (block) {
- try {
- endpointInfoList = entry.lookupForORB(orbId);
- } catch (InvalidORBid ex) {
- throw ex;
- } catch (Exception ex) {
- if (debug)
- System.out.println( "ServerManagerImpl: locateServerForORB: " +
- "server held down" ) ;
-
- throw new ServerHeldDown( entry.getServerId() );
- }
-
- String host =
- orb.getLegacyServerSocketManager()
- .legacyGetEndpoint(LegacyServerSocketEndPointInfo.DEFAULT_ENDPOINT).getHostName();
- location.hostname = host ;
- int listLength;
- if (endpointInfoList != null) {
- listLength = endpointInfoList.length;
- } else {
- listLength = 0;
- }
- location.ports = new EndPointInfo[listLength];
- for (int i = 0; i < listLength; i++) {
- location.ports[i] = new EndPointInfo(endpointInfoList[i].endpointType,
- endpointInfoList[i].port) ;
-
- if (debug)
- System.out.println( "ServerManagerImpl: locateServer: " +
- "server located at location " +
- location.hostname + " endpointType " +
- endpointInfoList[i].endpointType +
- " Port " + endpointInfoList[i].port) ;
- }
- }
-
- return location;
- }
-
- public String[] getORBNames(int serverId)
- throws ServerNotRegistered
- {
- try {
- ServerTableEntry entry = getEntry( serverId ) ;
- return (entry.getORBList());
- } catch (Exception ex) {
- throw new ServerNotRegistered(serverId);
- }
- }
-
- private ServerTableEntry getRunningEntry( int serverId )
- throws ServerNotRegistered
- {
- ServerTableEntry entry = getEntry( serverId ) ;
-
- try {
- // this is to see if the server has any listeners
- ORBPortInfo [] serverORBAndPortList = entry.lookup(IIOP_CLEAR_TEXT.value) ;
- } catch (Exception exc) {
- return null ;
- }
- return entry;
-
- }
-
- public void install( int serverId )
- throws ServerNotRegistered, ServerHeldDown, ServerAlreadyInstalled
- {
- ServerTableEntry entry = getRunningEntry( serverId ) ;
- if (entry != null) {
- repository.install( serverId ) ;
- entry.install() ;
- }
- }
-
- public void uninstall( int serverId )
- throws ServerNotRegistered, ServerHeldDown, ServerAlreadyUninstalled
- {
- ServerTableEntry entry =
- (ServerTableEntry) serverTable.get( new Integer(serverId) );
-
- if (entry != null) {
-
- entry =
- (ServerTableEntry) serverTable.remove(new Integer(serverId));
-
- if (entry == null) {
- if (debug)
- System.out.println( "ServerManagerImpl: shutdown for server Id " +
- serverId + " throws ServerNotActive." ) ;
-
- throw new ServerHeldDown( serverId );
- }
-
- entry.uninstall();
- }
- }
-
- public ServerLocation locateServer (int serverId, String endpointType)
- throws NoSuchEndPoint, ServerNotRegistered, ServerHeldDown
- {
- ServerTableEntry entry = getEntry( serverId ) ;
- if (debug)
- System.out.println( "ServerManagerImpl: locateServer called with " +
- " serverId=" + serverId + " endpointType=" +
- endpointType + " block=true" ) ;
-
- // passing in entry to eliminate multiple lookups for
- // the same entry in some cases
-
- return locateServer(entry, endpointType, true);
- }
-
- /** This method is used to obtain the registered ports for an ORB.
- * This is useful for custom Bad server ID handlers in ORBD.
- */
- public ServerLocationPerORB locateServerForORB (int serverId, String orbId)
- throws InvalidORBid, ServerNotRegistered, ServerHeldDown
- {
- ServerTableEntry entry = getEntry( serverId ) ;
-
- // passing in entry to eliminate multiple lookups for
- // the same entry in some cases
-
- if (debug)
- System.out.println( "ServerManagerImpl: locateServerForORB called with " +
- " serverId=" + serverId + " orbId=" + orbId +
- " block=true" ) ;
- return locateServerForORB(entry, orbId, true);
- }
-
-
- public void handle(ObjectKey okey)
- {
- IOR newIOR = null;
- ServerLocationPerORB location;
-
- // we need to get the serverid and the orbid from the object key
- ObjectKeyTemplate oktemp = okey.getTemplate();
- int serverId = oktemp.getServerId() ;
- String orbId = oktemp.getORBId() ;
-
- try {
- // get the ORBName corresponding to the orbMapid, that was
- // first registered by the server
- ServerTableEntry entry = getEntry( serverId ) ;
- location = locateServerForORB(entry, orbId, true);
-
- if (debug)
- System.out.println( "ServerManagerImpl: handle called for server id" +
- serverId + " orbid " + orbId) ;
-
- // we received a list of ports corresponding to an ORB in a
- // particular server, now retrieve the one corresponding
- // to IIOP_CLEAR_TEXT, and for other created the tagged
- // components to be added to the IOR
-
- int clearPort = 0;
- EndPointInfo[] listenerPorts = location.ports;
- for (int i = 0; i < listenerPorts.length; i++) {
- if ((listenerPorts[i].endpointType).equals(IIOP_CLEAR_TEXT.value)) {
- clearPort = listenerPorts[i].port;
- break;
- }
- }
-
- // create a new IOR with the correct port and correct tagged
- // components
- IIOPAddress addr = IIOPFactories.makeIIOPAddress( orb,
- location.hostname, clearPort ) ;
- IIOPProfileTemplate iptemp =
- IIOPFactories.makeIIOPProfileTemplate(
- orb, GIOPVersion.V1_2, addr ) ;
- if (GIOPVersion.V1_2.supportsIORIIOPProfileComponents()) {
- iptemp.add(IIOPFactories.makeCodeSetsComponent(orb));
- iptemp.add(IIOPFactories.makeMaxStreamFormatVersionComponent());
- }
- IORTemplate iortemp = IORFactories.makeIORTemplate(oktemp) ;
- iortemp.add( iptemp ) ;
-
- newIOR = iortemp.makeIOR(orb, "IDL:org/omg/CORBA/Object:1.0",
- okey.getId() );
- } catch (Exception e) {
- throw wrapper.errorInBadServerIdHandler( e ) ;
- }
-
- if (debug)
- System.out.println( "ServerManagerImpl: handle " +
- "throws ForwardException" ) ;
-
-
- try {
- // This delay is required in case of Server is activated or
- // re-activated the first time. Server needs some time before
- // handling all the requests.
- // (Talk to Ken to see whether there is a better way of doing this).
- Thread.sleep( serverStartupDelay );
- } catch ( Exception e ) {
- System.out.println( "Exception = " + e );
- e.printStackTrace();
- }
-
- throw new ForwardException(orb, newIOR);
- }
-
- public int getEndpoint(String endpointType) throws NoSuchEndPoint
- {
- return orb.getLegacyServerSocketManager()
- .legacyGetTransientServerPort(endpointType);
- }
-
- public int getServerPortForType(ServerLocationPerORB location,
- String endPointType)
- throws NoSuchEndPoint
- {
- EndPointInfo[] listenerPorts = location.ports;
- for (int i = 0; i < listenerPorts.length; i++) {
- if ((listenerPorts[i].endpointType).equals(endPointType)) {
- return listenerPorts[i].port;
- }
- }
- throw new NoSuchEndPoint();
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/activation/ServerTableEntry.java b/src/share/classes/com/sun/corba/se/impl/activation/ServerTableEntry.java
deleted file mode 100644
index 45b6d87..0000000
--- a/src/share/classes/com/sun/corba/se/impl/activation/ServerTableEntry.java
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-package com.sun.corba.se.impl.activation;
-
-/**
- *
- * @author Anita Jindal
- * @since JDK1.2
- */
-
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.spi.activation.Server;
-import com.sun.corba.se.spi.activation.EndPointInfo;
-import com.sun.corba.se.spi.activation.ORBAlreadyRegistered;
-import com.sun.corba.se.spi.activation.ORBPortInfo;
-import com.sun.corba.se.spi.activation.InvalidORBid;
-import com.sun.corba.se.spi.activation.ServerHeldDown;
-import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef;
-import com.sun.corba.se.spi.activation.IIOP_CLEAR_TEXT;
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.logging.ActivationSystemException ;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-public class ServerTableEntry
-{
-
- private final static int DE_ACTIVATED = 0;
- private final static int ACTIVATING = 1;
- private final static int ACTIVATED = 2;
- private final static int RUNNING = 3;
- private final static int HELD_DOWN = 4;
-
-
- private String printState()
- {
- String str = "UNKNOWN";
-
- switch (state) {
- case (DE_ACTIVATED) : str = "DE_ACTIVATED"; break;
- case (ACTIVATING ) : str = "ACTIVATING "; break;
- case (ACTIVATED ) : str = "ACTIVATED "; break;
- case (RUNNING ) : str = "RUNNING "; break;
- case (HELD_DOWN ) : str = "HELD_DOWN "; break;
- default: break;
- }
-
- return str;
- }
-
- private final static long waitTime = 2000;
- private static final int ActivationRetryMax = 5;
-
- // state of each entry
- private int state;
- private int serverId;
- private HashMap orbAndPortInfo;
- private Server serverObj;
- private ServerDef serverDef;
- private Process process;
- private int activateRetryCount=0;
- private String activationCmd;
- private ActivationSystemException wrapper ;
- public String toString()
- {
- return "ServerTableEntry[" + "state=" + printState() +
- " serverId=" + serverId +
- " activateRetryCount=" + activateRetryCount + "]" ;
- }
-
- // get the string needed to make the activation command
- private static String javaHome, classPath, fileSep, pathSep;
-
- static {
- javaHome = System.getProperty("java.home");
- classPath = System.getProperty("java.class.path");
- fileSep = System.getProperty("file.separator");
- pathSep = System.getProperty("path.separator");
- }
-
- ServerTableEntry( ActivationSystemException wrapper,
- int serverId, ServerDef serverDef, int initialPort,
- String dbDirName, boolean verify, boolean debug )
- {
- this.wrapper = wrapper ;
- this.serverId = serverId;
- this.serverDef = serverDef;
- this.debug = debug ;
- // create a HashMap with capacity 255
- // Since all methods are synchronized, we don't need any
- // additional synchronization mechanisms
- orbAndPortInfo = new HashMap(255);
-
- activateRetryCount = 0;
- state = ACTIVATING;
-
- // compute the activation command
- activationCmd =
-
- // add path to the java vm
- javaHome + fileSep + "bin" + fileSep + "java " +
-
- // add any arguments to the server Java VM
- serverDef.serverVmArgs + " " +
-
- // add ORB properties
- "-Dioser=" + System.getProperty( "ioser" ) + " " +
- "-D" + ORBConstants.INITIAL_PORT_PROPERTY + "=" + initialPort + " " +
- "-D" + ORBConstants.DB_DIR_PROPERTY + "=" + dbDirName + " " +
- "-D" + ORBConstants.ACTIVATED_PROPERTY + "=true " +
- "-D" + ORBConstants.SERVER_ID_PROPERTY + "=" + serverId + " " +
- "-D" + ORBConstants.SERVER_NAME_PROPERTY + "=" + serverDef.serverName + " " +
- // we need to pass in the verify flag, so that the server is not
- // launched, when we try to validate its definition during registration
- // into the RepositoryImpl
-
- (verify ? "-D" + ORBConstants.SERVER_DEF_VERIFY_PROPERTY + "=true ": "") +
-
- // add classpath to the server
- "-classpath " + classPath +
- (serverDef.serverClassPath.equals("") == true ? "" : pathSep) +
- serverDef.serverClassPath +
-
- // add server class name and arguments
- " com.sun.corba.se.impl.activation.ServerMain " + serverDef.serverArgs
-
- // Add the debug flag, if any
- + (debug ? " -debug" : "") ;
-
- if (debug) System.out.println(
- "ServerTableEntry constructed with activation command " +
- activationCmd);
- }
-
- /**
- * Verify whether the server definition is valid.
- */
- public int verify()
- {
- try {
-
- if (debug)
- System.out.println("Server being verified w/" + activationCmd);
-
- process = Runtime.getRuntime().exec(activationCmd);
- int result = process.waitFor();
- if (debug)
- printDebug( "verify", "returns " + ServerMain.printResult( result ) ) ;
- return result ;
- } catch (Exception e) {
- if (debug)
- printDebug( "verify", "returns unknown error because of exception " +
- e ) ;
- return ServerMain.UNKNOWN_ERROR;
- }
- }
-
- private void printDebug(String method, String msg)
- {
- System.out.println("ServerTableEntry: method =" + method);
- System.out.println("ServerTableEntry: server =" + serverId);
- System.out.println("ServerTableEntry: state =" + printState());
- System.out.println("ServerTableEntry: message =" + msg);
- System.out.println();
- }
-
- synchronized void activate() throws org.omg.CORBA.SystemException
- {
- state = ACTIVATED;
-
- try {
- if (debug)
- printDebug("activate", "activating server");
- process = Runtime.getRuntime().exec(activationCmd);
- } catch (Exception e) {
- deActivate();
- if (debug)
- printDebug("activate", "throwing premature process exit");
- throw wrapper.unableToStartProcess() ;
- }
- }
-
- synchronized void register(Server server)
- {
- if (state == ACTIVATED) {
-
- serverObj = server;
-
- //state = RUNNING;
- //notifyAll();
-
- if (debug)
- printDebug("register", "process registered back");
-
- } else {
-
- if (debug)
- printDebug("register", "throwing premature process exit");
- throw wrapper.serverNotExpectedToRegister() ;
- }
- }
-
- synchronized void registerPorts( String orbId, EndPointInfo [] endpointList)
- throws ORBAlreadyRegistered
- {
-
- // find if the ORB is already registered, then throw an exception
- if (orbAndPortInfo.containsKey(orbId)) {
- throw new ORBAlreadyRegistered(orbId);
- }
-
- // store all listener ports and their types
- int numListenerPorts = endpointList.length;
- EndPointInfo [] serverListenerPorts = new EndPointInfo[numListenerPorts];
-
- for (int i = 0; i < numListenerPorts; i++) {
- serverListenerPorts[i] = new EndPointInfo (endpointList[i].endpointType, endpointList[i].port);
- if (debug)
- System.out.println("registering type: " + serverListenerPorts[i].endpointType + " port " + serverListenerPorts[i].port);
- }
-
- // put this set of listener ports in the HashMap associated
- // with the orbId
- orbAndPortInfo.put(orbId, serverListenerPorts);
- if (state == ACTIVATED) {
- state = RUNNING;
- notifyAll();
- }
- // _REVISIT_, If the state is not equal to ACTIVATED then it is a bug
- // need to log that error, once the Logging framework is in place
- // for rip-int.
- if (debug)
- printDebug("registerPorts", "process registered Ports");
- }
-
- void install()
- {
- Server localServerObj = null;
- synchronized ( this ) {
- if (state == RUNNING)
- localServerObj = serverObj;
- else
- throw wrapper.serverNotRunning() ;
- }
- if (localServerObj != null) {
- localServerObj.install() ;
- }
-
- }
-
- void uninstall()
- {
- Server localServerObj = null;
- Process localProcess = null;
-
- synchronized (this) {
- localServerObj = serverObj;
- localProcess = process;
-
- if (state == RUNNING) {
-
- deActivate();
-
- } else {
- throw wrapper.serverNotRunning() ;
- }
- }
- try {
- if (localServerObj != null) {
- localServerObj.shutdown(); // shutdown the server
- localServerObj.uninstall() ; // call the uninstall
- }
-
- if (localProcess != null) {
- localProcess.destroy();
- }
- } catch (Exception ex) {
- // what kind of exception should be thrown
- }
- }
-
- synchronized void holdDown()
- {
- state = HELD_DOWN;
-
- if (debug)
- printDebug( "holdDown", "server held down" ) ;
-
- notifyAll();
- }
-
- synchronized void deActivate()
- {
- state = DE_ACTIVATED;
-
- if (debug)
- printDebug( "deActivate", "server deactivated" ) ;
-
- notifyAll();
- }
-
- synchronized void checkProcessHealth( ) {
- // If the State in the ServerTableEntry is RUNNING and the
- // Process was shut down abnormally, The method will change the
- // server state as De-Activated.
- if( state == RUNNING ) {
- try {
- int exitVal = process.exitValue();
- } catch (IllegalThreadStateException e1) {
- return;
- }
- synchronized ( this ) {
- // Clear the PortInformation as it is old
- orbAndPortInfo.clear();
- // Move the state to De-Activated, So that the next
- // call to this server will re-activate.
- deActivate();
- }
- }
- }
-
- synchronized boolean isValid()
- {
- if ((state == ACTIVATING) || (state == HELD_DOWN)) {
- if (debug)
- printDebug( "isValid", "returns true" ) ;
-
- return true;
- }
-
- try {
- int exitVal = process.exitValue();
- } catch (IllegalThreadStateException e1) {
- return true;
- }
-
- if (state == ACTIVATED) {
- if (activateRetryCount < ActivationRetryMax) {
- if (debug)
- printDebug("isValid", "reactivating server");
- activateRetryCount++;
- activate();
- return true;
- }
-
- if (debug)
- printDebug("isValid", "holding server down");
-
- holdDown();
- return true;
- }
-
- deActivate();
- return false;
- }
-
- synchronized ORBPortInfo[] lookup(String endpointType) throws ServerHeldDown
- {
- while ((state == ACTIVATING) || (state == ACTIVATED)) {
- try {
- wait(waitTime);
- if (!isValid()) break;
- } catch(Exception e) {}
- }
- ORBPortInfo[] orbAndPortList = null;
-
- if (state == RUNNING) {
- orbAndPortList = new ORBPortInfo[orbAndPortInfo.size()];
- Iterator setORBids = orbAndPortInfo.keySet().iterator();
-
- try {
- int numElements = 0;
- int i;
- int port;
- while (setORBids.hasNext()) {
- String orbId = (String) setORBids.next();
- // get an entry corresponding to orbId
- EndPointInfo [] serverListenerPorts = (EndPointInfo []) orbAndPortInfo.get(orbId);
- port = -1;
- // return the port corresponding to the endpointType
- for (i = 0; i < serverListenerPorts.length; i++) {
- if (debug)
- System.out.println("lookup num-ports " + serverListenerPorts.length + " " +
- serverListenerPorts[i].endpointType + " " +
- serverListenerPorts[i].port );
- if ((serverListenerPorts[i].endpointType).equals(endpointType)) {
- port = serverListenerPorts[i].port;
- break;
- }
- }
- orbAndPortList[numElements] = new ORBPortInfo(orbId, port);
- numElements++;
- }
- } catch (NoSuchElementException e) {
- // have everything in the table
- }
- return orbAndPortList;
- }
-
- if (debug)
- printDebug("lookup", "throwing server held down error");
-
- throw new ServerHeldDown( serverId ) ;
- }
-
- synchronized EndPointInfo[] lookupForORB(String orbId)
- throws ServerHeldDown, InvalidORBid
- {
- while ((state == ACTIVATING) || (state == ACTIVATED)) {
- try {
- wait(waitTime);
- if (!isValid()) break;
- } catch(Exception e) {}
- }
- EndPointInfo[] portList = null;
-
- if (state == RUNNING) {
-
- try {
-
- // get an entry corresponding to orbId
- EndPointInfo [] serverListenerPorts = (EndPointInfo []) orbAndPortInfo.get(orbId);
-
- portList = new EndPointInfo[serverListenerPorts.length];
- // return the port corresponding to the endpointType
- for (int i = 0; i < serverListenerPorts.length; i++) {
- if (debug)
- System.out.println("lookup num-ports " + serverListenerPorts.length + " "
- + serverListenerPorts[i].endpointType + " " +
- serverListenerPorts[i].port );
- portList[i] = new EndPointInfo(serverListenerPorts[i].endpointType, serverListenerPorts[i].port);
- }
- } catch (NoSuchElementException e) {
- // no element in HashMap corresponding to ORBid found
- throw new InvalidORBid();
- }
- return portList;
- }
-
- if (debug)
- printDebug("lookup", "throwing server held down error");
-
- throw new ServerHeldDown( serverId ) ;
- }
-
- synchronized String[] getORBList()
- {
- String [] orbList = new String[orbAndPortInfo.size()];
- Iterator setORBids = orbAndPortInfo.keySet().iterator();
-
- try {
- int numElements = 0;
- while (setORBids.hasNext()) {
- String orbId = (String) setORBids.next();
- orbList[numElements++] = orbId ;
- }
- } catch (NoSuchElementException e) {
- // have everything in the table
- }
- return orbList;
- }
-
- int getServerId()
- {
- return serverId;
- }
-
- boolean isActive()
- {
- return (state == RUNNING) || (state == ACTIVATED);
- }
-
- synchronized void destroy()
- {
-
- Server localServerObj = null;
- Process localProcess = null;
-
- synchronized (this) {
- localServerObj = serverObj;
- localProcess = process;
-
- deActivate();
- }
-
- try {
- if (localServerObj != null)
- localServerObj.shutdown();
-
- if (debug)
- printDebug( "destroy", "server shutdown successfully" ) ;
- } catch (Exception ex) {
- if (debug)
- printDebug( "destroy",
- "server shutdown threw exception" + ex ) ;
- // ex.printStackTrace();
- }
-
- try {
- if (localProcess != null)
- localProcess.destroy();
-
- if (debug)
- printDebug( "destroy", "process destroyed successfully" ) ;
- } catch (Exception ex) {
- if (debug)
- printDebug( "destroy",
- "process destroy threw exception" + ex ) ;
-
- // ex.printStackTrace();
- }
- }
-
- private boolean debug = false;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/activation/ServerTool.java b/src/share/classes/com/sun/corba/se/impl/activation/ServerTool.java
deleted file mode 100644
index 6d48107..0000000
--- a/src/share/classes/com/sun/corba/se/impl/activation/ServerTool.java
+++ /dev/null
@@ -1,973 +0,0 @@
-/*
- * Copyright (c) 1997, 2002, 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.
- */
-
-package com.sun.corba.se.impl.activation;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-import java.util.Vector;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.INITIALIZE;
-import org.omg.CORBA.CompletionStatus;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.CorbaResourceUtil;
-import com.sun.corba.se.spi.activation.*;
-import com.sun.corba.se.spi.activation.ServerHeldDown;
-import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef;
-import com.sun.corba.se.spi.activation.LocatorPackage.ServerLocation;
-import com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB;
-
-/**
- *
- * @author Anita Jindal
- * @since JDK1.3
- */
-public class ServerTool
-{
- final static String helpCommand = "help";
- final static String toolName = "servertool";
- final static String commandArg = "-cmd";
-
- static int getServerIdForAlias( ORB orb, String applicationName ) throws ServerNotRegistered
- {
- try {
- Repository rep = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ) ) ;
- int serverid = rep.getServerID(applicationName);
-
- return rep.getServerID( applicationName ) ;
- } catch (Exception ex) {
- throw (new ServerNotRegistered());
- }
- }
-
- void run(String[] args)
- {
- String[] cmd = null;
-
- // if command specified in the args, get it
- for (int i=0; i < args.length; i++) {
-
- if (args[i].equals(commandArg)) {
- // get the command
- int cmdLen = args.length - i - 1;
- cmd = new String[cmdLen];
- for (int j=0; j < cmdLen; j++) cmd[j] = args[++i];
-
- break;
- }
- }
-
- try {
- // create the POA ORB
- Properties props = System.getProperties() ;
- props.put("org.omg.CORBA.ORBClass",
- "com.sun.corba.se.impl.orb.ORBImpl" );
- orb = (ORB) ORB.init(args, props);
-
- // if command specified in the args, process it
- if (cmd != null) executeCommand(cmd);
- else { // process commands interactively
-
- // create a buffered reader to read commands from standard in
- BufferedReader in = new
- BufferedReader(new InputStreamReader(System.in));
-
- // print tool banner
- System.out.println(CorbaResourceUtil.getText("servertool.banner"));
-
- // process commands until user quits
- while (true) {
- cmd = readCommand(in);
- if (cmd != null) executeCommand(cmd);
- else printAvailableCommands();
- }
- }
- } catch (Exception ex) {
- System.out.println(CorbaResourceUtil.getText("servertool.usage", "servertool"));
- System.out.println();
- ex.printStackTrace();
- }
- }
-
- public static void main(String[] args)
- {
- ServerTool tool = new ServerTool();
- tool.run(args);
- }
-
- String[] readCommand(BufferedReader in)
- {
- System.out.print(toolName + " > ");
-
- try {
- int i = 0;
- String cmd[] = null;
-
- String cmdLine = in.readLine();
-
- if (cmdLine != null) {
- StringTokenizer st = new StringTokenizer(cmdLine);
- if (st.countTokens() != 0) {
- cmd = new String[st.countTokens()];
- while (st.hasMoreTokens()) cmd[i++] = st.nextToken();
- }
- }
-
- return cmd;
- } catch (Exception ex) {
- System.out.println(CorbaResourceUtil.getText("servertool.usage", "servertool"));
- System.out.println();
- ex.printStackTrace();
- }
-
- return null;
- }
-
- void printAvailableCommands()
- {
- CommandHandler handler;
-
- // print short help
- System.out.println(CorbaResourceUtil.getText("servertool.shorthelp"));
-
- for (int i=0; i < handlers.size(); i++) {
- handler = (CommandHandler) handlers.elementAt(i);
- System.out.print("\t" + handler.getCommandName());
- for (int j=handler.getCommandName().length();
- j < maxNameLen; j++) System.out.print(" ");
- System.out.print(" - ");
- handler.printCommandHelp(System.out,
- CommandHandler.shortHelp);
- }
-
- System.out.println();
- }
-
- void executeCommand(String[] cmd)
- {
- boolean result;
- CommandHandler handler;
-
- // handle the help command
- if (cmd[0].equals(helpCommand)) {
- if (cmd.length == 1) printAvailableCommands();
- else {
- // print long help for a specific command
- for (int i=0; i < handlers.size(); i++) {
- handler = (CommandHandler) handlers.elementAt(i);
- if (handler.getCommandName().equals(cmd[1])) {
- handler.printCommandHelp(System.out,
- CommandHandler.longHelp);
- }
- }
- }
-
- return;
- }
-
- // determine the subcommand and execute it
- for (int i=0; i < handlers.size(); i++) {
- handler = (CommandHandler) handlers.elementAt(i);
- if (handler.getCommandName().equals(cmd[0])) {
- String[] cmdArgs = new String[cmd.length - 1];
-
- // construct args to the command
- for (int j=0; j < cmdArgs.length; j++)
- cmdArgs[j] = cmd[j+1];
-
- // execute the command
- try {
- System.out.println();
-
- result = handler.processCommand(cmdArgs, orb, System.out);
-
- if (result == CommandHandler.parseError) {
- handler.printCommandHelp(System.out,
- CommandHandler.longHelp);
- }
-
- System.out.println();
-
- } catch (Exception ex) {}
-
- return;
- }
- }
-
- // unknown command - print available commands
- printAvailableCommands();
- }
-
- final private static boolean debug = false;
-
- ORB orb = null;
-
- static Vector handlers;
- static int maxNameLen;
-
- static {
- handlers = new Vector();
- handlers.addElement(new RegisterServer());
- handlers.addElement(new UnRegisterServer());
- handlers.addElement(new GetServerID());
- handlers.addElement(new ListServers());
- handlers.addElement(new ListAliases());
- handlers.addElement(new ListActiveServers());
- handlers.addElement(new LocateServer());
- handlers.addElement(new LocateServerForORB());
- handlers.addElement(new ListORBs());
- handlers.addElement(new ShutdownServer());
- handlers.addElement(new StartServer());
- handlers.addElement(new Help());
- handlers.addElement(new Quit());
-
- // determine longest command name
- maxNameLen = 0;
- int cmdNameLen;
- for (int i=0; i < handlers.size(); i++) {
- CommandHandler handler = (CommandHandler) handlers.elementAt(i);
- cmdNameLen = handler.getCommandName().length();
- if (cmdNameLen > maxNameLen) maxNameLen = cmdNameLen;
- }
- }
-}
-
-class RegisterServer implements CommandHandler
-{
- public String getCommandName() {return "register";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.register"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.register1"));
- }
- }
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int i=0;
- String applicationName = "";
- String name = "";
- String classpath = "";
- String args = "";
- String vmargs = "";
- int serverId = 0;
-
- // parse register server command
- String arg;
- while (i < cmdArgs.length) {
-
- arg = cmdArgs[i++];
-
- if (arg.equals("-server")) {
- if (i < cmdArgs.length) name = cmdArgs[i++];
- else return parseError;
- } else if (arg.equals("-applicationName")) {
- if (i < cmdArgs.length) applicationName = cmdArgs[i++];
- else return parseError;
- } else if (arg.equals("-classpath")) {
- if (i < cmdArgs.length) classpath = cmdArgs[i++];
- else return parseError;
- } else if (arg.equals("-args")) {
- while ((i < cmdArgs.length) && !cmdArgs[i].equals("-vmargs")){
- args = args.equals("") ? cmdArgs[i] :
- args + " " + cmdArgs[i];
- i++;
- }
- if (args.equals("")) return parseError;
- } else if (arg.equals("-vmargs")) {
- while ((i < cmdArgs.length) && !cmdArgs[i].equals("-args")){
- vmargs = vmargs.equals("") ? cmdArgs[i] :
- vmargs + " " + cmdArgs[i];
- i++;
- }
- if (vmargs.equals("")) return parseError;
- } else return parseError;
- }
-
- // minimally the server class name has to be specified
- if (name.equals("")) return parseError;
-
- // register server and activate it
- try {
- // register the server with the repository
- Repository repository = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
-
- ServerDef server = new ServerDef(applicationName, name, classpath, args, vmargs);
- serverId = repository.registerServer(server);
-
- // activate the server
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
- activator.activate(serverId);
- activator.install(serverId);
-
- // print success message
- out.println(CorbaResourceUtil.getText("servertool.register2", serverId));
- } catch (ServerNotRegistered ex) {
- } catch (ServerAlreadyActive ex) {
- } catch (ServerHeldDown ex) {
- out.println(CorbaResourceUtil.getText("servertool.register3", serverId));
- } catch (ServerAlreadyRegistered ex) {
- out.println(CorbaResourceUtil.getText("servertool.register4", serverId));
- } catch (BadServerDefinition ex) {
- out.println(CorbaResourceUtil.getText("servertool.baddef", ex.reason));
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class UnRegisterServer implements CommandHandler
-{
- public String getCommandName() {return "unregister";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.unregister"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.unregister1"));
- }
-}
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int serverId = illegalServerId;
-
- try {
- if (cmdArgs.length == 2) {
- if (cmdArgs[0].equals("-serverid"))
- serverId = (Integer.valueOf(cmdArgs[1])).intValue();
- else if (cmdArgs[0].equals("-applicationName"))
- serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ;
- }
-
- // the server id has to be specified
- if (serverId == illegalServerId)
- return parseError;
-
- // deactivate server, hold it down and and unregister it
- // deactivate the server
- try {
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
- activator.uninstall(serverId);
- } catch (ServerHeldDown ex) {}
-
- // unregister the server from the repository
- Repository repository = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
- repository.unregisterServer(serverId);
-
- // print success message
- out.println(CorbaResourceUtil.getText("servertool.unregister2"));
- } catch (ServerNotRegistered ex) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class LocateServer implements CommandHandler
-{
- public String getCommandName() {return "locate";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.locate"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.locate1"));
- }
- }
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int serverId = illegalServerId;
-
- String endPointType = IIOP_CLEAR_TEXT.value;
- try {
-
- // parse command
- String arg;
- int i = 0;
- while (i < cmdArgs.length) {
-
- arg = cmdArgs[i++];
-
- if (arg.equals("-serverid")) {
- if (i < cmdArgs.length)
- serverId = (Integer.valueOf(cmdArgs[i++])).intValue();
- else
- return parseError;
- } else if (arg.equals("-applicationName")) {
- if (i < cmdArgs.length)
- serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[i++] ) ;
- else
- return parseError;
- } else if (arg.equals("-endpointType")) {
- if (i < cmdArgs.length)
- endPointType = cmdArgs[i++];
- }
- }
-
- // the server id has to be specified
- if (serverId == illegalServerId)
- return parseError;
-
- // locate the server
- // deactivate the server
- Locator locator = LocatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_LOCATOR_NAME ));
-
- ServerLocation location = locator.locateServer(serverId, endPointType);
-
- // print success message
- out.println(CorbaResourceUtil.getText("servertool.locate2", location.hostname));
- int numEntries = location.ports.length;
- for (i = 0; i < numEntries; i++) {
- ORBPortInfo orbPort = location.ports[i];
- out.println("\t\t"+ orbPort.port + "\t\t" + endPointType + "\t\t" + orbPort.orbId );
- }
- } catch (NoSuchEndPoint ex) {
- } catch (ServerHeldDown ex) {
- out.println(CorbaResourceUtil.getText("servertool.helddown"));
- } catch (ServerNotRegistered ex) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class LocateServerForORB implements CommandHandler
-{
- public String getCommandName() {return "locateperorb";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.locateorb"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.locateorb1"));
- }
- }
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int serverId = illegalServerId;
-
- String orbId = "";
- try {
-
- // parse command
- String arg;
- int i = 0;
- while (i < cmdArgs.length) {
-
- arg = cmdArgs[i++];
-
- if (arg.equals("-serverid")) {
- if (i < cmdArgs.length)
- serverId = (Integer.valueOf(cmdArgs[i++])).intValue();
- else
- return parseError;
- } else if (arg.equals("-applicationName")) {
- if (i < cmdArgs.length)
- serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[i++] ) ;
- else
- return parseError;
- } else if (arg.equals("-orbid")) {
- if (i < cmdArgs.length)
- orbId = cmdArgs[i++];
- }
- }
-
- // the server id has to be specified
- if (serverId == illegalServerId)
- return parseError;
-
- // locate the server
- // deactivate the server
- Locator locator = LocatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_LOCATOR_NAME ));
-
- ServerLocationPerORB location = locator.locateServerForORB(serverId,
- orbId);
-
- // print success message
- out.println(CorbaResourceUtil.getText("servertool.locateorb2", location.hostname));
- int numEntries = location.ports.length;
- for (i = 0; i < numEntries; i++) {
- EndPointInfo Port = location.ports[i];
- out.println("\t\t"+ Port.port + "\t\t" + Port.endpointType + "\t\t" + orbId );
- }
- } catch (InvalidORBid ex) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchorb"));
- } catch (ServerHeldDown ex) {
- out.println(CorbaResourceUtil.getText("servertool.helddown"));
- } catch (ServerNotRegistered ex) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class GetServerID implements CommandHandler
-{
- public String getCommandName() {return "getserverid" ; }
-
- public void printCommandHelp( PrintStream out, boolean helpType )
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.getserverid"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.getserverid1"));
- }
- }
-
- public boolean processCommand( String[] cmdArgs, ORB orb, PrintStream out )
- {
- if ((cmdArgs.length == 2) && cmdArgs[0].equals( "-applicationName" )) {
- String str = (String)cmdArgs[1] ;
-
- try {
- Repository repository = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
-
- try {
- int result = repository.getServerID( str ) ;
- out.println() ;
- out.println(CorbaResourceUtil.getText("servertool.getserverid2", str, Integer.toString(result)));
- out.println() ;
- } catch (ServerNotRegistered e) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- }
- } catch (Exception ex) {
- ex.printStackTrace() ;
- }
-
- return commandDone ;
- } else
- return parseError ;
- }
-}
-
-class ListServers implements CommandHandler
-{
- public String getCommandName() {return "list";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.list"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.list1"));
- }
- }
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int serverId = illegalServerId;
- boolean listOneServer = false;
- ServerDef serverDef;
-
- // determine if list single server or all servers
- listOneServer = (cmdArgs.length!=0) ;
- if ((cmdArgs.length == 2) && cmdArgs[0].equals("-serverid"))
- serverId = (Integer.valueOf(cmdArgs[1])).intValue();
-
- if ((serverId == illegalServerId) && listOneServer)
- return parseError;
-
- // process the list server command
- try {
- Repository repository = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
-
- if (listOneServer) {
-
- try {
- serverDef = repository.getServer(serverId);
- out.println();
- printServerDef(serverDef, serverId, out);
- out.println();
- } catch (ServerNotRegistered e) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- }
-
- } else {
- int[] servers = repository.listRegisteredServers();
- out.println(CorbaResourceUtil.getText("servertool.list2"));
-
- sortServers(servers);
- for (int i=0; i < servers.length; i++) {
- try {
- serverDef = repository.getServer(servers[i]);
- out.println("\t " + servers[i] + "\t\t" +
- serverDef.serverName + "\t\t"
- + serverDef.applicationName);
- } catch (ServerNotRegistered e) {}
- }
-
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-
-static void printServerDef(ServerDef serverDef, int serverId,
- PrintStream out)
-{
- out.println(CorbaResourceUtil.getText("servertool.appname", serverDef.applicationName));
- out.println(CorbaResourceUtil.getText("servertool.name", serverDef.serverName));
- out.println(CorbaResourceUtil.getText("servertool.classpath", serverDef.serverClassPath));
- out.println(CorbaResourceUtil.getText("servertool.args", serverDef.serverArgs));
- out.println(CorbaResourceUtil.getText("servertool.vmargs", serverDef.serverVmArgs));
- out.println(CorbaResourceUtil.getText("servertool.serverid", serverId));
-}
-
-/**
- * Do a simple bubble sort to sort the server ids in ascending
- * order.
- */
-static void sortServers(int[] serverIds)
-{
- int size = serverIds.length;
- int lowest;
-
- for (int i=0; i < size; i++) {
-
- lowest = i;
-
- for (int j=i+1; j < size; j++) {
- if (serverIds[j] < serverIds[lowest]) lowest = j;
- }
-
- if (lowest != i) {
- int temp = serverIds[i];
- serverIds[i] = serverIds[lowest];
- serverIds[lowest] = temp;
- }
- }
-}
-}
-
-class ListActiveServers implements CommandHandler
-{
- public String getCommandName() {return "listactive";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.listactive"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.listactive1"));
- }
- }
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- ServerDef serverDef;
-
- // process the list active servers command
- try {
- Repository repository = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
-
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
-
- int[] servers = activator.getActiveServers();
-
- out.println(CorbaResourceUtil.getText("servertool.list2"));
-
- ListServers.sortServers(servers);
- for (int i=0; i < servers.length; i++) {
- try {
- serverDef = repository.getServer(servers[i]);
- out.println("\t " + servers[i] + "\t\t" +
- serverDef.serverName + "\t\t" +
- serverDef.applicationName);
- } catch (ServerNotRegistered e) {}
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class ListAliases implements CommandHandler
-{
- public String getCommandName() {return "listappnames";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.listappnames"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.listappnames1"));
- }
- }
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- try {
- Repository repository = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
-
- String[] applicationNames = repository.getApplicationNames();
-
- out.println(CorbaResourceUtil.getText("servertool.listappnames2"));
- out.println();
- for (int i=0; i < applicationNames.length; i++)
- out.println( "\t" + applicationNames[i] ) ;
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class ShutdownServer implements CommandHandler
-{
- public String getCommandName() {return "shutdown";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.shutdown"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.shutdown1"));
- }
- }
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int serverId = illegalServerId;
-
- try {
- // determine the server id
- if (cmdArgs.length == 2)
- if (cmdArgs[0].equals("-serverid"))
- serverId = (Integer.valueOf(cmdArgs[1])).intValue();
- else if (cmdArgs[0].equals("-applicationName"))
- serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ;
-
- if (serverId == illegalServerId)
- return parseError;
-
- // shutdown the server
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
- activator.shutdown(serverId);
-
- out.println(CorbaResourceUtil.getText("servertool.shutdown2"));
- } catch (ServerNotActive ex) {
- out.println(CorbaResourceUtil.getText("servertool.servernotrunning"));
- } catch (ServerNotRegistered ex) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class StartServer implements CommandHandler
-{
- public String getCommandName() {return "startup";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.startserver"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.startserver1"));
- }
- }
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int serverId = illegalServerId;
-
- try {
- // determine the server id
- if (cmdArgs.length == 2)
- if (cmdArgs[0].equals("-serverid"))
- serverId = (Integer.valueOf(cmdArgs[1])).intValue();
- else if (cmdArgs[0].equals("-applicationName"))
- serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ;
-
- if (serverId == illegalServerId)
- return parseError;
-
- // startup the server
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
- activator.activate(serverId);
-
- out.println(CorbaResourceUtil.getText("servertool.startserver2"));
- } catch (ServerNotRegistered ex) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- } catch (ServerAlreadyActive ex) {
- out.println(CorbaResourceUtil.getText("servertool.serverup"));
- } catch (ServerHeldDown ex) {
- out.println(CorbaResourceUtil.getText("servertool.helddown"));
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return commandDone;
- }
-}
-
-class Quit implements CommandHandler
-{
- public String getCommandName() {return "quit";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.quit"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.quit1"));
- }
- }
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- System.exit(0);
-
- return commandDone;
- }
-}
-
-class Help implements CommandHandler
-{
- public String getCommandName() {return "help";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.help"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.help1"));
- }
- }
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- return commandDone;
- }
-}
-
-class ListORBs implements CommandHandler
-{
- public String getCommandName() {return "orblist";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.orbidmap"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.orbidmap1"));
- }
- }
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
-
- int serverId = illegalServerId;
-
- try {
- if (cmdArgs.length == 2) {
- if (cmdArgs[0].equals("-serverid"))
- serverId = (Integer.valueOf(cmdArgs[1])).intValue();
- else if (cmdArgs[0].equals("-applicationName"))
- serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ;
- }
-
- // the server id has to be specified
- if (serverId == illegalServerId)
- return parseError;
- // activate the server
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
-
- String[] orbList = activator.getORBNames(serverId);
-
- out.println(CorbaResourceUtil.getText("servertool.orbidmap2"));
-
- for (int i = 0; i < orbList.length ; i++) {
- out.println("\t "+ orbList[i]);
- }
- } catch (ServerNotRegistered ex) {
- out.println("\tno such server found.");
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/copyobject/CopierManagerImpl.java b/src/share/classes/com/sun/corba/se/impl/copyobject/CopierManagerImpl.java
deleted file mode 100644
index d55e13d..0000000
--- a/src/share/classes/com/sun/corba/se/impl/copyobject/CopierManagerImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.copyobject ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.impl.orbutil.DenseIntMapImpl ;
-
-import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
-import com.sun.corba.se.spi.copyobject.CopierManager ;
-import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
-
-public class CopierManagerImpl implements CopierManager
-{
- private int defaultId ;
- private DenseIntMapImpl map ;
- private ORB orb ;
-
- public CopierManagerImpl( ORB orb )
- {
- defaultId = 0 ;
- map = new DenseIntMapImpl() ;
- this.orb = orb ;
- }
-
- public void setDefaultId( int id )
- {
- defaultId = id ;
- }
-
- public int getDefaultId()
- {
- return defaultId ;
- }
-
- public ObjectCopierFactory getObjectCopierFactory( int id )
- {
- return (ObjectCopierFactory)(map.get( id )) ;
- }
-
- public ObjectCopierFactory getDefaultObjectCopierFactory()
- {
- return (ObjectCopierFactory)(map.get( defaultId )) ;
- }
-
- public void registerObjectCopierFactory( ObjectCopierFactory factory, int id )
- {
- map.set( id, factory ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/copyobject/FallbackObjectCopierImpl.java b/src/share/classes/com/sun/corba/se/impl/copyobject/FallbackObjectCopierImpl.java
deleted file mode 100644
index 0a5c30f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/copyobject/FallbackObjectCopierImpl.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.copyobject ;
-
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-import com.sun.corba.se.spi.copyobject.ReflectiveCopyException ;
-
-/** Trys a first ObjectCopier. If the first throws a ReflectiveCopyException,
- * falls back and tries a second ObjectCopier.
- */
-public class FallbackObjectCopierImpl implements ObjectCopier
-{
- private ObjectCopier first ;
- private ObjectCopier second ;
-
- public FallbackObjectCopierImpl( ObjectCopier first,
- ObjectCopier second )
- {
- this.first = first ;
- this.second = second ;
- }
-
- public Object copy( Object src ) throws ReflectiveCopyException
- {
- try {
- return first.copy( src ) ;
- } catch (ReflectiveCopyException rce ) {
- // XXX log this fallback at a low level
- return second.copy( src ) ;
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/copyobject/JavaStreamObjectCopierImpl.java b/src/share/classes/com/sun/corba/se/impl/copyobject/JavaStreamObjectCopierImpl.java
deleted file mode 100644
index 6b4118f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/copyobject/JavaStreamObjectCopierImpl.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-package com.sun.corba.se.impl.copyobject ;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import java.io.Serializable;
-import java.rmi.Remote;
-import java.rmi.MarshalException;
-
-import java.io.InputStream ;
-import java.io.OutputStream ;
-import java.io.ByteArrayInputStream ;
-import java.io.ByteArrayOutputStream ;
-import java.io.ObjectInputStream ;
-import java.io.ObjectOutputStream ;
-
-import org.omg.CORBA.ORB ;
-
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-import com.sun.corba.se.impl.util.Utility;
-
-public class JavaStreamObjectCopierImpl implements ObjectCopier {
-
- public JavaStreamObjectCopierImpl( ORB orb )
- {
- this.orb = orb ;
- }
-
- public Object copy(Object obj) {
- if (obj instanceof Remote) {
- // Yes, so make sure it is connected and converted
- // to a stub (if needed)...
- return Utility.autoConnect(obj,orb,true);
- }
-
- try {
- ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
- ObjectOutputStream oos = new ObjectOutputStream( os ) ;
- oos.writeObject( obj ) ;
-
- byte[] arr = os.toByteArray() ;
- InputStream is = new ByteArrayInputStream( arr ) ;
- ObjectInputStream ois = new ObjectInputStream( is ) ;
-
- return ois.readObject();
- } catch (Exception exc) {
- System.out.println( "Failed with exception:" + exc ) ;
- return null ;
- }
- }
-
- private ORB orb;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/copyobject/ORBStreamObjectCopierImpl.java b/src/share/classes/com/sun/corba/se/impl/copyobject/ORBStreamObjectCopierImpl.java
deleted file mode 100644
index d1526ba..0000000
--- a/src/share/classes/com/sun/corba/se/impl/copyobject/ORBStreamObjectCopierImpl.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.copyobject ;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import java.io.Serializable;
-import java.rmi.Remote;
-import java.rmi.MarshalException;
-
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-import org.omg.CORBA.ORB ;
-
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-import com.sun.corba.se.impl.util.Utility;
-
-public class ORBStreamObjectCopierImpl implements ObjectCopier {
-
- public ORBStreamObjectCopierImpl( ORB orb )
- {
- this.orb = orb ;
- }
-
- public Object copy(Object obj) {
- if (obj instanceof Remote) {
- // Yes, so make sure it is connected and converted
- // to a stub (if needed)...
- return Utility.autoConnect(obj,orb,true);
- }
-
- OutputStream out = (OutputStream)orb.create_output_stream();
- out.write_value((Serializable)obj);
- InputStream in = (InputStream)out.create_input_stream();
- return in.read_value();
- }
-
- private ORB orb;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/copyobject/ReferenceObjectCopierImpl.java b/src/share/classes/com/sun/corba/se/impl/copyobject/ReferenceObjectCopierImpl.java
deleted file mode 100644
index a1e5c83..0000000
--- a/src/share/classes/com/sun/corba/se/impl/copyobject/ReferenceObjectCopierImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.copyobject ;
-
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-
-public class ReferenceObjectCopierImpl implements ObjectCopier
-{
- public Object copy( Object obj )
- {
- return obj ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java
deleted file mode 100644
index 0f3428a..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java
+++ /dev/null
@@ -1,1351 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.List ;
-import java.util.ArrayList ;
-
-import org.omg.CORBA.Principal ;
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.CompletionStatus ;
-import org.omg.CORBA.TCKind ;
-
-import org.omg.CORBA.portable.Streamable;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orb.ORBVersionFactory;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.EncapsInputStream;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream;
-import com.sun.corba.se.impl.io.ValueUtility;
-import com.sun.corba.se.impl.orbutil.RepositoryIdFactory;
-import com.sun.corba.se.impl.orbutil.RepositoryIdStrings;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-// subclasses must provide a matching helper class
-public class AnyImpl extends Any
-{
- private static final class AnyInputStream extends EncapsInputStream
- {
- public AnyInputStream(EncapsInputStream theStream )
- {
- super( theStream );
- }
- }
-
- private static final class AnyOutputStream extends EncapsOutputStream
- {
- public AnyOutputStream(ORB orb)
- {
- super((ORB)orb);
- }
-
- public org.omg.CORBA.portable.InputStream create_input_stream() {
- final org.omg.CORBA.portable.InputStream is = super
- .create_input_stream();
- AnyInputStream aIS = AccessController
- .doPrivileged(new PrivilegedAction<AnyInputStream>() {
- @Override
- public AnyInputStream run() {
- return new AnyInputStream(
- (com.sun.corba.se.impl.encoding.EncapsInputStream) is);
- }
- });
- return aIS;
- }
- }
-
- //
- // Always valid.
- //
- private TypeCodeImpl typeCode;
- protected ORB orb;
- private ORBUtilSystemException wrapper ;
-
- //
- // Validity depends upon typecode. The 'value' and 'object' instance
- // members are used to hold immutable types as defined by the
- // isStreamed[] table below. Otherwise, 'stream' is non-null and
- // holds the value in CDR marshaled format. As an optimization, the
- // stream type is an Any extension of CDR stream that is used to
- // detect an optimization in read_value().
- //
- private CDRInputStream stream;
- private long value;
- private java.lang.Object object;
-
- // Setting the typecode via the type() accessor wipes out the value.
- // An attempt to extract before the value is set will result
- // in a BAD_OPERATION exception being raised.
- private boolean isInitialized = false;
-
- private static final int DEFAULT_BUFFER_SIZE = 32;
-
- /*
- * This boolean array tells us if a given typecode must be
- * streamed. Objects that are immutable don't have to be streamed.
- */
- static boolean isStreamed[] = {
- false, // null
- false, // void
- false, // short
- false, // long
- false, // ushort
- false, // ulong
- false, // float
- false, // double
- false, // boolean
- false, // char
- false, // octet
- false, // any
- false, // TypeCode
- true, // Principal
- false, // objref
- true, // struct
- true, // union
- false, // enum
- false, // string
- true, // sequence
- true, // array
- true, // alias
- true, // except
- false, // longlong
- false, // ulonglong
- false, // longdouble
- false, // wchar
- false, // wstring
- false, // fixed
- false, // value
- false, // value_box (used to be true)
- false, // native
- false // abstract interface
- };
-
- static AnyImpl convertToNative(ORB orb, Any any) {
- if (any instanceof AnyImpl) {
- return (AnyImpl)any;
- } else {
- AnyImpl anyImpl = new AnyImpl(orb, any);
- anyImpl.typeCode = TypeCodeImpl.convertToNative(orb, anyImpl.typeCode);
- return anyImpl;
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // Constructors
-
- /**
- * A constructor that sets the Any to contain a null. It also marks
- * the value as being invalid so that extractions throw an exception
- * until an insertion has been performed.
- */
- public AnyImpl(ORB orb)
- {
- this.orb = orb;
- wrapper = ORBUtilSystemException.get( (com.sun.corba.se.spi.orb.ORB)orb,
- CORBALogDomains.RPC_PRESENTATION ) ;
-
- typeCode = orb.get_primitive_tc(TCKind._tk_null);
- stream = null;
- object = null;
- value = 0;
- // null is a valid value
- isInitialized = true;
- }
-
- //
- // Create a new AnyImpl which is a copy of obj.
- //
- public AnyImpl(ORB orb, Any obj) {
- this(orb);
-
- if ((obj instanceof AnyImpl)) {
- AnyImpl objImpl = (AnyImpl)obj;
- typeCode = objImpl.typeCode;
- value = objImpl.value;
- object = objImpl.object;
- isInitialized = objImpl.isInitialized;
-
- if (objImpl.stream != null)
- stream = objImpl.stream.dup();
-
- } else {
- read_value(obj.create_input_stream(), obj.type());
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // basic accessors
-
- /**
- * returns the type of the element contained in the Any.
- *
- * @result the TypeCode for the element in the Any
- */
- public TypeCode type() {
- return typeCode;
- }
-
- private TypeCode realType() {
- return realType(typeCode);
- }
-
- private TypeCode realType(TypeCode aType) {
- TypeCode realType = aType;
- try {
- // Note: Indirect types are handled in kind() method
- while (realType.kind().value() == TCKind._tk_alias) {
- realType = realType.content_type();
- }
- } catch (BadKind bad) { // impossible
- throw wrapper.badkindCannotOccur( bad ) ;
- }
- return realType;
- }
-
- /**
- * sets the type of the element to be contained in the Any.
- *
- * @param tc the TypeCode for the element in the Any
- */
- public void type(TypeCode tc)
- {
- //debug.log ("type2");
- // set the typecode
- typeCode = TypeCodeImpl.convertToNative(orb, tc);
-
- stream = null;
- value = 0;
- object = null;
- // null is the only legal value this Any can have after resetting the type code
- isInitialized = (tc.kind().value() == TCKind._tk_null);
- }
-
- /**
- * checks for equality between Anys.
- *
- * @param otherAny the Any to be compared with.
- * @result true if the Anys are equal, false otherwise.
- */
- public boolean equal(Any otherAny)
- {
- //debug.log ("equal");
-
- if (otherAny == this)
- return true;
-
- // first check for typecode equality.
- // note that this will take aliases into account
- if (!typeCode.equal(otherAny.type()))
- return false;
-
- // Resolve aliases here
- TypeCode realType = realType();
-
- // _REVISIT_ Possible optimization for the case where
- // otherAny is a AnyImpl and the endianesses match.
- // Need implementation of CDRInputStream.equals()
- // For now we disable this to encourage testing the generic,
- // unoptimized code below.
- // Unfortunately this generic code needs to copy the whole stream
- // at least once.
- // if (AnyImpl.isStreamed[realType.kind().value()]) {
- // if (otherAny instanceof AnyImpl) {
- // return ((AnyImpl)otherAny).stream.equals(stream);
- // }
- // }
- switch (realType.kind().value()) {
- // handle primitive types
- case TCKind._tk_null:
- case TCKind._tk_void:
- return true;
- case TCKind._tk_short:
- return (extract_short() == otherAny.extract_short());
- case TCKind._tk_long:
- return (extract_long() == otherAny.extract_long());
- case TCKind._tk_ushort:
- return (extract_ushort() == otherAny.extract_ushort());
- case TCKind._tk_ulong:
- return (extract_ulong() == otherAny.extract_ulong());
- case TCKind._tk_float:
- return (extract_float() == otherAny.extract_float());
- case TCKind._tk_double:
- return (extract_double() == otherAny.extract_double());
- case TCKind._tk_boolean:
- return (extract_boolean() == otherAny.extract_boolean());
- case TCKind._tk_char:
- return (extract_char() == otherAny.extract_char());
- case TCKind._tk_wchar:
- return (extract_wchar() == otherAny.extract_wchar());
- case TCKind._tk_octet:
- return (extract_octet() == otherAny.extract_octet());
- case TCKind._tk_any:
- return extract_any().equal(otherAny.extract_any());
- case TCKind._tk_TypeCode:
- return extract_TypeCode().equal(otherAny.extract_TypeCode());
- case TCKind._tk_string:
- return extract_string().equals(otherAny.extract_string());
- case TCKind._tk_wstring:
- return (extract_wstring().equals(otherAny.extract_wstring()));
- case TCKind._tk_longlong:
- return (extract_longlong() == otherAny.extract_longlong());
- case TCKind._tk_ulonglong:
- return (extract_ulonglong() == otherAny.extract_ulonglong());
-
- case TCKind._tk_objref:
- return (extract_Object().equals(otherAny.extract_Object()));
- case TCKind._tk_Principal:
- return (extract_Principal().equals(otherAny.extract_Principal()));
-
- case TCKind._tk_enum:
- return (extract_long() == otherAny.extract_long());
- case TCKind._tk_fixed:
- return (extract_fixed().compareTo(otherAny.extract_fixed()) == 0);
- case TCKind._tk_except:
- case TCKind._tk_struct:
- case TCKind._tk_union:
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- InputStream copyOfMyStream = this.create_input_stream();
- InputStream copyOfOtherStream = otherAny.create_input_stream();
- return equalMember(realType, copyOfMyStream, copyOfOtherStream);
-
- // Too complicated to handle value types the way we handle
- // other complex types above. Don't try to decompose it here
- // for faster comparison, just use Object.equals().
- case TCKind._tk_value:
- case TCKind._tk_value_box:
- return extract_Value().equals(otherAny.extract_Value());
-
- case TCKind._tk_alias:
- throw wrapper.errorResolvingAlias() ;
-
- case TCKind._tk_longdouble:
- // Unspecified for Java
- throw wrapper.tkLongDoubleNotSupported() ;
-
- default:
- throw wrapper.typecodeNotSupported() ;
- }
- }
-
- // Needed for equal() in order to achieve linear performance for complex types.
- // Uses up (recursively) copies of the InputStream in both Anys that got created in equal().
- private boolean equalMember(TypeCode memberType, InputStream myStream, InputStream otherStream) {
- // Resolve aliases here
- TypeCode realType = realType(memberType);
-
- try {
- switch (realType.kind().value()) {
- // handle primitive types
- case TCKind._tk_null:
- case TCKind._tk_void:
- return true;
- case TCKind._tk_short:
- return (myStream.read_short() == otherStream.read_short());
- case TCKind._tk_long:
- return (myStream.read_long() == otherStream.read_long());
- case TCKind._tk_ushort:
- return (myStream.read_ushort() == otherStream.read_ushort());
- case TCKind._tk_ulong:
- return (myStream.read_ulong() == otherStream.read_ulong());
- case TCKind._tk_float:
- return (myStream.read_float() == otherStream.read_float());
- case TCKind._tk_double:
- return (myStream.read_double() == otherStream.read_double());
- case TCKind._tk_boolean:
- return (myStream.read_boolean() == otherStream.read_boolean());
- case TCKind._tk_char:
- return (myStream.read_char() == otherStream.read_char());
- case TCKind._tk_wchar:
- return (myStream.read_wchar() == otherStream.read_wchar());
- case TCKind._tk_octet:
- return (myStream.read_octet() == otherStream.read_octet());
- case TCKind._tk_any:
- return myStream.read_any().equal(otherStream.read_any());
- case TCKind._tk_TypeCode:
- return myStream.read_TypeCode().equal(otherStream.read_TypeCode());
- case TCKind._tk_string:
- return myStream.read_string().equals(otherStream.read_string());
- case TCKind._tk_wstring:
- return (myStream.read_wstring().equals(otherStream.read_wstring()));
- case TCKind._tk_longlong:
- return (myStream.read_longlong() == otherStream.read_longlong());
- case TCKind._tk_ulonglong:
- return (myStream.read_ulonglong() == otherStream.read_ulonglong());
-
- case TCKind._tk_objref:
- return (myStream.read_Object().equals(otherStream.read_Object()));
- case TCKind._tk_Principal:
- return (myStream.read_Principal().equals(otherStream.read_Principal()));
-
- case TCKind._tk_enum:
- return (myStream.read_long() == otherStream.read_long());
- case TCKind._tk_fixed:
- return (myStream.read_fixed().compareTo(otherStream.read_fixed()) == 0);
- case TCKind._tk_except:
- case TCKind._tk_struct: {
- int length = realType.member_count();
- for (int i=0; i<length; i++) {
- if ( ! equalMember(realType.member_type(i), myStream, otherStream)) {
- return false;
- }
- }
- return true;
- }
- case TCKind._tk_union: {
- Any myDiscriminator = orb.create_any();
- Any otherDiscriminator = orb.create_any();
- myDiscriminator.read_value(myStream, realType.discriminator_type());
- otherDiscriminator.read_value(otherStream, realType.discriminator_type());
-
- if ( ! myDiscriminator.equal(otherDiscriminator)) {
- return false;
- }
- TypeCodeImpl realTypeCodeImpl = TypeCodeImpl.convertToNative(orb, realType);
- int memberIndex = realTypeCodeImpl.currentUnionMemberIndex(myDiscriminator);
- if (memberIndex == -1)
- throw wrapper.unionDiscriminatorError() ;
-
- if ( ! equalMember(realType.member_type(memberIndex), myStream, otherStream)) {
- return false;
- }
- return true;
- }
- case TCKind._tk_sequence: {
- int length = myStream.read_long();
- otherStream.read_long(); // just so that the two stream are in sync
- for (int i=0; i<length; i++) {
- if ( ! equalMember(realType.content_type(), myStream, otherStream)) {
- return false;
- }
- }
- return true;
- }
- case TCKind._tk_array: {
- int length = realType.member_count();
- for (int i=0; i<length; i++) {
- if ( ! equalMember(realType.content_type(), myStream, otherStream)) {
- return false;
- }
- }
- return true;
- }
-
- // Too complicated to handle value types the way we handle
- // other complex types above. Don't try to decompose it here
- // for faster comparison, just use Object.equals().
- case TCKind._tk_value:
- case TCKind._tk_value_box:
- org.omg.CORBA_2_3.portable.InputStream mine =
- (org.omg.CORBA_2_3.portable.InputStream)myStream;
- org.omg.CORBA_2_3.portable.InputStream other =
- (org.omg.CORBA_2_3.portable.InputStream)otherStream;
- return mine.read_value().equals(other.read_value());
-
- case TCKind._tk_alias:
- // error resolving alias above
- throw wrapper.errorResolvingAlias() ;
-
- case TCKind._tk_longdouble:
- throw wrapper.tkLongDoubleNotSupported() ;
-
- default:
- throw wrapper.typecodeNotSupported() ;
- }
- } catch (BadKind badKind) { // impossible
- throw wrapper.badkindCannotOccur() ;
- } catch (Bounds bounds) { // impossible
- throw wrapper.boundsCannotOccur() ;
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // accessors for marshaling/unmarshaling
-
- /**
- * returns an output stream that an Any value can be marshaled into.
- *
- * @result the OutputStream to marshal value of Any into
- */
- public org.omg.CORBA.portable.OutputStream create_output_stream()
- {
- //debug.log ("create_output_stream");
- final ORB finalorb = this.orb;
- return AccessController.doPrivileged(new PrivilegedAction<AnyOutputStream>() {
- @Override
- public AnyOutputStream run() {
- return new AnyOutputStream(finalorb);
- }
- });
- }
-
- /**
- * returns an input stream that an Any value can be marshaled out of.
- *
- * @result the InputStream to marshal value of Any out of.
- */
- public org.omg.CORBA.portable.InputStream create_input_stream()
- {
- //
- // We create a new InputStream so that multiple threads can call here
- // and read the streams in parallel without thread safety problems.
- //
- //debug.log ("create_input_stream");
- if (AnyImpl.isStreamed[realType().kind().value()]) {
- return stream.dup();
- } else {
- OutputStream os = (OutputStream)orb.create_output_stream();
- TCUtility.marshalIn(os, realType(), value, object);
-
- return os.create_input_stream();
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // marshaling/unmarshaling routines
-
- //
- // If the InputStream is a CDRInputStream then we can copy the bytes
- // since it is in our format and does not have alignment issues.
- //
- public void read_value(org.omg.CORBA.portable.InputStream in, TypeCode tc)
- {
- //debug.log ("read_value");
- //
- // Assume that someone isn't going to think they can keep reading
- // from this stream after calling us. That would be likely for
- // an IIOPInputStream but if it is an AnyInputStream then they
- // presumably obtained it via our create_output_stream() so they could
- // write the contents of an IDL data type to it and then call
- // create_input_stream() for us to read it. This is how Helper classes
- // typically implement the insert() method.
- // We should probably document this behavior in the 1.1 revision
- // task force.
- //
-
- typeCode = TypeCodeImpl.convertToNative(orb, tc);
- int kind = realType().kind().value();
- if (kind >= isStreamed.length) {
- throw wrapper.invalidIsstreamedTckind( CompletionStatus.COMPLETED_MAYBE,
- new Integer(kind)) ;
- }
-
- if (AnyImpl.isStreamed[kind]) {
- if ( in instanceof AnyInputStream ) {
- // could only have been created here
- stream = (CDRInputStream)in;
- } else {
- org.omg.CORBA_2_3.portable.OutputStream out =
- (org.omg.CORBA_2_3.portable.OutputStream)orb.create_output_stream();
- typeCode.copy((org.omg.CORBA_2_3.portable.InputStream)in, out);
- stream = (CDRInputStream)out.create_input_stream();
- }
- } else {
- java.lang.Object[] objholder = new java.lang.Object[1];
- objholder[0] = object;
- long[] longholder = new long[1];
- TCUtility.unmarshalIn(in, realType(), longholder, objholder);
- value = longholder[0];
- object = objholder[0];
- stream = null;
- }
- isInitialized = true;
- }
-
-
- //
- // We could optimize this by noticing whether the target stream
- // has ever had anything marshaled on it that required an
- // alignment of greater than 4 (was write_double() ever called on it).
- // If not, then we can just do a byte array copy without having to
- // drive the remarshaling through typecode interpretation.
- //
- public void write_value(OutputStream out)
- {
- //debug.log ("write_value");
- if (AnyImpl.isStreamed[realType().kind().value()]) {
- typeCode.copy(stream.dup(), out);
- } else {
- // _REVISIT_ check isInitialized whether all we write is TypeCode!
- TCUtility.marshalIn(out, realType(), value, object);
- }
- }
-
- /**
- * takes a streamable and inserts its reference into the any
- *
- * @param s the streamable to insert
- */
- public void insert_Streamable(Streamable s)
- {
- //debug.log ("insert_Streamable");
- typeCode = TypeCodeImpl.convertToNative(orb, s._type());
- object = s;
- isInitialized = true;
- }
-
- public Streamable extract_Streamable()
- {
- //debug.log( "extract_Streamable" ) ;
- return (Streamable)object;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // insertion/extraction/replacement for all basic types
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_short(short s)
- {
- //debug.log ("insert_short");
- typeCode = orb.get_primitive_tc(TCKind._tk_short);
- value = s;
- isInitialized = true;
- }
-
- private String getTCKindName( int tc )
- {
- if ((tc >= 0) && (tc < TypeCodeImpl.kindNames.length))
- return TypeCodeImpl.kindNames[tc] ;
- else
- return "UNKNOWN(" + tc + ")" ;
- }
-
- private void checkExtractBadOperation( int expected )
- {
- if (!isInitialized)
- throw wrapper.extractNotInitialized() ;
-
- int tc = realType().kind().value() ;
- if (tc != expected) {
- String tcName = getTCKindName( tc ) ;
- String expectedName = getTCKindName( expected ) ;
- throw wrapper.extractWrongType( expectedName, tcName ) ;
- }
- }
-
- private void checkExtractBadOperationList( int[] expected )
- {
- if (!isInitialized)
- throw wrapper.extractNotInitialized() ;
-
- int tc = realType().kind().value() ;
- for (int ctr=0; ctr<expected.length; ctr++)
- if (tc == expected[ctr])
- return ;
-
- List list = new ArrayList() ;
- for (int ctr=0; ctr<expected.length; ctr++)
- list.add( getTCKindName( expected[ctr] ) ) ;
-
- String tcName = getTCKindName( tc ) ;
- throw wrapper.extractWrongTypeList( list, tcName ) ;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public short extract_short()
- {
- //debug.log ("extract_short");
- checkExtractBadOperation( TCKind._tk_short ) ;
- return (short)value;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_long(int l)
- {
- //debug.log ("insert_long");
- // A long value is applicable to enums as well, so don't erase the enum type code
- // in case it was initialized that way before.
- int kind = realType().kind().value();
- if (kind != TCKind._tk_long && kind != TCKind._tk_enum) {
- typeCode = orb.get_primitive_tc(TCKind._tk_long);
- }
- value = l;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public int extract_long()
- {
- //debug.log ("extract_long");
- checkExtractBadOperationList( new int[] { TCKind._tk_long, TCKind._tk_enum } ) ;
- return (int)value;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_ushort(short s)
- {
- //debug.log ("insert_ushort");
- typeCode = orb.get_primitive_tc(TCKind._tk_ushort);
- value = s;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public short extract_ushort()
- {
- //debug.log ("extract_ushort");
- checkExtractBadOperation( TCKind._tk_ushort ) ;
- return (short)value;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_ulong(int l)
- {
- //debug.log ("insert_ulong");
- typeCode = orb.get_primitive_tc(TCKind._tk_ulong);
- value = l;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public int extract_ulong()
- {
- //debug.log ("extract_ulong");
- checkExtractBadOperation( TCKind._tk_ulong ) ;
- return (int)value;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_float(float f)
- {
- //debug.log ("insert_float");
- typeCode = orb.get_primitive_tc(TCKind._tk_float);
- value = Float.floatToIntBits(f);
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public float extract_float()
- {
- //debug.log ("extract_float");
- checkExtractBadOperation( TCKind._tk_float ) ;
- return Float.intBitsToFloat((int)value);
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_double(double d)
- {
- //debug.log ("insert_double");
- typeCode = orb.get_primitive_tc(TCKind._tk_double);
- value = Double.doubleToLongBits(d);
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public double extract_double()
- {
- //debug.log ("extract_double");
- checkExtractBadOperation( TCKind._tk_double ) ;
- return Double.longBitsToDouble(value);
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_longlong(long l)
- {
- //debug.log ("insert_longlong");
- typeCode = orb.get_primitive_tc(TCKind._tk_longlong);
- value = l;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public long extract_longlong()
- {
- //debug.log ("extract_longlong");
- checkExtractBadOperation( TCKind._tk_longlong ) ;
- return value;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_ulonglong(long l)
- {
- //debug.log ("insert_ulonglong");
- typeCode = orb.get_primitive_tc(TCKind._tk_ulonglong);
- value = l;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public long extract_ulonglong()
- {
- //debug.log ("extract_ulonglong");
- checkExtractBadOperation( TCKind._tk_ulonglong ) ;
- return value;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_boolean(boolean b)
- {
- //debug.log ("insert_boolean");
- typeCode = orb.get_primitive_tc(TCKind._tk_boolean);
- value = (b)? 1:0;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public boolean extract_boolean()
- {
- //debug.log ("extract_boolean");
- checkExtractBadOperation( TCKind._tk_boolean ) ;
- return (value == 0)? false: true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_char(char c)
- {
- //debug.log ("insert_char");
- typeCode = orb.get_primitive_tc(TCKind._tk_char);
- value = c;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public char extract_char()
- {
- //debug.log ("extract_char");
- checkExtractBadOperation( TCKind._tk_char ) ;
- return (char)value;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_wchar(char c)
- {
- //debug.log ("insert_wchar");
- typeCode = orb.get_primitive_tc(TCKind._tk_wchar);
- value = c;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public char extract_wchar()
- {
- //debug.log ("extract_wchar");
- checkExtractBadOperation( TCKind._tk_wchar ) ;
- return (char)value;
- }
-
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_octet(byte b)
- {
- //debug.log ("insert_octet");
- typeCode = orb.get_primitive_tc(TCKind._tk_octet);
- value = b;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public byte extract_octet()
- {
- //debug.log ("extract_octet");
- checkExtractBadOperation( TCKind._tk_octet ) ;
- return (byte)value;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_string(String s)
- {
- //debug.log ("insert_string");
- // Make sure type code information for bounded strings is not erased
- if (typeCode.kind() == TCKind.tk_string) {
- int length = 0;
- try {
- length = typeCode.length();
- } catch (BadKind bad) {
- throw wrapper.badkindCannotOccur() ;
- }
-
- // Check if bounded strings length is not exceeded
- if (length != 0 && s != null && s.length() > length) {
- throw wrapper.badStringBounds( new Integer(s.length()),
- new Integer(length) ) ;
- }
- } else {
- typeCode = orb.get_primitive_tc(TCKind._tk_string);
- }
- object = s;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public String extract_string()
- {
- //debug.log ("extract_string");
- checkExtractBadOperation( TCKind._tk_string ) ;
- return (String)object;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_wstring(String s)
- {
- //debug.log ("insert_wstring");
- // Make sure type code information for bounded strings is not erased
- if (typeCode.kind() == TCKind.tk_wstring) {
- int length = 0;
- try {
- length = typeCode.length();
- } catch (BadKind bad) {
- throw wrapper.badkindCannotOccur() ;
- }
-
- // Check if bounded strings length is not exceeded
- if (length != 0 && s != null && s.length() > length) {
- throw wrapper.badStringBounds( new Integer(s.length()),
- new Integer(length) ) ;
- }
- } else {
- typeCode = orb.get_primitive_tc(TCKind._tk_wstring);
- }
- object = s;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public String extract_wstring()
- {
- //debug.log ("extract_wstring");
- checkExtractBadOperation( TCKind._tk_wstring ) ;
- return (String)object;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_any(Any a)
- {
- //debug.log ("insert_any");
- typeCode = orb.get_primitive_tc(TCKind._tk_any);
- object = a;
- stream = null;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public Any extract_any()
- {
- //debug.log ("extract_any");
- checkExtractBadOperation( TCKind._tk_any ) ;
- return (Any)object;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_Object(org.omg.CORBA.Object o)
- {
- //debug.log ("insert_Object");
- if ( o == null ) {
- typeCode = orb.get_primitive_tc(TCKind._tk_objref);
- } else {
- if (StubAdapter.isStub(o)) {
- String[] ids = StubAdapter.getTypeIds( o ) ;
- typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], "");
- } else {
- throw wrapper.badInsertobjParam(
- CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ;
- }
- }
-
- object = o;
- isInitialized = true;
- }
-
- /**
- * A variant of the insertion operation that takes a typecode
- * argument as well.
- */
- public void insert_Object(org.omg.CORBA.Object o, TypeCode tc)
- {
- //debug.log ("insert_Object2");
- try {
- if ( tc.id().equals("IDL:omg.org/CORBA/Object:1.0") || o._is_a(tc.id()) )
- {
- typeCode = TypeCodeImpl.convertToNative(orb, tc);
- object = o;
- }
- else {
- throw wrapper.insertObjectIncompatible() ;
- }
- } catch ( Exception ex ) {
- throw wrapper.insertObjectFailed(ex) ;
- }
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public org.omg.CORBA.Object extract_Object()
- {
- //debug.log ("extract_Object");
- if (!isInitialized)
- throw wrapper.extractNotInitialized() ;
-
- // Check if the object contained here is of the type in typeCode
- org.omg.CORBA.Object obj = null;
- try {
- obj = (org.omg.CORBA.Object) object;
- if (typeCode.id().equals("IDL:omg.org/CORBA/Object:1.0") || obj._is_a(typeCode.id())) {
- return obj;
- } else {
- throw wrapper.extractObjectIncompatible() ;
- }
- } catch ( Exception ex ) {
- throw wrapper.extractObjectFailed(ex);
- }
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public void insert_TypeCode(TypeCode tc)
- {
- //debug.log ("insert_TypeCode");
- typeCode = orb.get_primitive_tc(TCKind._tk_TypeCode);
- object = tc;
- isInitialized = true;
- }
-
- /**
- * See the description of the <a href="#anyOps">general Any operations.</a>
- */
- public TypeCode extract_TypeCode()
- {
- //debug.log ("extract_TypeCode");
- checkExtractBadOperation( TCKind._tk_TypeCode ) ;
- return (TypeCode)object;
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public void insert_Principal(Principal p)
- {
- typeCode = orb.get_primitive_tc(TCKind._tk_Principal);
- object = p;
- isInitialized = true;
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public Principal extract_Principal()
- {
- checkExtractBadOperation( TCKind._tk_Principal ) ;
- return (Principal)object;
- }
-
- /**
- * Note that the Serializable really should be an IDLEntity of
- * some kind. It shouldn't just be an RMI-IIOP type. Currently,
- * we accept and will produce RMI repIds with the latest
- * calculations if given a non-IDLEntity Serializable.
- */
- public Serializable extract_Value()
- {
- //debug.log ("extract_Value");
- checkExtractBadOperationList( new int[] { TCKind._tk_value,
- TCKind._tk_value_box, TCKind._tk_abstract_interface } ) ;
- return (Serializable)object;
- }
-
- public void insert_Value(Serializable v)
- {
- //debug.log ("insert_Value");
- object = v;
-
- TypeCode tc;
-
- if ( v == null ) {
- tc = orb.get_primitive_tc (TCKind.tk_value);
- } else {
- // See note in getPrimitiveTypeCodeForClass. We
- // have to use the latest type code fixes in this
- // case since there is no way to know what ORB will
- // actually send this Any. In RMI-IIOP, when using
- // Util.writeAny, we can do the versioning correctly,
- // and use the insert_Value(Serializable, TypeCode)
- // method.
- //
- // The ORB singleton uses the latest version.
- tc = createTypeCodeForClass (v.getClass(), (ORB)ORB.init());
- }
-
- typeCode = TypeCodeImpl.convertToNative(orb, tc);
- isInitialized = true;
- }
-
- public void insert_Value(Serializable v, org.omg.CORBA.TypeCode t)
- {
- //debug.log ("insert_Value2");
- object = v;
- typeCode = TypeCodeImpl.convertToNative(orb, t);
- isInitialized = true;
- }
-
- public void insert_fixed(java.math.BigDecimal value) {
- typeCode = TypeCodeImpl.convertToNative(orb,
- orb.create_fixed_tc(TypeCodeImpl.digits(value), TypeCodeImpl.scale(value)));
- object = value;
- isInitialized = true;
- }
-
- public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type)
- {
- try {
- if (TypeCodeImpl.digits(value) > type.fixed_digits() ||
- TypeCodeImpl.scale(value) > type.fixed_scale())
- {
- throw wrapper.fixedNotMatch() ;
- }
- } catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
- // type isn't even of kind fixed
- throw wrapper.fixedBadTypecode( bk ) ;
- }
- typeCode = TypeCodeImpl.convertToNative(orb, type);
- object = value;
- isInitialized = true;
- }
-
- public java.math.BigDecimal extract_fixed() {
- checkExtractBadOperation( TCKind._tk_fixed ) ;
- return (BigDecimal)object;
- }
-
- /**
- * Utility method for insert_Value and Util.writeAny.
- *
- * The ORB passed in should have the desired ORBVersion. It
- * is used to generate the type codes.
- */
- public TypeCode createTypeCodeForClass (java.lang.Class c, ORB tcORB)
- {
- // Look in the cache first
- TypeCodeImpl classTC = tcORB.getTypeCodeForClass(c);
- if (classTC != null)
- return classTC;
-
- // All cases need to be able to create repository IDs.
- //
- // See bug 4391648 for more info about the tcORB in this
- // case.
- RepositoryIdStrings repStrs
- = RepositoryIdFactory.getRepIdStringsFactory();
-
-
- // Assertion: c instanceof Serializable?
-
- if ( c.isArray() ) {
- // Arrays - may recurse for multi-dimensional arrays
- Class componentClass = c.getComponentType();
- TypeCode embeddedType;
- if ( componentClass.isPrimitive() ) {
- embeddedType = getPrimitiveTypeCodeForClass(componentClass,
- tcORB);
- } else {
- embeddedType = createTypeCodeForClass (componentClass,
- tcORB);
- }
- TypeCode t = tcORB.create_sequence_tc (0, embeddedType);
-
- String id = repStrs.createForJavaType(c);
-
- return tcORB.create_value_box_tc (id, "Sequence", t);
- } else if ( c == java.lang.String.class ) {
- // Strings
- TypeCode t = tcORB.create_string_tc (0);
-
- String id = repStrs.createForJavaType(c);
-
- return tcORB.create_value_box_tc (id, "StringValue", t);
- }
-
- // Anything else
- // We know that this is a TypeCodeImpl since it is our ORB
- classTC = (TypeCodeImpl)ValueUtility.createTypeCodeForClass(
- tcORB, c, ORBUtility.createValueHandler());
- // Intruct classTC to store its buffer
- classTC.setCaching(true);
- // Update the cache
- tcORB.setTypeCodeForClass(c, classTC);
- return classTC;
- }
-
- /**
- * It looks like this was copied from io.ValueUtility at some
- * point.
- *
- * It's used by createTypeCodeForClass. The tcORB passed in
- * should have the desired ORB version, and is used to
- * create the type codes.
- */
- private TypeCode getPrimitiveTypeCodeForClass (Class c, ORB tcORB)
- {
- //debug.log ("getPrimitiveTypeCodeForClass");
-
- if (c == Integer.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_long);
- } else if (c == Byte.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_octet);
- } else if (c == Long.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_longlong);
- } else if (c == Float.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_float);
- } else if (c == Double.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_double);
- } else if (c == Short.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_short);
- } else if (c == Character.TYPE) {
- // For Merlin or later JDKs, or for foreign ORBs,
- // we correctly say that a Java char maps to a
- // CORBA wchar. For backwards compatibility
- // with our older ORBs, we say it maps to a
- // CORBA char. This is only used in RMI-IIOP
- // in our javax.rmi.CORBA.Util delegate's
- // writeAny method. In Java IDL, there's no way
- // to know the ORB version that the Any will be
- // sent out with -- it could be different than
- // the one used to create the Any -- so we use the
- // most recent version (see insert_Value).
- if (ORBVersionFactory.getFOREIGN().compareTo(tcORB.getORBVersion()) == 0 ||
- ORBVersionFactory.getNEWER().compareTo(tcORB.getORBVersion()) <= 0)
- return tcORB.get_primitive_tc(TCKind.tk_wchar);
- else
- return tcORB.get_primitive_tc(TCKind.tk_char);
- } else if (c == Boolean.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_boolean);
- } else {
- // _REVISIT_ Not sure if this is right.
- return tcORB.get_primitive_tc (TCKind.tk_any);
- }
- }
-
- // Extracts a member value according to the given TypeCode from the given complex Any
- // (at the Anys current internal stream position, consuming the anys stream on the way)
- // and returns it wrapped into a new Any
- public Any extractAny(TypeCode memberType, ORB orb) {
- Any returnValue = orb.create_any();
- OutputStream out = returnValue.create_output_stream();
- TypeCodeImpl.convertToNative(orb, memberType).copy((InputStream)stream, out);
- returnValue.read_value(out.create_input_stream(), memberType);
- return returnValue;
- }
-
- // This method could very well be moved into TypeCodeImpl or a common utility class,
- // but is has to be in this package.
- static public Any extractAnyFromStream(TypeCode memberType, InputStream input, ORB orb) {
- Any returnValue = orb.create_any();
- OutputStream out = returnValue.create_output_stream();
- TypeCodeImpl.convertToNative(orb, memberType).copy(input, out);
- returnValue.read_value(out.create_input_stream(), memberType);
- return returnValue;
- }
-
- // There is no other way for DynAnys to find out whether the Any is initialized.
- public boolean isInitialized() {
- return isInitialized;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/AnyImplHelper.java b/src/share/classes/com/sun/corba/se/impl/corba/AnyImplHelper.java
deleted file mode 100644
index 06668c3..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/AnyImplHelper.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1999, 2002, 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.
- */
-/*
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-abstract public class AnyImplHelper
-{
- private static String _id = "IDL:omg.org/CORBA/Any:1.0";
-
- public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Any that)
- {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
- a.type (type ());
- write (out, that);
- a.read_value (out.create_input_stream (), type ());
- }
-
- public static org.omg.CORBA.Any extract (org.omg.CORBA.Any a)
- {
- return read (a.create_input_stream ());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- synchronized public static org.omg.CORBA.TypeCode type ()
- {
- if (__typeCode == null)
- {
- __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any);
- }
- return __typeCode;
- }
-
- public static String id ()
- {
- return _id;
- }
-
- public static org.omg.CORBA.Any read (org.omg.CORBA.portable.InputStream istream)
- {
- return istream.read_any ();
- }
-
- public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Any value)
- {
- ostream.write_any (value);
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/AsynchInvoke.java b/src/share/classes/com/sun/corba/se/impl/corba/AsynchInvoke.java
deleted file mode 100644
index 59adaef..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/AsynchInvoke.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-///////////////////////////////////////////////////////////////////////////
-// helper class for deferred invocations
-
-/*
- * The AsynchInvoke class allows for the support of asynchronous
- * invocations. Instances of these are created with a request object,
- * and when run, perform an invocation. The instance is also
- * responsible for waking up a client that might be waiting on the
- * 'get_response' method.
- */
-
-public class AsynchInvoke implements Runnable {
-
- private RequestImpl _req;
- private ORB _orb;
- private boolean _notifyORB;
-
- public AsynchInvoke (ORB o, RequestImpl reqToInvokeOn, boolean n)
- {
- _orb = o;
- _req = reqToInvokeOn;
- _notifyORB = n;
- };
-
-
- /*
- * The run operation calls the invocation on the request object,
- * updates the RequestImpl state to indicate that the asynchronous
- * invocation is complete, and wakes up any client that might be
- * waiting on a 'get_response' call.
- *
- */
-
- public void run()
- {
- // do the actual invocation
- _req.doInvocation();
-
- // for the asynchronous case, note that the response has been
- // received.
- synchronized (_req)
- {
- // update local boolean indicator
- _req.gotResponse = true;
-
- // notify any client waiting on a 'get_response'
- _req.notify();
- }
-
- if (_notifyORB == true) {
- _orb.notifyORB() ;
- }
- }
-
-};
-
-///////////////////////////////////////////////////////////////////////////
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/CORBAObjectImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/CORBAObjectImpl.java
deleted file mode 100644
index fc02f8c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/CORBAObjectImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1997, 2002, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-//
-// Bare implementation of CORBA Object.
-//
-public class CORBAObjectImpl extends org.omg.CORBA_2_3.portable.ObjectImpl {
- public String[] _ids() {
- String[] typeids = new String[1];
- typeids[0] = "IDL:omg.org/CORBA/Object:1.0";
- return typeids;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/ContextImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/ContextImpl.java
deleted file mode 100644
index 4856a13..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/ContextImpl.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.NVList;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public final class ContextImpl extends Context {
-
- private org.omg.CORBA.ORB _orb;
- private ORBUtilSystemException wrapper ;
-
- public ContextImpl(org.omg.CORBA.ORB orb)
- {
- _orb = orb;
- wrapper = ORBUtilSystemException.get(
- (com.sun.corba.se.spi.orb.ORB)orb,
- CORBALogDomains.RPC_PRESENTATION ) ;
- }
-
- public ContextImpl(Context parent)
- {
- throw wrapper.contextNotImplemented() ;
- }
-
- public String context_name()
- {
- throw wrapper.contextNotImplemented() ;
- }
-
- public Context parent()
- {
- throw wrapper.contextNotImplemented() ;
- }
-
- public Context create_child(String name)
- {
- throw wrapper.contextNotImplemented() ;
- }
-
- public void set_one_value(String propName, Any propValue)
- {
- throw wrapper.contextNotImplemented() ;
- }
-
- public void set_values(NVList values)
- {
- throw wrapper.contextNotImplemented() ;
- }
-
-
- public void delete_values(String propName)
- {
- throw wrapper.contextNotImplemented() ;
- }
-
- public NVList get_values(String startScope,
- int opFlags,
- String propName)
- {
- throw wrapper.contextNotImplemented() ;
- }
-};
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/ContextListImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/ContextListImpl.java
deleted file mode 100644
index 23a5b6f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/ContextListImpl.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 1996, 2002, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import java.util.Vector;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.Bounds;
-import org.omg.CORBA.ORB;
-
-public class ContextListImpl extends ContextList
-{
- private final int INITIAL_CAPACITY = 2;
- private final int CAPACITY_INCREMENT = 2;
-
- private org.omg.CORBA.ORB _orb;
- private Vector _contexts;
-
- public ContextListImpl(org.omg.CORBA.ORB orb)
- {
- // Note: This orb could be an instanceof ORBSingleton or ORB
- _orb = orb;
- _contexts = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT);
- }
-
- public int count()
- {
- return _contexts.size();
- }
-
- public void add(String ctxt)
- {
- _contexts.addElement(ctxt);
- }
-
- public String item(int index)
- throws Bounds
- {
- try {
- return (String) _contexts.elementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new Bounds();
- }
- }
-
- public void remove(int index)
- throws Bounds
- {
- try {
- _contexts.removeElementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new Bounds();
- }
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/EnvironmentImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/EnvironmentImpl.java
deleted file mode 100644
index 368aa62..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/EnvironmentImpl.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 1996, 2002, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import org.omg.CORBA.Environment;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.ORB;
-
-public class EnvironmentImpl extends Environment {
-
- private Exception _exc;
-
- public EnvironmentImpl()
- {
- }
-
- public Exception exception()
- {
- return _exc;
- }
-
- public void exception(Exception exc)
- {
- _exc = exc;
- }
-
- public void clear()
- {
- _exc = null;
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/ExceptionListImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/ExceptionListImpl.java
deleted file mode 100644
index 1694254..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/ExceptionListImpl.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 1996, 2002, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import java.util.Vector;
-
-import org.omg.CORBA.Bounds;
-import org.omg.CORBA.ExceptionList;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.ORB;
-
-
-public class ExceptionListImpl extends ExceptionList {
-
- private final int INITIAL_CAPACITY = 2;
- private final int CAPACITY_INCREMENT = 2;
-
- private Vector _exceptions;
-
- public ExceptionListImpl() {
- _exceptions = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT);
- }
-
- public int count()
- {
- return _exceptions.size();
- }
-
- public void add(TypeCode tc)
- {
- _exceptions.addElement(tc);
- }
-
- public TypeCode item(int index)
- throws Bounds
- {
- try {
- return (TypeCode) _exceptions.elementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new Bounds();
- }
- }
-
- public void remove(int index)
- throws Bounds
- {
- try {
- _exceptions.removeElementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new Bounds();
- }
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/NVListImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/NVListImpl.java
deleted file mode 100644
index d5cbb20..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/NVListImpl.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import java.util.Vector;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.Bounds;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.NamedValue;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-public class NVListImpl extends NVList
-{
- private final int INITIAL_CAPACITY = 4;
- private final int CAPACITY_INCREMENT = 2;
-
- private Vector _namedValues;
- private ORB orb;
-
- public NVListImpl(ORB orb)
- {
- // Note: This orb could be an instanceof ORBSingleton or ORB
- this.orb = orb;
- _namedValues = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT);
- }
-
- public NVListImpl(ORB orb, int size)
- {
- this.orb = orb;
-
- // Note: the size arg is only a hint of the size of the NVList.
- _namedValues = new Vector(size);
- }
-
-
- public int count()
- {
- return _namedValues.size();
- }
-
- public NamedValue add(int flags)
- {
- NamedValue tmpVal = new NamedValueImpl(orb, "", new AnyImpl(orb), flags);
- _namedValues.addElement(tmpVal);
- return tmpVal;
- }
-
- public NamedValue add_item(String itemName, int flags)
- {
- NamedValue tmpVal = new NamedValueImpl(orb, itemName, new AnyImpl(orb),
- flags);
- _namedValues.addElement(tmpVal);
- return tmpVal;
- }
-
- public NamedValue add_value(String itemName, Any val, int flags)
- {
- NamedValue tmpVal = new NamedValueImpl(orb, itemName, val, flags);
- _namedValues.addElement(tmpVal);
- return tmpVal;
- }
-
- public NamedValue item(int index)
- throws Bounds
- {
- try {
- return (NamedValue) _namedValues.elementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new Bounds();
- }
- }
-
- public void remove(int index)
- throws Bounds
- {
- try {
- _namedValues.removeElementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new Bounds();
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/NamedValueImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/NamedValueImpl.java
deleted file mode 100644
index 43f6c68..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/NamedValueImpl.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import org.omg.CORBA.NamedValue;
-import org.omg.CORBA.Any;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-public class NamedValueImpl extends NamedValue
-{
- private String _name;
- private Any _value;
- private int _flags;
- private ORB _orb;
-
- public NamedValueImpl(ORB orb)
- {
- // Note: This orb could be an instanceof ORBSingleton or ORB
- _orb = orb;
- _value = new AnyImpl(_orb);
- }
-
- public NamedValueImpl(ORB orb,
- String name,
- Any value,
- int flags)
- {
- // Note: This orb could be an instanceof ORBSingleton or ORB
- _orb = orb;
- _name = name;
- _value = value;
- _flags = flags;
- }
-
- public String name()
- {
- return _name;
- }
-
- public Any value()
- {
- return _value;
- }
-
- public int flags()
- {
- return _flags;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/PrincipalImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/PrincipalImpl.java
deleted file mode 100644
index e969a41..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/PrincipalImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1997, 2002, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-
-public class PrincipalImpl extends org.omg.CORBA.Principal
-{
- private byte[] value;
-
- public void name(byte[] value)
- {
- this.value = value;
- }
-
- public byte[] name()
- {
- return value;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/RequestImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/RequestImpl.java
deleted file mode 100644
index 886d157..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/RequestImpl.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Copyright (c) 1996, 2004, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.ARG_IN;
-import org.omg.CORBA.ARG_OUT;
-import org.omg.CORBA.ARG_INOUT;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.Environment;
-import org.omg.CORBA.ExceptionList;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.NamedValue;
-import org.omg.CORBA.Request;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.UnknownUserException;
-import org.omg.CORBA.Bounds;
-import org.omg.CORBA.UNKNOWN;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.WrongTransaction;
-
-import org.omg.CORBA.portable.ApplicationException ;
-import org.omg.CORBA.portable.RemarshalException ;
-import org.omg.CORBA.portable.InputStream ;
-import org.omg.CORBA.portable.OutputStream ;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.corba.AsynchInvoke;
-
-public class RequestImpl
- extends Request
-{
- ///////////////////////////////////////////////////////////////////////////
- // data members
-
- protected org.omg.CORBA.Object _target;
- protected String _opName;
- protected NVList _arguments;
- protected ExceptionList _exceptions;
- private NamedValue _result;
- protected Environment _env;
- private Context _ctx;
- private ContextList _ctxList;
- protected ORB _orb;
- private ORBUtilSystemException _wrapper;
-
- // invocation-specific stuff
- protected boolean _isOneWay = false;
- private int[] _paramCodes;
- private long[] _paramLongs;
- private java.lang.Object[] _paramObjects;
-
- // support for deferred invocations.
- // protected instead of private since it needs to be set by the
- // thread object doing the asynchronous invocation.
- protected boolean gotResponse = false;
-
- ///////////////////////////////////////////////////////////////////////////
- // constructor
-
- // REVISIT - used to be protected. Now public so it can be
- // accessed from xgiop.
- public RequestImpl (ORB orb,
- org.omg.CORBA.Object targetObject,
- Context ctx,
- String operationName,
- NVList argumentList,
- NamedValue resultContainer,
- ExceptionList exceptionList,
- ContextList ctxList)
- {
-
- // initialize the orb
- _orb = orb;
- _wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.OA_INVOCATION ) ;
-
- // initialize target, context and operation name
- _target = targetObject;
- _ctx = ctx;
- _opName = operationName;
-
- // initialize argument list if not passed in
- if (argumentList == null)
- _arguments = new NVListImpl(_orb);
- else
- _arguments = argumentList;
-
- // set result container.
- _result = resultContainer;
-
- // initialize exception list if not passed in
- if (exceptionList == null)
- _exceptions = new ExceptionListImpl();
- else
- _exceptions = exceptionList;
-
- // initialize context list if not passed in
- if (ctxList == null)
- _ctxList = new ContextListImpl(_orb);
- else
- _ctxList = ctxList;
-
- // initialize environment
- _env = new EnvironmentImpl();
-
- }
-
- public org.omg.CORBA.Object target()
- {
- return _target;
- }
-
- public String operation()
- {
- return _opName;
- }
-
- public NVList arguments()
- {
- return _arguments;
- }
-
- public NamedValue result()
- {
- return _result;
- }
-
- public Environment env()
- {
- return _env;
- }
-
- public ExceptionList exceptions()
- {
- return _exceptions;
- }
-
- public ContextList contexts()
- {
- return _ctxList;
- }
-
- public synchronized Context ctx()
- {
- if (_ctx == null)
- _ctx = new ContextImpl(_orb);
- return _ctx;
- }
-
- public synchronized void ctx(Context newCtx)
- {
- _ctx = newCtx;
- }
-
- public synchronized Any add_in_arg()
- {
- return _arguments.add(org.omg.CORBA.ARG_IN.value).value();
- }
-
- public synchronized Any add_named_in_arg(String name)
- {
- return _arguments.add_item(name, org.omg.CORBA.ARG_IN.value).value();
- }
-
- public synchronized Any add_inout_arg()
- {
- return _arguments.add(org.omg.CORBA.ARG_INOUT.value).value();
- }
-
- public synchronized Any add_named_inout_arg(String name)
- {
- return _arguments.add_item(name, org.omg.CORBA.ARG_INOUT.value).value();
- }
-
- public synchronized Any add_out_arg()
- {
- return _arguments.add(org.omg.CORBA.ARG_OUT.value).value();
- }
-
- public synchronized Any add_named_out_arg(String name)
- {
- return _arguments.add_item(name, org.omg.CORBA.ARG_OUT.value).value();
- }
-
- public synchronized void set_return_type(TypeCode tc)
- {
- if (_result == null)
- _result = new NamedValueImpl(_orb);
- _result.value().type(tc);
- }
-
- public synchronized Any return_value()
- {
- if (_result == null)
- _result = new NamedValueImpl(_orb);
- return _result.value();
- }
-
- public synchronized void add_exception(TypeCode exceptionType)
- {
- _exceptions.add(exceptionType);
- }
-
- public synchronized void invoke()
- {
- doInvocation();
- }
-
- public synchronized void send_oneway()
- {
- _isOneWay = true;
- doInvocation();
- }
-
- public synchronized void send_deferred()
- {
- AsynchInvoke invokeObject = new AsynchInvoke(_orb, this, false);
- new Thread(invokeObject).start();
- }
-
- public synchronized boolean poll_response()
- {
- // this method has to be synchronized even though it seems
- // "readonly" since the thread object doing the asynchronous
- // invocation can potentially update this variable in parallel.
- // updates are currently simply synchronized againt the request
- // object.
- return gotResponse;
- }
-
- public synchronized void get_response()
- throws org.omg.CORBA.WrongTransaction
- {
- while (gotResponse == false) {
- // release the lock. wait to be notified by the thread that is
- // doing the asynchronous invocation.
- try {
- wait();
- }
- catch (InterruptedException e) {}
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // private helper methods
-
- /*
- * The doInvocation operation is where the real mechanics of
- * performing the request invocation is done.
- */
- protected void doInvocation()
- {
- org.omg.CORBA.portable.Delegate delegate = StubAdapter.getDelegate(
- _target ) ;
-
- // Initiate Client Portable Interceptors. Inform the PIHandler that
- // this is a DII request so that it knows to ignore the second
- // inevitable call to initiateClientPIRequest in createRequest.
- // Also, save the RequestImpl object for later use.
- _orb.getPIHandler().initiateClientPIRequest( true );
- _orb.getPIHandler().setClientPIInfo( this );
-
- InputStream $in = null;
- try {
- OutputStream $out = delegate.request(null, _opName, !_isOneWay);
- // Marshal args
- try {
- for (int i=0; i<_arguments.count() ; i++) {
- NamedValue nv = _arguments.item(i);
- switch (nv.flags()) {
- case ARG_IN.value:
- nv.value().write_value($out);
- break;
- case ARG_OUT.value:
- break;
- case ARG_INOUT.value:
- nv.value().write_value($out);
- break;
- }
- }
- } catch ( org.omg.CORBA.Bounds ex ) {
- throw _wrapper.boundsErrorInDiiRequest( ex ) ;
- }
-
- $in = delegate.invoke(null, $out);
- } catch (ApplicationException e) {
- // REVISIT - minor code.
- // This is already handled in subcontract.
- // REVISIT - uncomment.
- //throw new INTERNAL();
- } catch (RemarshalException e) {
- doInvocation();
- } catch( SystemException ex ) {
- _env.exception(ex);
- // NOTE: The exception should not be thrown.
- // However, JDK 1.4 and earlier threw the exception,
- // so we keep the behavior to be compatible.
- throw ex;
- } finally {
- delegate.releaseReply(null, $in);
- }
- }
-
- // REVISIT - make protected after development - so xgiop can get it.
- public void unmarshalReply(InputStream is)
- {
- // First unmarshal the return value if it is not void
- if ( _result != null ) {
- Any returnAny = _result.value();
- TypeCode returnType = returnAny.type();
- if ( returnType.kind().value() != TCKind._tk_void )
- returnAny.read_value(is, returnType);
- }
-
- // Now unmarshal the out/inout args
- try {
- for ( int i=0; i<_arguments.count() ; i++) {
- NamedValue nv = _arguments.item(i);
- switch( nv.flags() ) {
- case ARG_IN.value:
- break;
- case ARG_OUT.value:
- case ARG_INOUT.value:
- Any any = nv.value();
- any.read_value(is, any.type());
- break;
- }
- }
- }
- catch ( org.omg.CORBA.Bounds ex ) {
- // Cannot happen since we only iterate till _arguments.count()
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/ServerRequestImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/ServerRequestImpl.java
deleted file mode 100644
index c77802f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/ServerRequestImpl.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 1996, 2004, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.NamedValue;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.ServerRequest;
-import org.omg.CORBA.Bounds;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class ServerRequestImpl extends ServerRequest {
-
- ///////////////////////////////////////////////////////////////////////////
- // data members
-
- private ORB _orb = null;
- private ORBUtilSystemException _wrapper = null;
- private String _opName = null;
- private NVList _arguments = null;
- private Context _ctx = null;
- private InputStream _ins = null;
-
- // booleans to check for various operation invocation restrictions
- private boolean _paramsCalled = false;
- private boolean _resultSet = false;
- private boolean _exceptionSet = false;
- private Any _resultAny = null;
- private Any _exception = null;
-
-
- public ServerRequestImpl (CorbaMessageMediator req, ORB orb) {
- _opName = req.getOperationName();
- _ins = (InputStream)req.getInputObject();
- _ctx = null; // if we support contexts, this would
- // presumably also be available on
- // the server invocation
- _orb = orb;
- _wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.OA_INVOCATION ) ;
- }
-
- public String operation() {
- return _opName;
- }
-
- public void arguments(NVList args)
- {
- if (_paramsCalled)
- throw _wrapper.argumentsCalledMultiple() ;
-
- if (_exceptionSet)
- throw _wrapper.argumentsCalledAfterException() ;
-
- if (args == null )
- throw _wrapper.argumentsCalledNullArgs() ;
-
- _paramsCalled = true;
-
- NamedValue arg = null;
- for (int i=0; i < args.count() ; i++) {
- try {
- arg = args.item(i);
- } catch (Bounds e) {
- throw _wrapper.boundsCannotOccur(e) ;
- }
-
- try {
- if ((arg.flags() == org.omg.CORBA.ARG_IN.value) ||
- (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
- // unmarshal the value into the Any
- arg.value().read_value(_ins, arg.value().type());
- }
- } catch ( Exception ex ) {
- throw _wrapper.badArgumentsNvlist( ex ) ;
- }
- }
-
- // hang on to the NVList for marshaling the result
- _arguments = args;
-
- _orb.getPIHandler().setServerPIInfo( _arguments );
- _orb.getPIHandler().invokeServerPIIntermediatePoint();
- }
-
- public void set_result(Any res) {
- // check for invocation restrictions
- if (!_paramsCalled)
- throw _wrapper.argumentsNotCalled() ;
- if (_resultSet)
- throw _wrapper.setResultCalledMultiple() ;
- if (_exceptionSet)
- throw _wrapper.setResultAfterException() ;
- if ( res == null )
- throw _wrapper.setResultCalledNullArgs() ;
-
- _resultAny = res;
- _resultSet = true;
-
- // Notify portable interceptors of the result so that
- // ServerRequestInfo.result() functions as desired.
- _orb.getPIHandler().setServerPIInfo( _resultAny );
-
- // actual marshaling of the reply msg header and params takes place
- // after the DSI returns control to the ORB.
- }
-
- public void set_exception(Any exc)
- {
- // except can be called by the DIR at any time (CORBA 2.2 section 6.3).
-
- if ( exc == null )
- throw _wrapper.setExceptionCalledNullArgs() ;
-
- // Ensure that the Any contains a SystemException or a
- // UserException. If the UserException is not a declared exception,
- // the client will get an UNKNOWN exception.
- TCKind kind = exc.type().kind();
- if ( kind != TCKind.tk_except )
- throw _wrapper.setExceptionCalledBadType() ;
-
- _exception = exc;
-
- // Inform Portable interceptors of the exception that was set
- // so sending_exception can return the right value.
- _orb.getPIHandler().setServerPIExceptionInfo( _exception );
-
- // The user can only call arguments once and not at all after
- // set_exception. (internal flags ensure this). However, the user
- // can call set_exception multiple times. Therefore, we only
- // invoke receive_request the first time set_exception is
- // called (if they haven't already called arguments).
- if( !_exceptionSet && !_paramsCalled ) {
- // We need to invoke intermediate points here.
- _orb.getPIHandler().invokeServerPIIntermediatePoint();
- }
-
- _exceptionSet = true;
-
- // actual marshaling of the reply msg header and exception takes place
- // after the DSI returns control to the ORB.
- }
-
-
- /** This is called from the ORB after the DynamicImplementation.invoke
- * returns. Here we set the result if result() has not already been called.
- * @return the exception if there is one (then ORB will not call
- * marshalReplyParams()) otherwise return null.
- */
- public Any checkResultCalled()
- {
- // Two things to be checked (CORBA 2.2 spec, section 6.3):
- // 1. Unless it calls set_exception(), the DIR must call arguments()
- // exactly once, even if the operation signature contains
- // no parameters.
- // 2. Unless set_exception() is called, if the invoked operation has a
- // non-void result type, set_result() must be called exactly once
- // before the DIR returns.
-
- if ( _paramsCalled && _resultSet ) // normal invocation return
- return null;
- else if ( _paramsCalled && !_resultSet && !_exceptionSet ) {
- try {
- // Neither a result nor an exception has been set.
- // Assume that the return type is void. If this is not so,
- // the client will throw a MARSHAL exception while
- // unmarshaling the return value.
- TypeCode result_tc = _orb.get_primitive_tc(
- org.omg.CORBA.TCKind.tk_void);
- _resultAny = _orb.create_any();
- _resultAny.type(result_tc);
- _resultSet = true;
-
- return null;
- } catch ( Exception ex ) {
- throw _wrapper.dsiResultException(
- CompletionStatus.COMPLETED_MAYBE, ex ) ;
- }
- } else if ( _exceptionSet )
- return _exception;
- else {
- throw _wrapper.dsimethodNotcalled(
- CompletionStatus.COMPLETED_MAYBE ) ;
- }
- }
-
- /** This is called from the ORB after the DynamicImplementation.invoke
- * returns. Here we marshal the return value and inout/out params.
- */
- public void marshalReplyParams(OutputStream os)
- {
- // marshal the operation return value
- _resultAny.write_value(os);
-
- // marshal the inouts/outs
- NamedValue arg = null;
-
- for (int i=0; i < _arguments.count() ; i++) {
- try {
- arg = _arguments.item(i);
- } catch (Bounds e) {}
-
- if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) ||
- (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
- arg.value().write_value(os);
- }
- }
- }
-
- public Context ctx()
- {
- if ( !_paramsCalled || _resultSet || _exceptionSet )
- throw _wrapper.contextCalledOutOfOrder() ;
-
- throw _wrapper.contextNotImplemented() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/TCUtility.java b/src/share/classes/com/sun/corba/se/impl/corba/TCUtility.java
deleted file mode 100644
index b167081..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/TCUtility.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Copyright (c) 1998, 2004, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.UNKNOWN;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-import org.omg.CORBA.portable.Streamable;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-/**
- * Static functions for TypeCode interpretation.
- */
-public final class TCUtility {
-
- static void marshalIn(org.omg.CORBA.portable.OutputStream s, TypeCode typeCode, long l, Object o) {
- switch (typeCode.kind().value()) {
- case TCKind._tk_null:
- case TCKind._tk_void:
- case TCKind._tk_native:
- // nothing to write
- break;
-
- case TCKind._tk_short:
- s.write_short((short)(l & 0xFFFFL));
- break;
-
- case TCKind._tk_ushort:
- s.write_ushort((short)(l & 0xFFFFL));
- break;
-
- case TCKind._tk_enum:
- case TCKind._tk_long:
- s.write_long((int)(l & 0xFFFFFFFFL));
- break;
-
- case TCKind._tk_ulong:
- s.write_ulong((int)(l & 0xFFFFFFFFL));
- break;
-
- case TCKind._tk_float:
- s.write_float(Float.intBitsToFloat((int)(l & 0xFFFFFFFFL)));
- break;
-
- case TCKind._tk_double:
- s.write_double(Double.longBitsToDouble(l));
- break;
-
- case TCKind._tk_boolean:
- if ( l == 0 )
- s.write_boolean(false);
- else
- s.write_boolean(true);
- break;
-
- case TCKind._tk_char:
- s.write_char((char)(l & 0xFFFFL));
- break;
-
- case TCKind._tk_octet:
- s.write_octet((byte)(l & 0xFFL));
- break;
-
- case TCKind._tk_any:
- s.write_any((Any)o);
- break;
-
- case TCKind._tk_TypeCode:
- s.write_TypeCode((TypeCode)o);
- break;
-
- case TCKind._tk_Principal:
- s.write_Principal((Principal)o);
- break;
-
- case TCKind._tk_objref:
- s.write_Object((org.omg.CORBA.Object)o);
- break;
-
- case TCKind._tk_longlong:
- s.write_longlong(l);
- break;
-
- case TCKind._tk_ulonglong:
- s.write_ulonglong(l);
- break;
-
- case TCKind._tk_wchar:
- s.write_wchar((char)(l & 0xFFFFL));
- break;
-
- case TCKind._tk_string:
- s.write_string((String)o);
- break;
-
- case TCKind._tk_wstring:
- s.write_wstring((String)o);
- break;
-
- case TCKind._tk_value:
- case TCKind._tk_value_box:
- ((org.omg.CORBA_2_3.portable.OutputStream)s).write_value((Serializable)o);
- break;
-
- case TCKind._tk_fixed:
- // _REVISIT_ As soon as the java-rtf adds digits and scale parameters to
- // OutputStream, this check will be unnecessary
- if (s instanceof CDROutputStream) {
- try {
- ((CDROutputStream)s).write_fixed((BigDecimal)o,
- typeCode.fixed_digits(),
- typeCode.fixed_scale());
- } catch (BadKind badKind) { // impossible
- }
- } else {
- s.write_fixed((BigDecimal)o);
- }
- break;
-
- case TCKind._tk_struct:
- case TCKind._tk_union:
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- case TCKind._tk_alias:
- case TCKind._tk_except:
- ((Streamable)o)._write(s);
- break;
-
- case TCKind._tk_abstract_interface:
- ((org.omg.CORBA_2_3.portable.OutputStream)s).write_abstract_interface(o);
- break;
-
- case TCKind._tk_longdouble:
- // Unspecified for Java
- default:
- ORBUtilSystemException wrapper = ORBUtilSystemException.get(
- (com.sun.corba.se.spi.orb.ORB)s.orb(),
- CORBALogDomains.RPC_PRESENTATION ) ;
- throw wrapper.typecodeNotSupported() ;
- }
- }
-
- static void unmarshalIn(org.omg.CORBA.portable.InputStream s, TypeCode typeCode, long[] la, Object[] oa)
- {
- int type = typeCode.kind().value();
- long l=0;
- Object o=oa[0];
-
- switch (type) {
- case TCKind._tk_null:
- case TCKind._tk_void:
- case TCKind._tk_native:
- // Nothing to read
- break;
-
- case TCKind._tk_short:
- l = s.read_short() & 0xFFFFL;
- break;
-
- case TCKind._tk_ushort:
- l = s.read_ushort() & 0xFFFFL;
- break;
-
- case TCKind._tk_enum:
- case TCKind._tk_long:
- l = s.read_long() & 0xFFFFFFFFL;
- break;
-
- case TCKind._tk_ulong:
- l = s.read_ulong() & 0xFFFFFFFFL;
- break;
-
- case TCKind._tk_float:
- l = Float.floatToIntBits(s.read_float()) & 0xFFFFFFFFL;
- break;
-
- case TCKind._tk_double:
- l = Double.doubleToLongBits(s.read_double());
- break;
-
- case TCKind._tk_char:
- l = s.read_char() & 0xFFFFL;
- break;
-
- case TCKind._tk_octet:
- l = s.read_octet() & 0xFFL;
- break;
-
- case TCKind._tk_boolean:
- if ( s.read_boolean() )
- l = 1;
- else
- l = 0;
- break;
-
- case TCKind._tk_any:
- o = s.read_any();
- break;
-
- case TCKind._tk_TypeCode:
- o = s.read_TypeCode();
- break;
-
- case TCKind._tk_Principal:
- o = s.read_Principal();
- break;
-
- case TCKind._tk_objref:
- if (o instanceof Streamable)
- ((Streamable)o)._read(s);
- else
- o = s.read_Object();
- break;
-
- case TCKind._tk_longlong:
- l = s.read_longlong();
- break;
-
- case TCKind._tk_ulonglong:
- l = s.read_ulonglong();
- break;
-
- case TCKind._tk_wchar:
- l = s.read_wchar() & 0xFFFFL;
- break;
-
- case TCKind._tk_string:
- o = s.read_string();
- break;
-
- case TCKind._tk_wstring:
- o = s.read_wstring();
- break;
-
- case TCKind._tk_value:
- case TCKind._tk_value_box:
- o = ((org.omg.CORBA_2_3.portable.InputStream)s).read_value ();
- break;
-
- case TCKind._tk_fixed:
- try {
- // _REVISIT_ As soon as the java-rtf adds digits and scale parameters to
- // InputStream, this check will be unnecessary
- if (s instanceof CDRInputStream) {
- o = ((CDRInputStream)s).read_fixed(typeCode.fixed_digits(),
- typeCode.fixed_scale());
- } else {
- BigDecimal bigDecimal = s.read_fixed();
- o = bigDecimal.movePointLeft((int)typeCode.fixed_scale());
- }
- } catch (BadKind badKind) { // impossible
- }
- break;
-
- case TCKind._tk_struct:
- case TCKind._tk_union:
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- case TCKind._tk_alias:
- case TCKind._tk_except:
- ((Streamable)o)._read(s);
- break;
-
- case TCKind._tk_abstract_interface:
- o = ((org.omg.CORBA_2_3.portable.InputStream)s).read_abstract_interface();
- break;
-
- case TCKind._tk_longdouble:
- // Unspecified for Java
- default:
- ORBUtilSystemException wrapper = ORBUtilSystemException.get(
- (com.sun.corba.se.spi.orb.ORB)s.orb(),
- CORBALogDomains.RPC_PRESENTATION ) ;
- throw wrapper.typecodeNotSupported() ;
- }
-
- oa[0] = o;
- la[0] = l;
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeFactory.java b/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeFactory.java
deleted file mode 100644
index 62646eb..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeFactory.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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.
- */
-
-package com.sun.corba.se.impl.corba;
-
-public interface TypeCodeFactory {
- void setTypeCode(String id, TypeCodeImpl code);
-
- TypeCodeImpl getTypeCode(String id);
-
- void setTypeCodeForClass( Class c, TypeCodeImpl tcimpl ) ;
-
- TypeCodeImpl getTypeCodeForClass( Class c ) ;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java b/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java
deleted file mode 100644
index 4e90f7f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java
+++ /dev/null
@@ -1,2413 +0,0 @@
-/*
- * 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.
- */
-
-package com.sun.corba.se.impl.corba;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.StructMember ;
-import org.omg.CORBA.UnionMember ;
-import org.omg.CORBA.ValueMember ;
-import org.omg.CORBA.TCKind ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.Principal ;
-import org.omg.CORBA.BAD_TYPECODE ;
-import org.omg.CORBA.BAD_PARAM ;
-import org.omg.CORBA.BAD_OPERATION ;
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.MARSHAL ;
-import org.omg.CORBA.TypeCodePackage.BadKind ;
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.encoding.MarshalInputStream;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-import com.sun.corba.se.impl.encoding.TypeCodeInputStream;
-import com.sun.corba.se.impl.encoding.TypeCodeOutputStream;
-import com.sun.corba.se.impl.encoding.TypeCodeReader;
-import com.sun.corba.se.impl.encoding.WrapperInputStream;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-// no chance of subclasses, so no problems with runtime helper lookup
-public final class TypeCodeImpl extends TypeCode
-{
- //static final boolean debug = false;
-
- // the indirection TCKind, needed for recursive typecodes.
- protected static final int tk_indirect = 0xFFFFFFFF;
-
- // typecode encodings have three different categories that determine
- // how the encoding should be done.
-
- private static final int EMPTY = 0; // no parameters
- private static final int SIMPLE = 1; // simple parameters.
- private static final int COMPLEX = 2; // complex parameters. need to
- // use CDR encapsulation for
- // parameters
-
- // a table storing the encoding category for the various typecodes.
-
- private static final int typeTable[] = {
- EMPTY, // tk_null
- EMPTY, // tk_void
- EMPTY, // tk_short
- EMPTY, // tk_long
- EMPTY, // tk_ushort
- EMPTY, // tk_ulong
- EMPTY, // tk_float
- EMPTY, // tk_double
- EMPTY, // tk_boolean
- EMPTY, // tk_char
- EMPTY, // tk_octet
- EMPTY, // tk_any
- EMPTY, // tk_typecode
- EMPTY, // tk_principal
- COMPLEX, // tk_objref
- COMPLEX, // tk_struct
- COMPLEX, // tk_union
- COMPLEX, // tk_enum
- SIMPLE, // tk_string
- COMPLEX, // tk_sequence
- COMPLEX, // tk_array
- COMPLEX, // tk_alias
- COMPLEX, // tk_except
- EMPTY, // tk_longlong
- EMPTY, // tk_ulonglong
- EMPTY, // tk_longdouble
- EMPTY, // tk_wchar
- SIMPLE, // tk_wstring
- SIMPLE, // tk_fixed
- COMPLEX, // tk_value
- COMPLEX, // tk_value_box
- COMPLEX, // tk_native
- COMPLEX // tk_abstract_interface
- };
-
- // Maps TCKind values to names
- // This is also used in AnyImpl.
- static final String[] kindNames = {
- "null",
- "void",
- "short",
- "long",
- "ushort",
- "ulong",
- "float",
- "double",
- "boolean",
- "char",
- "octet",
- "any",
- "typecode",
- "principal",
- "objref",
- "struct",
- "union",
- "enum",
- "string",
- "sequence",
- "array",
- "alias",
- "exception",
- "longlong",
- "ulonglong",
- "longdouble",
- "wchar",
- "wstring",
- "fixed",
- "value",
- "valueBox",
- "native",
- "abstractInterface"
- };
-
- private int _kind = 0; // the typecode kind
-
- // data members for representing the various kinds of typecodes.
- private String _id = ""; // the typecode repository id
- private String _name = ""; // the typecode name
- private int _memberCount = 0; // member count
- private String _memberNames[] = null; // names of members
- private TypeCodeImpl _memberTypes[] = null; // types of members
- private AnyImpl _unionLabels[] = null; // values of union labels
- private TypeCodeImpl _discriminator = null; // union discriminator type
- private int _defaultIndex = -1; // union default index
- private int _length = 0; // string/seq/array length
- private TypeCodeImpl _contentType = null; // seq/array/alias type
- // fixed
- private short _digits = 0;
- private short _scale = 0;
- // value type
- // _REVISIT_ We might want to keep references to the ValueMember classes
- // passed in at initialization instead of copying the relevant data.
- // Is the data immutable? What about StructMember, UnionMember etc.?
- private short _type_modifier = -1; // VM_NONE, VM_CUSTOM,
- // VM_ABSTRACT, VM_TRUNCATABLE
- private TypeCodeImpl _concrete_base = null; // concrete base type
- private short _memberAccess[] = null; // visibility of ValueMember
- // recursive sequence support
- private TypeCodeImpl _parent = null; // the enclosing type code
- private int _parentOffset = 0; // the level of enclosure
- // recursive type code support
- private TypeCodeImpl _indirectType = null;
-
- // caches the byte buffer written in write_value for quick remarshaling...
- private byte[] outBuffer = null;
- // ... but only if caching is enabled
- private boolean cachingEnabled = false;
-
- // the ORB instance: may be instanceof ORBSingleton or ORB
- private ORB _orb;
- private ORBUtilSystemException wrapper ;
-
- ///////////////////////////////////////////////////////////////////////////
- // Constructors...
-
- public TypeCodeImpl(ORB orb)
- {
- // initialized to tk_null
- _orb = orb;
- wrapper = ORBUtilSystemException.get(
- (com.sun.corba.se.spi.orb.ORB)orb, CORBALogDomains.RPC_PRESENTATION ) ;
- }
-
- public TypeCodeImpl(ORB orb, TypeCode tc)
- // to handle conversion of "remote" typecodes into "native" style.
- // also see the 'convertToNative(ORB orb, TypeCode tc)' function
- {
- this(orb) ;
-
- // This is a protection against misuse of this constructor.
- // Should only be used if tc is not an instance of this class!
- // Otherwise we run into problems with recursive/indirect type codes.
- // _REVISIT_ We should make this constructor private
- if (tc instanceof TypeCodeImpl) {
- TypeCodeImpl tci = (TypeCodeImpl)tc;
- if (tci._kind == tk_indirect)
- throw wrapper.badRemoteTypecode() ;
- if (tci._kind == TCKind._tk_sequence && tci._contentType == null)
- throw wrapper.badRemoteTypecode() ;
- }
-
- // set up kind
- _kind = tc.kind().value();
-
- try {
- // set up parameters
- switch (_kind) {
- case TCKind._tk_value:
- _type_modifier = tc.type_modifier();
- // concrete base may be null
- TypeCode tccb = tc.concrete_base_type();
- if (tccb != null) {
- _concrete_base = convertToNative(_orb, tccb);
- } else {
- _concrete_base = null;
- }
- //_memberAccess = tc._memberAccess;
- // Need to reconstruct _memberAccess using member_count() and member_visibility()
- _memberAccess = new short[tc.member_count()];
- for (int i=0; i < tc.member_count(); i++) {
- _memberAccess[i] = tc.member_visibility(i);
- }
- case TCKind._tk_except:
- case TCKind._tk_struct:
- case TCKind._tk_union:
- // set up member types
- _memberTypes = new TypeCodeImpl[tc.member_count()];
- for (int i=0; i < tc.member_count(); i++) {
- _memberTypes[i] = convertToNative(_orb, tc.member_type(i));
- _memberTypes[i].setParent(this);
- }
- case TCKind._tk_enum:
- // set up member names
- _memberNames = new String[tc.member_count()];
- for (int i=0; i < tc.member_count(); i++) {
- _memberNames[i] = tc.member_name(i);
- }
- // set up member count
- _memberCount = tc.member_count();
- case TCKind._tk_objref:
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- case TCKind._tk_native:
- case TCKind._tk_abstract_interface:
- setId(tc.id());
- _name = tc.name();
- break;
- }
-
- // set up stuff for unions
- switch (_kind) {
- case TCKind._tk_union:
- _discriminator = convertToNative(_orb, tc.discriminator_type());
- _defaultIndex = tc.default_index();
- _unionLabels = new AnyImpl[_memberCount];
- for (int i=0; i < _memberCount; i++)
- _unionLabels[i] = new AnyImpl(_orb, tc.member_label(i));
- break;
- }
-
- // set up length
- switch (_kind) {
- case TCKind._tk_string:
- case TCKind._tk_wstring:
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- _length = tc.length();
- }
-
- // set up content type
- switch (_kind) {
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- _contentType = convertToNative(_orb, tc.content_type());
- }
- } catch (org.omg.CORBA.TypeCodePackage.Bounds e) {} catch (BadKind e) {}
- // dont have to worry about these since code ensures we dont step
- // out of bounds.
- }
-
- public TypeCodeImpl(ORB orb, int creationKind)
- // for primitive types
- {
- this(orb);
-
- // private API. dont bother checking that
- // (creationKind < 0 || creationKind > typeTable.length)
-
- _kind = creationKind;
-
- // do initialization for special cases
- switch (_kind) {
- case TCKind._tk_objref:
- {
- // this is being used to create typecode for CORBA::Object
- setId("IDL:omg.org/CORBA/Object:1.0");
- _name = "Object";
- break;
- }
-
- case TCKind._tk_string:
- case TCKind._tk_wstring:
- {
- _length =0;
- break;
- }
-
- case TCKind._tk_value:
- {
- _concrete_base = null;
- break;
- }
- }
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- String id,
- String name,
- StructMember[] members)
- // for structs and exceptions
- {
- this(orb);
-
- if ((creationKind == TCKind._tk_struct) || (creationKind == TCKind._tk_except)) {
- _kind = creationKind;
- setId(id);
- _name = name;
- _memberCount = members.length;
-
- _memberNames = new String[_memberCount];
- _memberTypes = new TypeCodeImpl[_memberCount];
-
- for (int i = 0 ; i < _memberCount ; i++) {
- _memberNames[i] = members[i].name;
- _memberTypes[i] = convertToNative(_orb, members[i].type);
- _memberTypes[i].setParent(this);
- }
- } // else initializes to null
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- String id,
- String name,
- TypeCode discriminator_type,
- UnionMember[] members)
- // for unions
- {
- this(orb) ;
-
- if (creationKind == TCKind._tk_union) {
- _kind = creationKind;
- setId(id);
- _name = name;
- _memberCount = members.length;
- _discriminator = convertToNative(_orb, discriminator_type);
-
- _memberNames = new String[_memberCount];
- _memberTypes = new TypeCodeImpl[_memberCount];
- _unionLabels = new AnyImpl[_memberCount];
-
- for (int i = 0 ; i < _memberCount ; i++) {
- _memberNames[i] = members[i].name;
- _memberTypes[i] = convertToNative(_orb, members[i].type);
- _memberTypes[i].setParent(this);
- _unionLabels[i] = new AnyImpl(_orb, members[i].label);
- // check whether this is the default branch.
- if (_unionLabels[i].type().kind() == TCKind.tk_octet) {
- if (_unionLabels[i].extract_octet() == (byte)0) {
- _defaultIndex = i;
- }
- }
- }
- } // else initializes to null
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- String id,
- String name,
- short type_modifier,
- TypeCode concrete_base,
- ValueMember[] members)
- // for value types
- {
- this(orb) ;
-
- if (creationKind == TCKind._tk_value) {
- _kind = creationKind;
- setId(id);
- _name = name;
- _type_modifier = type_modifier;
- if (concrete_base != null) {
- _concrete_base = convertToNative(_orb, concrete_base);
- }
- _memberCount = members.length;
-
- _memberNames = new String[_memberCount];
- _memberTypes = new TypeCodeImpl[_memberCount];
- _memberAccess = new short[_memberCount];
-
- for (int i = 0 ; i < _memberCount ; i++) {
- _memberNames[i] = members[i].name;
- _memberTypes[i] = convertToNative(_orb, members[i].type);
- _memberTypes[i].setParent(this);
- _memberAccess[i] = members[i].access;
- }
- } // else initializes to null
- }
-
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- String id,
- String name,
- String[] members)
- // for enums
- {
- this(orb) ;
-
- if (creationKind == TCKind._tk_enum)
- {
- _kind = creationKind;
- setId(id);
- _name = name;
- _memberCount = members.length;
-
- _memberNames = new String[_memberCount];
-
- for (int i = 0 ; i < _memberCount ; i++)
- _memberNames[i] = members[i];
- } // else initializes to null
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- String id,
- String name,
- TypeCode original_type)
- // for aliases and value boxes
- {
- this(orb) ;
-
- if ( creationKind == TCKind._tk_alias || creationKind == TCKind._tk_value_box )
- {
- _kind = creationKind;
- setId(id);
- _name = name;
- _contentType = convertToNative(_orb, original_type);
- }
- // else initializes to null
-
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- String id,
- String name)
- {
- this(orb) ;
-
- if (creationKind == TCKind._tk_objref ||
- creationKind == TCKind._tk_native ||
- creationKind == TCKind._tk_abstract_interface)
- {
- _kind = creationKind;
- setId(id);
- _name = name;
- } // else initializes to null
- }
-
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- int bound)
- // for strings
- {
- this(orb) ;
-
- if (bound < 0)
- throw wrapper.negativeBounds() ;
-
- if ((creationKind == TCKind._tk_string) || (creationKind == TCKind._tk_wstring)) {
- _kind = creationKind;
- _length = bound;
- } // else initializes to null
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- int bound,
- TypeCode element_type)
- // for sequences and arrays
- {
- this(orb) ;
-
- if ( creationKind == TCKind._tk_sequence || creationKind == TCKind._tk_array ) {
- _kind = creationKind;
- _length = bound;
- _contentType = convertToNative(_orb, element_type);
- } // else initializes to null
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- int bound,
- int offset)
- // for recursive sequences
- {
- this(orb) ;
-
- if (creationKind == TCKind._tk_sequence) {
- _kind = creationKind;
- _length = bound;
- _parentOffset = offset;
- } // else initializes to null
- }
-
- public TypeCodeImpl(ORB orb,
- String id)
- // for recursive type codes
- {
- this(orb) ;
-
- _kind = tk_indirect;
- // This is the type code of the type we stand in for, not our own.
- _id = id;
- // Try to resolve it now. May return null in which case
- // we try again later (see indirectType()).
- tryIndirectType();
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- short digits,
- short scale)
- // for fixed
- {
- this(orb) ;
-
- //if (digits < 1 || digits > 31)
- //throw new BAD_TYPECODE();
-
- if (creationKind == TCKind._tk_fixed) {
- _kind = creationKind;
- _digits = digits;
- _scale = scale;
- } // else initializes to null
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // Other creation functions...
-
- // Optimization:
- // If we checked for and returned constant primitive typecodes
- // here we could reduce object creation and also enable more
- // efficient typecode comparisons for primitive typecodes.
- //
- protected static TypeCodeImpl convertToNative(ORB orb,
- TypeCode tc)
- {
- if (tc instanceof TypeCodeImpl)
- return (TypeCodeImpl) tc;
- else
- return new TypeCodeImpl(orb, tc);
- }
-
- public static CDROutputStream newOutputStream(ORB orb) {
- TypeCodeOutputStream tcos =
- sun.corba.OutputStreamFactory.newTypeCodeOutputStream(orb);
- //if (debug) System.out.println("Created TypeCodeOutputStream " + tcos +
- // " with no parent");
- return tcos;
- }
-
- // Support for indirect/recursive type codes
-
- private TypeCodeImpl indirectType() {
- _indirectType = tryIndirectType();
- if (_indirectType == null) {
- // Nothing we can do about that.
- throw wrapper.unresolvedRecursiveTypecode() ;
- }
- return _indirectType;
- }
-
- private TypeCodeImpl tryIndirectType() {
- // Assert that _kind == tk_indirect
- if (_indirectType != null)
- return _indirectType;
-
- setIndirectType(_orb.getTypeCode(_id));
-
- return _indirectType;
- }
-
- private void setIndirectType(TypeCodeImpl newType) {
- _indirectType = newType;
- if (_indirectType != null) {
- try {
- _id = _indirectType.id();
- } catch (BadKind e) {
- // can't happen
- throw wrapper.badkindCannotOccur() ;
- }
- }
- }
-
- private void setId(String newID) {
- _id = newID;
- if (_orb instanceof TypeCodeFactory) {
- ((TypeCodeFactory)_orb).setTypeCode(_id, this);
- }
- // check whether return value != this which would indicate that the
- // repository id isn't unique.
- }
-
- private void setParent(TypeCodeImpl parent) {
- _parent = parent;
- }
-
- private TypeCodeImpl getParentAtLevel(int level) {
- if (level == 0)
- return this;
-
- if (_parent == null)
- throw wrapper.unresolvedRecursiveTypecode() ;
-
- return _parent.getParentAtLevel(level - 1);
- }
-
- private TypeCodeImpl lazy_content_type() {
- if (_contentType == null) {
- if (_kind == TCKind._tk_sequence && _parentOffset > 0 && _parent != null) {
- // This is an unresolved recursive sequence tc.
- // Try to resolve it now if the hierarchy is complete.
- TypeCodeImpl realParent = getParentAtLevel(_parentOffset);
- if (realParent != null && realParent._id != null) {
- // Create a recursive type code object as the content type.
- // This is when the recursive sequence typecode morphes
- // into a sequence typecode containing a recursive typecode.
- _contentType = new TypeCodeImpl((ORB)_orb, realParent._id);
- }
- }
- }
- return _contentType;
- }
-
- // Other private functions
-
- private TypeCode realType(TypeCode aType) {
- TypeCode realType = aType;
- try {
- // Note: Indirect types are handled in kind() method
- while (realType.kind().value() == TCKind._tk_alias) {
- realType = realType.content_type();
- }
- } catch (BadKind bad) {
- // impossible
- throw wrapper.badkindCannotOccur() ;
- }
- return realType;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // TypeCode operations
-
- public final boolean equal(TypeCode tc)
- // _REVISIT_ for all optional names/ids, we might want to check that
- // they are equal in case both are non-nil.
- {
- if (tc == this)
- return true;
-
- try {
-
- if (_kind == tk_indirect) {
- //return indirectType().equal(tc);
- if (_id != null && tc.id() != null)
- return _id.equals(tc.id());
- return (_id == null && tc.id() == null);
- }
-
- // make sure kinds are identical.
- if (_kind != tc.kind().value()) {
- return false;
- }
-
- switch (typeTable[_kind]) {
- case EMPTY:
- // no parameters to check.
- return true;
-
- case SIMPLE:
- switch (_kind) {
- case TCKind._tk_string:
- case TCKind._tk_wstring:
- // check for bound.
- return (_length == tc.length());
-
- case TCKind._tk_fixed:
- return (_digits == tc.fixed_digits() && _scale == tc.fixed_scale());
- default:
- return false;
- }
-
- case COMPLEX:
-
- switch(_kind) {
-
- case TCKind._tk_objref:
- {
- // check for logical id.
- if (_id.compareTo(tc.id()) == 0) {
- return true;
- }
-
- if (_id.compareTo(
- (_orb.get_primitive_tc(_kind)).id()) == 0)
- {
- return true;
- }
-
- if (tc.id().compareTo(
- (_orb.get_primitive_tc(_kind)).id()) == 0)
- {
- return true;
- }
-
- return false;
- }
-
- case TCKind._tk_native:
- case TCKind._tk_abstract_interface:
- {
- // check for logical id.
- if (_id.compareTo(tc.id()) != 0) {
- return false;
-
- }
- // ignore name since its optional.
- return true;
- }
-
- case TCKind._tk_struct:
- case TCKind._tk_except:
- {
- // check for member count
- if (_memberCount != tc.member_count())
- return false;
- // check for repository id
- if (_id.compareTo(tc.id()) != 0)
- return false;
- // check for member types.
- for (int i = 0 ; i < _memberCount ; i++)
- if (! _memberTypes[i].equal(tc.member_type(i)))
- return false;
- // ignore id and names since those are optional.
- return true;
- }
-
- case TCKind._tk_union:
- {
- // check for member count
- if (_memberCount != tc.member_count())
- return false;
- // check for repository id
- if (_id.compareTo(tc.id()) != 0)
- return false;
- // check for default index
- if (_defaultIndex != tc.default_index())
- return false;
- // check for discriminator type
- if (!_discriminator.equal(tc.discriminator_type()))
- return false;
- // check for label types and values
- for (int i = 0 ; i < _memberCount ; i++)
- if (! _unionLabels[i].equal(tc.member_label(i)))
- return false;
- // check for branch types
- for (int i = 0 ; i < _memberCount ; i++)
- if (! _memberTypes[i].equal(tc.member_type(i)))
- return false;
- // ignore id and names since those are optional.
- return true;
- }
-
- case TCKind._tk_enum:
- {
- // check for repository id
- if (_id.compareTo(tc.id()) != 0)
- return false;
- // check member count
- if (_memberCount != tc.member_count())
- return false;
- // ignore names since those are optional.
- return true;
- }
-
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- {
- // check bound/length
- if (_length != tc.length()) {
- return false;
- }
- // check content type
- if (! lazy_content_type().equal(tc.content_type())) {
- return false;
- }
- // ignore id and name since those are optional.
- return true;
- }
-
- case TCKind._tk_value:
- {
- // check for member count
- if (_memberCount != tc.member_count())
- return false;
- // check for repository id
- if (_id.compareTo(tc.id()) != 0)
- return false;
- // check for member types.
- for (int i = 0 ; i < _memberCount ; i++)
- if (_memberAccess[i] != tc.member_visibility(i) ||
- ! _memberTypes[i].equal(tc.member_type(i)))
- return false;
- if (_type_modifier == tc.type_modifier())
- return false;
- // concrete_base may be null
- TypeCode tccb = tc.concrete_base_type();
- if ((_concrete_base == null && tccb != null) ||
- (_concrete_base != null && tccb == null) ||
- ! _concrete_base.equal(tccb))
- {
- return false;
- }
- // ignore id and names since those are optional.
- return true;
- }
-
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- {
- // check for repository id
- if (_id.compareTo(tc.id()) != 0) {
- return false;
- }
- // check for equality with the true type
- return _contentType.equal(tc.content_type());
- }
- }
- }
- } catch (org.omg.CORBA.TypeCodePackage.Bounds e) {} catch (BadKind e) {}
- // dont have to worry about these since the code ensures these dont
- // arise.
- return false;
- }
-
- /**
- * The equivalent operation is used by the ORB when determining type equivalence
- * for values stored in an IDL any.
- */
- public boolean equivalent(TypeCode tc) {
- if (tc == this) {
- return true;
- }
-
- // If the result of the kind operation on either TypeCode is tk_alias, recursively
- // replace the TypeCode with the result of calling content_type, until the kind
- // is no longer tk_alias.
- // Note: Always resolve indirect types first!
- TypeCode myRealType = (_kind == tk_indirect ? indirectType() : this);
- myRealType = realType(myRealType);
- TypeCode otherRealType = realType(tc);
-
- // If results of the kind operation on each typecode differ,
- // equivalent returns false.
- if (myRealType.kind().value() != otherRealType.kind().value()) {
- return false;
- }
-
- String myID = null;
- String otherID = null;
- try {
- myID = this.id();
- otherID = tc.id();
- // At this point the id operation is valid for both TypeCodes.
-
- // Return true if the results of id for both TypeCodes are non-empty strings
- // and both strings are equal.
- // If both ids are non-empty but are not equal, then equivalent returns FALSE.
- if (myID != null && otherID != null) {
- return (myID.equals(otherID));
- }
- } catch (BadKind e) {
- // id operation is not valid for either or both TypeCodes
- }
-
- // If either or both id is an empty string, or the TypeCode kind does not support
- // the id operation, perform a structural comparison of the TypeCodes.
-
- int myKind = myRealType.kind().value();
- try {
- if (myKind == TCKind._tk_struct ||
- myKind == TCKind._tk_union ||
- myKind == TCKind._tk_enum ||
- myKind == TCKind._tk_except ||
- myKind == TCKind._tk_value)
- {
- if (myRealType.member_count() != otherRealType.member_count())
- return false;
- }
- if (myKind == TCKind._tk_union)
- {
- if (myRealType.default_index() != otherRealType.default_index())
- return false;
- }
- if (myKind == TCKind._tk_string ||
- myKind == TCKind._tk_wstring ||
- myKind == TCKind._tk_sequence ||
- myKind == TCKind._tk_array)
- {
- if (myRealType.length() != otherRealType.length())
- return false;
- }
- if (myKind == TCKind._tk_fixed)
- {
- if (myRealType.fixed_digits() != otherRealType.fixed_digits() ||
- myRealType.fixed_scale() != otherRealType.fixed_scale())
- return false;
- }
- if (myKind == TCKind._tk_union)
- {
- for (int i=0; i<myRealType.member_count(); i++) {
- if (myRealType.member_label(i) != otherRealType.member_label(i))
- return false;
- }
- if ( ! myRealType.discriminator_type().equivalent(
- otherRealType.discriminator_type()))
- return false;
- }
- if (myKind == TCKind._tk_alias ||
- myKind == TCKind._tk_value_box ||
- myKind == TCKind._tk_sequence ||
- myKind == TCKind._tk_array)
- {
- if ( ! myRealType.content_type().equivalent(otherRealType.content_type()))
- return false;
- }
- if (myKind == TCKind._tk_struct ||
- myKind == TCKind._tk_union ||
- myKind == TCKind._tk_except ||
- myKind == TCKind._tk_value)
- {
- for (int i=0; i<myRealType.member_count(); i++) {
- if ( ! myRealType.member_type(i).equivalent(
- otherRealType.member_type(i)))
- return false;
- }
- }
- } catch (BadKind e) {
- // impossible if we checked correctly above
- throw wrapper.badkindCannotOccur() ;
- } catch (org.omg.CORBA.TypeCodePackage.Bounds e) {
- // impossible if we checked correctly above
- throw wrapper.boundsCannotOccur() ;
- }
-
- // Structural comparison succeeded!
- return true;
- }
-
- public TypeCode get_compact_typecode() {
- // _REVISIT_ It isn't clear whether this method should operate on this or a copy.
- // For now just return this unmodified because the name and member_name fields
- // aren't used for comparison anyways.
- return this;
- }
-
- public TCKind kind()
- {
- if (_kind == tk_indirect)
- return indirectType().kind();
- return TCKind.from_int(_kind);
- }
-
- public boolean is_recursive()
- {
- // Recursive is the only form of indirect type codes right now.
- // Indirection can also be used for repeated type codes.
- return (_kind == tk_indirect);
- }
-
- public String id()
- throws BadKind
- {
- switch (_kind) {
- case tk_indirect:
- //return indirectType().id(); // same as _id
- case TCKind._tk_except:
- case TCKind._tk_objref:
- case TCKind._tk_struct:
- case TCKind._tk_union:
- case TCKind._tk_enum:
- case TCKind._tk_alias:
- case TCKind._tk_value:
- case TCKind._tk_value_box:
- case TCKind._tk_native:
- case TCKind._tk_abstract_interface:
- // exception and objref typecodes must have a repository id.
- // structs, unions, enums, and aliases may or may not.
- return _id;
- default:
- // all other typecodes throw the BadKind exception.
- throw new BadKind();
- }
- }
-
- public String name()
- throws BadKind
- {
- switch (_kind) {
- case tk_indirect:
- return indirectType().name();
- case TCKind._tk_except:
- case TCKind._tk_objref:
- case TCKind._tk_struct:
- case TCKind._tk_union:
- case TCKind._tk_enum:
- case TCKind._tk_alias:
- case TCKind._tk_value:
- case TCKind._tk_value_box:
- case TCKind._tk_native:
- case TCKind._tk_abstract_interface:
- return _name;
- default:
- throw new BadKind();
- }
- }
-
- public int member_count()
- throws BadKind
- {
- switch (_kind) {
- case tk_indirect:
- return indirectType().member_count();
- case TCKind._tk_except:
- case TCKind._tk_struct:
- case TCKind._tk_union:
- case TCKind._tk_enum:
- case TCKind._tk_value:
- return _memberCount;
- default:
- throw new BadKind();
- }
- }
-
- public String member_name(int index)
- throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
- {
- switch (_kind) {
- case tk_indirect:
- return indirectType().member_name(index);
- case TCKind._tk_except:
- case TCKind._tk_struct:
- case TCKind._tk_union:
- case TCKind._tk_enum:
- case TCKind._tk_value:
- try {
- return _memberNames[index];
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new org.omg.CORBA.TypeCodePackage.Bounds();
- }
- default:
- throw new BadKind();
- }
- }
-
- public TypeCode member_type(int index)
- throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
- {
- switch (_kind) {
- case tk_indirect:
- return indirectType().member_type(index);
- case TCKind._tk_except:
- case TCKind._tk_struct:
- case TCKind._tk_union:
- case TCKind._tk_value:
- try {
- return _memberTypes[index];
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new org.omg.CORBA.TypeCodePackage.Bounds();
- }
- default:
- throw new BadKind();
- }
- }
-
- public Any member_label(int index)
- throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
- {
- switch (_kind) {
- case tk_indirect:
- return indirectType().member_label(index);
- case TCKind._tk_union:
- try {
- // _REVISIT_ Why create a new Any for this?
- return new AnyImpl(_orb, _unionLabels[index]);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new org.omg.CORBA.TypeCodePackage.Bounds();
- }
- default:
- throw new BadKind();
- }
- }
-
- public TypeCode discriminator_type()
- throws BadKind
- {
- switch (_kind) {
- case tk_indirect:
- return indirectType().discriminator_type();
- case TCKind._tk_union:
- return _discriminator;
- default:
- throw new BadKind();
- }
- }
-
- public int default_index()
- throws BadKind
- {
- switch (_kind) {
- case tk_indirect:
- return indirectType().default_index();
- case TCKind._tk_union:
- return _defaultIndex;
- default:
- throw new BadKind();
- }
- }
-
- public int length()
- throws BadKind
- {
- switch (_kind) {
- case tk_indirect:
- return indirectType().length();
- case TCKind._tk_string:
- case TCKind._tk_wstring:
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- return _length;
- default:
- throw new BadKind();
- }
- }
-
- public TypeCode content_type()
- throws BadKind
- {
- switch (_kind) {
- case tk_indirect:
- return indirectType().content_type();
- case TCKind._tk_sequence:
- return lazy_content_type();
- case TCKind._tk_array:
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- return _contentType;
- default:
- throw new BadKind();
- }
- }
-
- public short fixed_digits() throws BadKind {
- switch (_kind) {
- case TCKind._tk_fixed:
- return _digits;
- default:
- throw new BadKind();
- }
- }
-
- public short fixed_scale() throws BadKind {
- switch (_kind) {
- case TCKind._tk_fixed:
- return _scale;
- default:
- throw new BadKind();
- }
- }
-
- public short member_visibility(int index) throws BadKind,
- org.omg.CORBA.TypeCodePackage.Bounds {
- switch (_kind) {
- case tk_indirect:
- return indirectType().member_visibility(index);
- case TCKind._tk_value:
- try {
- return _memberAccess[index];
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new org.omg.CORBA.TypeCodePackage.Bounds();
- }
- default:
- throw new BadKind();
- }
- }
-
- public short type_modifier() throws BadKind {
- switch (_kind) {
- case tk_indirect:
- return indirectType().type_modifier();
- case TCKind._tk_value:
- return _type_modifier;
- default:
- throw new BadKind();
- }
- }
-
- public TypeCode concrete_base_type() throws BadKind {
- switch (_kind) {
- case tk_indirect:
- return indirectType().concrete_base_type();
- case TCKind._tk_value:
- return _concrete_base;
- default:
- throw new BadKind();
- }
- }
-
- public void read_value(InputStream is) {
- if (is instanceof TypeCodeReader) {
- // hardly possible unless caller knows our "private" stream classes.
- if (read_value_kind((TypeCodeReader)is))
- read_value_body(is);
- } else if (is instanceof CDRInputStream) {
- WrapperInputStream wrapper = new WrapperInputStream((CDRInputStream)is);
- //if (debug) System.out.println("Created WrapperInputStream " + wrapper +
- // " with no parent");
- if (read_value_kind((TypeCodeReader)wrapper))
- read_value_body(wrapper);
- } else {
- read_value_kind(is);
- read_value_body(is);
- }
- }
-
- private void read_value_recursive(TypeCodeInputStream is) {
- // don't wrap a CDRInputStream reading "inner" TypeCodes.
- if (is instanceof TypeCodeReader) {
- if (read_value_kind((TypeCodeReader)is))
- read_value_body(is);
- } else {
- read_value_kind((InputStream)is);
- read_value_body(is);
- }
- }
-
- boolean read_value_kind(TypeCodeReader tcis)
- {
- _kind = tcis.read_long();
-
- // Bug fix 5034649: allow for padding that precedes the typecode kind.
- int myPosition = tcis.getTopLevelPosition()-4;
-
- // check validity of kind
- if ((_kind < 0 || _kind > typeTable.length) && _kind != tk_indirect) {
- throw wrapper.cannotMarshalBadTckind() ;
- }
-
- // Don't do any work if this is native
- if (_kind == TCKind._tk_native)
- throw wrapper.cannotMarshalNative() ;
-
- // We have to remember the stream and position for EVERY type code
- // in case some recursive or indirect type code references it.
- TypeCodeReader topStream = tcis.getTopLevelStream();
-
- if (_kind == tk_indirect) {
- int streamOffset = tcis.read_long();
- if (streamOffset > -4)
- throw wrapper.invalidIndirection( new Integer(streamOffset) ) ;
-
- // The encoding used for indirection is the same as that used for recursive ,
- // TypeCodes i.e., a 0xffffffff indirection marker followed by a long offset
- // (in units of octets) from the beginning of the long offset.
- int topPos = tcis.getTopLevelPosition();
- // substract 4 to get back to the beginning of the long offset.
- int indirectTypePosition = topPos - 4 + streamOffset;
-
- // Now we have to find the referenced type
- // by its indirectTypePosition within topStream.
- //if (debug) System.out.println(
- // "TypeCodeImpl looking up indirection at position topPos " +
- //topPos + " - 4 + offset " + streamOffset + " = " + indirectTypePosition);
- TypeCodeImpl type = topStream.getTypeCodeAtPosition(indirectTypePosition);
- if (type == null)
- throw wrapper.indirectionNotFound( new Integer(indirectTypePosition) ) ;
- setIndirectType(type);
- return false;
- }
-
- topStream.addTypeCodeAtPosition(this, myPosition);
- return true;
- }
-
- void read_value_kind(InputStream is) {
- // unmarshal the kind
- _kind = is.read_long();
-
- // check validity of kind
- if ((_kind < 0 || _kind > typeTable.length) && _kind != tk_indirect) {
- throw wrapper.cannotMarshalBadTckind() ;
- }
- // Don't do any work if this is native
- if (_kind == TCKind._tk_native)
- throw wrapper.cannotMarshalNative() ;
-
- if (_kind == tk_indirect) {
- throw wrapper.recursiveTypecodeError() ;
- }
- }
-
- void read_value_body(InputStream is) {
- // start unmarshaling the rest of the typecode, based on the
- // encoding (empty, simple or complex).
-
- switch (typeTable[_kind]) {
- case EMPTY:
- // nothing to unmarshal
- break;
-
- case SIMPLE:
- switch (_kind) {
- case TCKind._tk_string:
- case TCKind._tk_wstring:
- _length = is.read_long();
- break;
- case TCKind._tk_fixed:
- _digits = is.read_ushort();
- _scale = is.read_short();
- break;
- default:
- throw wrapper.invalidSimpleTypecode() ;
- }
- break;
-
- case COMPLEX:
- {
- TypeCodeInputStream _encap = TypeCodeInputStream.readEncapsulation(is,
- is.orb());
-
- switch(_kind) {
-
- case TCKind._tk_objref:
- case TCKind._tk_abstract_interface:
- {
- // get the repository id
- setId(_encap.read_string());
- // get the name
- _name = _encap.read_string();
- }
- break;
-
- case TCKind._tk_union:
- {
- // get the repository id
- setId(_encap.read_string());
-
- // get the name
- _name = _encap.read_string();
-
- // discriminant typecode
- _discriminator = new TypeCodeImpl((ORB)is.orb());
- _discriminator.read_value_recursive(_encap);
-
- // default index
- _defaultIndex = _encap.read_long();
-
- // get the number of members
- _memberCount = _encap.read_long();
-
- // create arrays for the label values, names and types of members
- _unionLabels = new AnyImpl[_memberCount];
- _memberNames = new String[_memberCount];
- _memberTypes = new TypeCodeImpl[_memberCount];
-
- // read off label values, names and types
- for (int i=0; i < _memberCount; i++) {
- _unionLabels[i] = new AnyImpl((ORB)is.orb());
- if (i == _defaultIndex)
- // for the default case, read off the zero octet
- _unionLabels[i].insert_octet(_encap.read_octet());
- else {
- switch (realType(_discriminator).kind().value()) {
- case TCKind._tk_short:
- _unionLabels[i].insert_short(_encap.read_short());
- break;
- case TCKind._tk_long:
- _unionLabels[i].insert_long(_encap.read_long());
- break;
- case TCKind._tk_ushort:
- _unionLabels[i].insert_ushort(_encap.read_short());
- break;
- case TCKind._tk_ulong:
- _unionLabels[i].insert_ulong(_encap.read_long());
- break;
- case TCKind._tk_float:
- _unionLabels[i].insert_float(_encap.read_float());
- break;
- case TCKind._tk_double:
- _unionLabels[i].insert_double(_encap.read_double());
- break;
- case TCKind._tk_boolean:
- _unionLabels[i].insert_boolean(_encap.read_boolean());
- break;
- case TCKind._tk_char:
- _unionLabels[i].insert_char(_encap.read_char());
- break;
- case TCKind._tk_enum:
- _unionLabels[i].type(_discriminator);
- _unionLabels[i].insert_long(_encap.read_long());
- break;
- case TCKind._tk_longlong:
- _unionLabels[i].insert_longlong(_encap.read_longlong());
- break;
- case TCKind._tk_ulonglong:
- _unionLabels[i].insert_ulonglong(_encap.read_longlong());
- break;
- // _REVISIT_ figure out long double mapping
- // case TCKind.tk_longdouble:
- // _unionLabels[i].insert_longdouble(_encap.getDouble());
- // break;
- case TCKind._tk_wchar:
- _unionLabels[i].insert_wchar(_encap.read_wchar());
- break;
- default:
- throw wrapper.invalidComplexTypecode() ;
- }
- }
- _memberNames[i] = _encap.read_string();
- _memberTypes[i] = new TypeCodeImpl((ORB)is.orb());
- _memberTypes[i].read_value_recursive(_encap);
- _memberTypes[i].setParent(this);
- }
- }
- break;
-
- case TCKind._tk_enum:
- {
- // get the repository id
- setId(_encap.read_string());
-
- // get the name
- _name = _encap.read_string();
-
- // get the number of members
- _memberCount = _encap.read_long();
-
- // create arrays for the identifier names
- _memberNames = new String[_memberCount];
-
- // read off identifier names
- for (int i=0; i < _memberCount; i++)
- _memberNames[i] = _encap.read_string();
- }
- break;
-
- case TCKind._tk_sequence:
- {
- // get the type of the sequence
- _contentType = new TypeCodeImpl((ORB)is.orb());
- _contentType.read_value_recursive(_encap);
-
- // get the bound on the length of the sequence
- _length = _encap.read_long();
- }
- break;
-
- case TCKind._tk_array:
- {
- // get the type of the array
- _contentType = new TypeCodeImpl((ORB)is.orb());
- _contentType.read_value_recursive(_encap);
-
- // get the length of the array
- _length = _encap.read_long();
- }
- break;
-
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- {
- // get the repository id
- setId(_encap.read_string());
-
- // get the name
- _name = _encap.read_string();
-
- // get the type aliased
- _contentType = new TypeCodeImpl((ORB)is.orb());
- _contentType.read_value_recursive(_encap);
- }
- break;
-
- case TCKind._tk_except:
- case TCKind._tk_struct:
- {
- // get the repository id
- setId(_encap.read_string());
-
- // get the name
- _name = _encap.read_string();
-
- // get the number of members
- _memberCount = _encap.read_long();
-
- // create arrays for the names and types of members
- _memberNames = new String[_memberCount];
- _memberTypes = new TypeCodeImpl[_memberCount];
-
- // read off member names and types
- for (int i=0; i < _memberCount; i++) {
- _memberNames[i] = _encap.read_string();
- _memberTypes[i] = new TypeCodeImpl((ORB)is.orb());
- //if (debug) System.out.println("TypeCode " + _name +
- // " reading member " + _memberNames[i]);
- _memberTypes[i].read_value_recursive(_encap);
- _memberTypes[i].setParent(this);
- }
- }
- break;
-
- case TCKind._tk_value:
- {
- // get the repository id
- setId(_encap.read_string());
-
- // get the name
- _name = _encap.read_string();
-
- // get the type modifier
- _type_modifier = _encap.read_short();
-
- // get the type aliased
- _concrete_base = new TypeCodeImpl((ORB)is.orb());
- _concrete_base.read_value_recursive(_encap);
- if (_concrete_base.kind().value() == TCKind._tk_null) {
- _concrete_base = null;
- }
-
- // get the number of members
- _memberCount = _encap.read_long();
-
- // create arrays for the names, types and visibility of members
- _memberNames = new String[_memberCount];
- _memberTypes = new TypeCodeImpl[_memberCount];
- _memberAccess = new short[_memberCount];
-
- // read off value member visibilities
- for (int i=0; i < _memberCount; i++) {
- _memberNames[i] = _encap.read_string();
- _memberTypes[i] = new TypeCodeImpl((ORB)is.orb());
- //if (debug) System.out.println("TypeCode " + _name +
- // " reading member " + _memberNames[i]);
- _memberTypes[i].read_value_recursive(_encap);
- _memberTypes[i].setParent(this);
- _memberAccess[i] = _encap.read_short();
- }
- }
- break;
-
- default:
- throw wrapper.invalidTypecodeKindMarshal() ;
- }
- break;
- }
- }
- }
-
- public void write_value(OutputStream os) {
- // Wrap OutputStream into TypeCodeOutputStream.
- // This test shouldn't be necessary according to the Java language spec.
- if (os instanceof TypeCodeOutputStream) {
- this.write_value((TypeCodeOutputStream)os);
- } else {
- TypeCodeOutputStream wrapperOutStream = null;
-
- if (outBuffer == null) {
- wrapperOutStream = TypeCodeOutputStream.wrapOutputStream(os);
- this.write_value(wrapperOutStream);
- if (cachingEnabled) {
- // Cache the buffer for repeated writes
- outBuffer = wrapperOutStream.getTypeCodeBuffer();
- //if (outBuffer != null)
- //System.out.println("Caching outBuffer with length = " +
- //outBuffer.length + " for id = " + _id);
- }
- } else {
- //System.out.println("Using cached outBuffer: length = " + outBuffer.length +
- //", id = " + _id);
- }
- // Write the first 4 bytes first to trigger alignment.
- // We know that it is the kind.
- if (cachingEnabled && outBuffer != null) {
- os.write_long(_kind);
- os.write_octet_array(outBuffer, 0, outBuffer.length);
- } else {
- //System.out.println("Buffer is empty for " + _id);
- wrapperOutStream.writeRawBuffer(os, _kind);
- }
- }
- }
-
- public void write_value(TypeCodeOutputStream tcos) {
-
- // Don't do any work if this is native
- if (_kind == TCKind._tk_native)
- throw wrapper.cannotMarshalNative() ;
-
- TypeCodeOutputStream topStream = tcos.getTopLevelStream();
- //if (debug) tcos.printBuffer();
-
- if (_kind == tk_indirect) {
- //if (debug) System.out.println("Writing indirection " + _name + "to " + _id);
- // The encoding used for indirection is the same as that used for recursive ,
- // TypeCodes i.e., a 0xffffffff indirection marker followed by a long offset
- // (in units of octets) from the beginning of the long offset.
- int pos = topStream.getPositionForID(_id);
- int topPos = tcos.getTopLevelPosition();
- //if (debug) System.out.println("TypeCodeImpl " + tcos +
- // " writing indirection " + _id +
- //" to position " + pos + " at position " + topPos);
- tcos.writeIndirection(tk_indirect, pos);
- // All that gets written is _kind and offset.
- return;
- }
-
- // The original approach changed for 5034649
- // topStream.addIDAtPosition(_id, tcos.getTopLevelPosition());
-
- // marshal the kind
- tcos.write_long(_kind);
-
- //if (debug) System.out.println("Writing " + _name + " with id " + _id);
- // We have to remember the stream and position for EVERY type code
- // in case some recursive or indirect type code references it.
- //
- // Bug fix 5034649:
- // Do this AFTER the write of the _kind in case the alignment
- // for the long changes the position.
- topStream.addIDAtPosition(_id, tcos.getTopLevelPosition()-4);
-
- switch (typeTable[_kind]) {
- case EMPTY:
- // nothing more to marshal
- break;
-
- case SIMPLE:
- switch (_kind) {
- case TCKind._tk_string:
- case TCKind._tk_wstring:
- // marshal the bound on string length
- tcos.write_long(_length);
- break;
- case TCKind._tk_fixed:
- tcos.write_ushort(_digits);
- tcos.write_short(_scale);
- break;
- default:
- // unknown typecode kind
- throw wrapper.invalidSimpleTypecode() ;
- }
- break;
-
- case COMPLEX:
- {
- // create an encapsulation
- TypeCodeOutputStream _encap = tcos.createEncapsulation(tcos.orb());
-
- switch(_kind) {
-
- case TCKind._tk_objref:
- case TCKind._tk_abstract_interface:
- {
- // put the repository id
- _encap.write_string(_id);
-
- // put the name
- _encap.write_string(_name);
- }
- break;
-
- case TCKind._tk_union:
- {
- // put the repository id
- _encap.write_string(_id);
-
- // put the name
- _encap.write_string(_name);
-
- // discriminant typecode
- _discriminator.write_value(_encap);
-
- // default index
- _encap.write_long(_defaultIndex);
-
- // put the number of members
- _encap.write_long(_memberCount);
-
- // marshal label values, names and types
- for (int i=0; i < _memberCount; i++) {
-
- // for the default case, marshal the zero octet
- if (i == _defaultIndex)
- _encap.write_octet(_unionLabels[i].extract_octet());
-
- else {
- switch (realType(_discriminator).kind().value()) {
- case TCKind._tk_short:
- _encap.write_short(_unionLabels[i].extract_short());
- break;
- case TCKind._tk_long:
- _encap.write_long(_unionLabels[i].extract_long());
- break;
- case TCKind._tk_ushort:
- _encap.write_short(_unionLabels[i].extract_ushort());
- break;
- case TCKind._tk_ulong:
- _encap.write_long(_unionLabels[i].extract_ulong());
- break;
- case TCKind._tk_float:
- _encap.write_float(_unionLabels[i].extract_float());
- break;
- case TCKind._tk_double:
- _encap.write_double(_unionLabels[i].extract_double());
- break;
- case TCKind._tk_boolean:
- _encap.write_boolean(_unionLabels[i].extract_boolean());
- break;
- case TCKind._tk_char:
- _encap.write_char(_unionLabels[i].extract_char());
- break;
- case TCKind._tk_enum:
- _encap.write_long(_unionLabels[i].extract_long());
- break;
- case TCKind._tk_longlong:
- _encap.write_longlong(_unionLabels[i].extract_longlong());
- break;
- case TCKind._tk_ulonglong:
- _encap.write_longlong(_unionLabels[i].extract_ulonglong());
- break;
- // _REVISIT_ figure out long double mapping
- // case TCKind.tk_longdouble:
- // _encap.putDouble(_unionLabels[i].extract_longdouble());
- // break;
- case TCKind._tk_wchar:
- _encap.write_wchar(_unionLabels[i].extract_wchar());
- break;
- default:
- throw wrapper.invalidComplexTypecode() ;
- }
- }
- _encap.write_string(_memberNames[i]);
- _memberTypes[i].write_value(_encap);
- }
- }
- break;
-
- case TCKind._tk_enum:
- {
- // put the repository id
- _encap.write_string(_id);
-
- // put the name
- _encap.write_string(_name);
-
- // put the number of members
- _encap.write_long(_memberCount);
-
- // marshal identifier names
- for (int i=0; i < _memberCount; i++)
- _encap.write_string(_memberNames[i]);
- }
- break;
-
- case TCKind._tk_sequence:
- {
- // put the type of the sequence
- lazy_content_type().write_value(_encap);
-
- // put the bound on the length of the sequence
- _encap.write_long(_length);
- }
- break;
-
- case TCKind._tk_array:
- {
- // put the type of the array
- _contentType.write_value(_encap);
-
- // put the length of the array
- _encap.write_long(_length);
- }
- break;
-
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- {
- // put the repository id
- _encap.write_string(_id);
-
- // put the name
- _encap.write_string(_name);
-
- // put the type aliased
- _contentType.write_value(_encap);
- }
- break;
-
- case TCKind._tk_struct:
- case TCKind._tk_except:
- {
- // put the repository id
- _encap.write_string(_id);
-
- // put the name
- _encap.write_string(_name);
-
- // put the number of members
- _encap.write_long(_memberCount);
-
- // marshal member names and types
- for (int i=0; i < _memberCount; i++) {
- _encap.write_string(_memberNames[i]);
- //if (debug) System.out.println("TypeCode " + _name +
- // " writing member " + _memberNames[i]);
- _memberTypes[i].write_value(_encap);
- }
- }
- break;
-
- case TCKind._tk_value:
- {
- // put the repository id
- _encap.write_string(_id);
-
- // put the name
- _encap.write_string(_name);
-
- // put the type modifier
- _encap.write_short(_type_modifier);
-
- // put the type aliased
- if (_concrete_base == null) {
- _orb.get_primitive_tc(TCKind._tk_null).write_value(_encap);
- } else {
- _concrete_base.write_value(_encap);
- }
-
- // put the number of members
- _encap.write_long(_memberCount);
-
- // marshal member names and types
- for (int i=0; i < _memberCount; i++) {
- _encap.write_string(_memberNames[i]);
- //if (debug) System.out.println("TypeCode " + _name +
- // " writing member " + _memberNames[i]);
- _memberTypes[i].write_value(_encap);
- _encap.write_short(_memberAccess[i]);
- }
- }
- break;
-
- default:
- throw wrapper.invalidTypecodeKindMarshal() ;
- }
-
- // marshal the encapsulation
- _encap.writeOctetSequenceTo(tcos);
- break;
- }
- }
- }
-
- /**
- * This is not a copy of the TypeCodeImpl objects, but instead it
- * copies the value this type code is representing.
- * See AnyImpl read_value and write_value for usage.
- * The state of this TypeCodeImpl instance isn't changed, only used
- * by the Any to do the correct copy.
- */
- protected void copy(org.omg.CORBA.portable.InputStream src,
- org.omg.CORBA.portable.OutputStream dst)
- {
- switch (_kind) {
-
- case TCKind._tk_null:
- case TCKind._tk_void:
- case TCKind._tk_native:
- case TCKind._tk_abstract_interface:
- break;
-
- case TCKind._tk_short:
- case TCKind._tk_ushort:
- dst.write_short(src.read_short());
- break;
-
- case TCKind._tk_long:
- case TCKind._tk_ulong:
- dst.write_long(src.read_long());
- break;
-
- case TCKind._tk_float:
- dst.write_float(src.read_float());
- break;
-
- case TCKind._tk_double:
- dst.write_double(src.read_double());
- break;
-
- case TCKind._tk_longlong:
- case TCKind._tk_ulonglong:
- dst.write_longlong(src.read_longlong());
- break;
-
- case TCKind._tk_longdouble:
- throw wrapper.tkLongDoubleNotSupported() ;
-
- case TCKind._tk_boolean:
- dst.write_boolean(src.read_boolean());
- break;
-
- case TCKind._tk_char:
- dst.write_char(src.read_char());
- break;
-
- case TCKind._tk_wchar:
- dst.write_wchar(src.read_wchar());
- break;
-
- case TCKind._tk_octet:
- dst.write_octet(src.read_octet());
- break;
-
- case TCKind._tk_string:
- {
- String s;
- s = src.read_string();
- // make sure length bound in typecode is not violated
- if ((_length != 0) && (s.length() > _length))
- throw wrapper.badStringBounds( new Integer(s.length()),
- new Integer(_length) ) ;
- dst.write_string(s);
- }
- break;
-
- case TCKind._tk_wstring:
- {
- String s;
- s = src.read_wstring();
- // make sure length bound in typecode is not violated
- if ((_length != 0) && (s.length() > _length))
- throw wrapper.badStringBounds( new Integer(s.length()),
- new Integer(_length) ) ;
- dst.write_wstring(s);
- }
- break;
-
- case TCKind._tk_fixed:
- {
- dst.write_ushort(src.read_ushort());
- dst.write_short(src.read_short());
- }
- break;
-
- case TCKind._tk_any:
- {
- //Any tmp = new AnyImpl(_orb);
- Any tmp = ((CDRInputStream)src).orb().create_any();
- TypeCodeImpl t = new TypeCodeImpl((ORB)dst.orb());
- t.read_value((org.omg.CORBA_2_3.portable.InputStream)src);
- t.write_value((org.omg.CORBA_2_3.portable.OutputStream)dst);
- tmp.read_value(src, t);
- tmp.write_value(dst);
- break;
- }
-
- case TCKind._tk_TypeCode:
- {
- dst.write_TypeCode(src.read_TypeCode());
- break;
- }
-
- case TCKind._tk_Principal:
- {
- dst.write_Principal(src.read_Principal());
- break;
- }
-
- case TCKind._tk_objref:
- {
- dst.write_Object(src.read_Object());
- break;
- }
-
- case TCKind._tk_except:
- // Copy repositoryId
- dst.write_string(src.read_string());
-
- // Fall into ...
- // _REVISIT_ what about the inherited members of this values concrete base type?
- case TCKind._tk_value:
- case TCKind._tk_struct:
- {
- // copy each element, using the corresponding member type
- for (int i=0; i < _memberTypes.length; i++) {
- _memberTypes[i].copy(src, dst);
- }
- break;
- }
- case TCKind._tk_union:
- /* _REVISIT_ More generic code?
- {
- Any discriminator = new AnyImpl(_orb);
- discriminator.read_value(src, _discriminator);
- discriminator.write_value(dst);
- int labelIndex = currentUnionMemberIndex(discriminator);
- if (labelIndex == -1) {
- // check if label has not been found
- if (_defaultIndex == -1)
- // throw exception if default was not expected
- throw new MARSHAL();
- else
- // must be of the default branch type
- _memberTypes[_defaultIndex].copy(src, dst);
- } else {
- _memberTypes[labelIndex].copy(src, dst);
- }
- }
- */
- {
- Any tagValue = new AnyImpl( (ORB)src.orb());
-
- switch (realType(_discriminator).kind().value()) {
- case TCKind._tk_short:
- {
- short value = src.read_short();
- tagValue.insert_short(value);
- dst.write_short(value);
- break;
- }
- case TCKind._tk_long:
- {
- int value = src.read_long();
- tagValue.insert_long(value);
- dst.write_long(value);
- break;
- }
- case TCKind._tk_ushort:
- {
- short value = src.read_short();
- tagValue.insert_ushort(value);
- dst.write_short(value);
- break;
- }
- case TCKind._tk_ulong:
- {
- int value = src.read_long();
- tagValue.insert_ulong(value);
- dst.write_long(value);
- break;
- }
- case TCKind._tk_float:
- {
- float value = src.read_float();
- tagValue.insert_float(value);
- dst.write_float(value);
- break;
- }
- case TCKind._tk_double:
- {
- double value = src.read_double();
- tagValue.insert_double(value);
- dst.write_double(value);
- break;
- }
- case TCKind._tk_boolean:
- {
- boolean value = src.read_boolean();
- tagValue.insert_boolean(value);
- dst.write_boolean(value);
- break;
- }
- case TCKind._tk_char:
- {
- char value = src.read_char();
- tagValue.insert_char(value);
- dst.write_char(value);
- break;
- }
- case TCKind._tk_enum:
- {
- int value = src.read_long();
- tagValue.type(_discriminator);
- tagValue.insert_long(value);
- dst.write_long(value);
- break;
- }
- case TCKind._tk_longlong:
- {
- long value = src.read_longlong();
- tagValue.insert_longlong(value);
- dst.write_longlong(value);
- break;
- }
- case TCKind._tk_ulonglong:
- {
- long value = src.read_longlong();
- tagValue.insert_ulonglong(value);
- dst.write_longlong(value);
- break;
- }
- // _REVISIT_ figure out long double mapping
- // case TCKind.tk_longdouble:
- // {
- // double value = src.read_double();
- // tagValue.insert_longdouble(value);
- // dst.putDouble(value);
- // break;
- //}
- case TCKind._tk_wchar:
- {
- char value = src.read_wchar();
- tagValue.insert_wchar(value);
- dst.write_wchar(value);
- break;
- }
- default:
- throw wrapper.illegalUnionDiscriminatorType() ;
- }
-
- // using the value of the tag, find out the type of the value
- // following.
-
- int labelIndex;
- for (labelIndex = 0; labelIndex < _unionLabels.length; labelIndex++) {
- // use equality over anys
- if (tagValue.equal(_unionLabels[labelIndex])) {
- _memberTypes[labelIndex].copy(src, dst);
- break;
- }
- }
-
- if (labelIndex == _unionLabels.length) {
- // check if label has not been found
- if (_defaultIndex != -1)
- // must be of the default branch type
- _memberTypes[_defaultIndex].copy(src, dst);
- }
- break;
- }
-
- case TCKind._tk_enum:
- dst.write_long(src.read_long());
- break;
-
- case TCKind._tk_sequence:
- // get the length of the sequence
- int seqLength = src.read_long();
-
- // check for sequence bound violated
- if ((_length != 0) && (seqLength > _length))
- throw wrapper.badSequenceBounds( new Integer(seqLength),
- new Integer(_length) ) ;
-
- // write the length of the sequence
- dst.write_long(seqLength);
-
- // copy each element of the seq using content type
- lazy_content_type(); // make sure it's resolved
- for (int i=0; i < seqLength; i++)
- _contentType.copy(src, dst);
- break;
-
- case TCKind._tk_array:
- // copy each element of the array using content type
- for (int i=0; i < _length; i++)
- _contentType.copy(src, dst);
- break;
-
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- // follow the alias
- _contentType.copy(src, dst);
- break;
-
- case tk_indirect:
- // need to follow offset, get unmarshal typecode from that
- // offset, and use that to do the copy
- // Don't need to read type code before using it to do the copy.
- // It should be fully usable.
- indirectType().copy(src, dst);
- break;
-
- default:
- throw wrapper.invalidTypecodeKindMarshal() ;
- }
- }
-
-
- static protected short digits(java.math.BigDecimal value) {
- if (value == null)
- return 0;
- short length = (short)value.unscaledValue().toString().length();
- if (value.signum() == -1)
- length--;
- return length;
- }
-
- static protected short scale(java.math.BigDecimal value) {
- if (value == null)
- return 0;
- return (short)value.scale();
- }
-
- // Utility methods
-
- // Only for union type. Returns the index of the union member
- // corresponding to the discriminator. If not found returns the
- // default index or -1 if there is no default index.
- int currentUnionMemberIndex(Any discriminatorValue) throws BadKind {
- if (_kind != TCKind._tk_union)
- throw new BadKind();
-
- try {
- for (int i=0; i<member_count(); i++) {
- if (member_label(i).equal(discriminatorValue)) {
- return i;
- }
- }
- if (_defaultIndex != -1) {
- return _defaultIndex;
- }
- } catch (BadKind bad) {
- } catch (org.omg.CORBA.TypeCodePackage.Bounds bounds) {
- }
- return -1;
- }
-
- public String description() {
- return "TypeCodeImpl with kind " + _kind + " and id " + _id;
- }
-
- public String toString() {
- ByteArrayOutputStream byteOut = new ByteArrayOutputStream(1024);
- PrintStream printOut = new PrintStream(byteOut, true);
- printStream(printOut);
- return super.toString() + " =\n" + byteOut.toString();
- }
-
- public void printStream(PrintStream s) {
- printStream(s, 0);
- }
-
- private void printStream(PrintStream s, int level) {
- if (_kind == tk_indirect) {
- s.print("indirect " + _id);
- return;
- }
-
- switch (_kind) {
- case TCKind._tk_null:
- case TCKind._tk_void:
- case TCKind._tk_short:
- case TCKind._tk_long:
- case TCKind._tk_ushort:
- case TCKind._tk_ulong:
- case TCKind._tk_float:
- case TCKind._tk_double:
- case TCKind._tk_boolean:
- case TCKind._tk_char:
- case TCKind._tk_octet:
- case TCKind._tk_any:
- case TCKind._tk_TypeCode:
- case TCKind._tk_Principal:
- case TCKind._tk_objref:
- case TCKind._tk_longlong:
- case TCKind._tk_ulonglong:
- case TCKind._tk_longdouble:
- case TCKind._tk_wchar:
- case TCKind._tk_native:
- s.print(kindNames[_kind] + " " + _name);
- break;
-
- case TCKind._tk_struct:
- case TCKind._tk_except:
- case TCKind._tk_value:
- s.println(kindNames[_kind] + " " + _name + " = {");
- for(int i=0; i<_memberCount; i++) {
- // memberName might differ from the name of the member.
- s.print(indent(level + 1));
- if (_memberTypes[i] != null)
- _memberTypes[i].printStream(s, level + 1);
- else
- s.print("<unknown type>");
- s.println(" " + _memberNames[i] + ";");
- }
- s.print(indent(level) + "}");
- break;
-
- case TCKind._tk_union:
- s.print("union " + _name + "...");
- break;
-
- case TCKind._tk_enum:
- s.print("enum " + _name + "...");
- break;
-
- case TCKind._tk_string:
- if (_length == 0)
- s.print("unbounded string " + _name);
- else
- s.print("bounded string(" + _length + ") " + _name);
- break;
-
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {");
- s.print(indent(level + 1));
- if (lazy_content_type() != null) {
- lazy_content_type().printStream(s, level + 1);
- }
- s.println(indent(level) + "}");
- break;
-
- case TCKind._tk_alias:
- s.print("alias " + _name + " = " +
- (_contentType != null ? _contentType._name : "<unresolved>"));
- break;
-
- case TCKind._tk_wstring:
- s.print("wstring[" + _length + "] " + _name);
- break;
-
- case TCKind._tk_fixed:
- s.print("fixed(" + _digits + ", " + _scale + ") " + _name);
- break;
-
- case TCKind._tk_value_box:
- s.print("valueBox " + _name + "...");
- break;
-
- case TCKind._tk_abstract_interface:
- s.print("abstractInterface " + _name + "...");
- break;
-
- default:
- s.print("<unknown type>");
- break;
- }
- }
-
- private String indent(int level) {
- String indent = "";
- for(int i=0; i<level; i++) {
- indent += " ";
- }
- return indent;
- }
-
- protected void setCaching(boolean enableCaching) {
- cachingEnabled = enableCaching;
- if (enableCaching == false)
- outBuffer = null;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImplHelper.java b/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImplHelper.java
deleted file mode 100644
index ea24c1d..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImplHelper.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-abstract public class TypeCodeImplHelper
-{
- private static String _id = "IDL:omg.org/CORBA/TypeCode:1.0";
-
- public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.TypeCode that)
- {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
- a.type (type ());
- write (out, that);
- a.read_value (out.create_input_stream (), type ());
- }
-
- public static org.omg.CORBA.TypeCode extract (org.omg.CORBA.Any a)
- {
- return read (a.create_input_stream ());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- synchronized public static org.omg.CORBA.TypeCode type ()
- {
- if (__typeCode == null)
- {
- __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode);
- }
- return __typeCode;
- }
-
- public static String id ()
- {
- return _id;
- }
-
- public static org.omg.CORBA.TypeCode read (org.omg.CORBA.portable.InputStream istream)
- {
- return istream.read_TypeCode ();
- }
-
- public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.TypeCode value)
- {
- ostream.write_TypeCode (value);
- }
-
- public static void write (org.omg.CORBA.portable.OutputStream ostream, TypeCodeImpl value)
- {
- ostream.write_TypeCode (value);
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/corba/orb_config_design.txt b/src/share/classes/com/sun/corba/se/impl/corba/orb_config_design.txt
deleted file mode 100644
index 30cf698..0000000
--- a/src/share/classes/com/sun/corba/se/impl/corba/orb_config_design.txt
+++ /dev/null
@@ -1,330 +0,0 @@
-Configuration of Properties for ORB
-
-attributes of propery:
-
-name String (* in front means OMG std, otherwise Sun internal)
-type int, String, boolean, float, class (or any class with a public XXX( String ) constructor)
-default
-
-DEBUG_PROPERTY String setDebugFlags( arg ) ( , list)
-*INITIAL_HOST_PROPERTY String set var
-*INITIAL_PORT_PROPERTY int set var, setInitialServicesPort
-SERVER_HOST_PROPERTY String set var
-SERVER_PORT_PROPERRT int set var
-*ORB_ID_PROPERTY String set var
-*INITIAL_SERVICES_PROPERTY URL setServicesURL
-*ORB_INIT_REF_PROPERTY String addORBInitRef
-*DEFAULT_INIT_REF_PROPERTY String setORBDefaultInitRef
-NUMBER_TO_RECLAIM_PROPERTY int set var
-ALLOW_LOCAL_OPTIMIZATION boolean set var
-SOCKET_FACTORY_CLASS_PROPERTY Class set var
-LISTEN_SOCKET_PROPERTY String add mapped to list ( , list of (S:I) )
-
-*PI_ORB_INITIALIZER_CLASS_PREFIX.* String map to class, instantiate, add to list
-
-PERSISTENT_SERVER_PORT_PROPERTY int setPersistentServerPort
-SERVER_ID_PROPERTY int setPersistentServerId
-BAD_SERVER_ID_HANDLER_CLASS_PROPERTY Class set var (as string)
-ACTIVATED_PROPERTY boolean set var
-
-GIOP transport specific properties:
-
-HIGH_WATER_MARK_PROPERTY int set var
-LOW_WATER_MARK_PROPERTY int set var
-GIOP_VERSION GIOPVersion set var (from int.int)
-GIOP_FRAGMENT_SIZE int set var (special checks)
-GIOP_BUFFER_SIZE int set var
-GIOP_11_BUFFMGR int set var (really enum or else 0-2)
-GIOP_12_BUFFMGR int set var (really enum or else 0-2)
-GIOP_TARGET_ADDRESSING int set mapped var (really enum or else 0-3)
-ALWAYS_SEND_CODESET_CTX_PROPERTY boolean set var
-USE_BOMS boolean set var
-USE_BOMS_IN_ENCAPS boolean set var
-CHAR_CODESETS CodeSetComponent set var
-WCHAR_CODESETS CodeSetComponent set var
-
-
-Parsers
-
-class IntParserFactory {
- static IntParser makeRangeIntParser( int min, int max ) ;
-
-}
-
-Parsing process;
-
-
-- construct
-- unify all args, properties into a single properties object props
-- for each key k in props
- - find matching ParseAction p
- - p.parse( k, props.getProperty( k ) )
-
-Design principles:
-
-1. Get config data out of ORB
- Discussion: beans framework does not work this way: instead, it creates the beans,
- which are themselves both configuration data and configured component.
-
- Two models:
- a. parse props -> create config data
- b. parse props -> create config data -> create components
-
- However, long-term bean persistence can be used in either model. Separation of
- concerns (and the large size of the ORB class) argues for separating data from
- components.
-
-2. get configuration out of ORB (except for finding config class)
- ORB responsibility:
- - gather all property, arg data together and make it available
- - load the ORB configurator and let it process the data, generate a config object
- - ORB is central registry, so ORB configurator store config data in ORB
-
-3. Extensibility is required
-
- The ORB will have large subsystems that are pluggable components (examples: aobject adaptors,
- transport plugins). Individual instances of these frameworks will have their own configuration
- data. To solve this, the ORB class will provide (read-only perhaps?) access to the collected
- properties.
-
- While the component config data is not needed in the ORB, it is needed in the ORB config data
- so that bean persistence can be used to create an XML version of the data.
-
- problem: properties vs. config data: same or not?
-
- properties: easier to use, also necessary to indicate where to get config data if not default
- config data: more powerful
-
-4. Basic principle: A parser performs an action A based on a value V when it matches a property P.
- Actions can be:
-
- configObject.setP( V )
- configObject.setP( A(V) )
- A(V)
-
-5. ParserActions are composable
-
- Basic action: Object parse( String arg, String value )
- which nicely handles prefix parsing and sharing of actions across multiple keys
-
- interface Operation {
- Object operate( String arg, String value )
- }
-
- interface OperationFactory {
- Operation booleanAction() ;
-
- Operation integerAction() ;
-
- Operation stringAction() ;
-
- Operation integerRangeAction( int min, int max ) ;
-
- Operation listAction( char sep, Operation act ) ;
- }
-
- interface ParserAction {
- void parse( String arg, String value ) ;
- }
-
- interface ParserActionFactory {
- ParserAction setFieldAction( String fieldName ) ;
-
- ParserAction setFieldAction( String fieldName, Operation op ) ;
-
- ParserAction operationAction( Operation op ) ;
- }
-
-6. Parsers are created incrementally:
-
- Constructor:
- new Parser( Class configurationDataClass )
- - has the parser class available for useful defaults
-
- interface PropertyParser {
- /** Option must look like a standard property name, which we require here to
- * be ( JavaIdent "." ) * JavaIdent. The last java ident we will call the tail.
- * If tail starts with "ORB", this option will be used in augmentWithArguments.
- * This match operates as follows:
- * Let name = tail stripped of its ORB prefix.
- * (e.g. if tail = ORBLowWaterMark, name = LowWaterMark).
- * Then if option is matched, a conversion to the result type of the method named
- * get<name> is performed, and set<name> is called on the data object to set the
- * result.
- */
- void addMatch( String option ) ;
-
- void addMatch( String option, ParserAction pa )
-
- void addPrefixMatch( String prefix, ParserAction pa )
-
- /** First constructs a new property object that has props as its default,
- * then enters args into new property object that correspond to property
- * names registered in match() calls.
- */
- Properties augmentWithArguments( Properties props, String[] args ) ;
-
- /** Parse all matched properties in props, updating data as required
- * by the actions.
- */
- void parse( Properties props, ORBConfigurationData data ) ;
- }
-
-7. A useful model:
-
- Provide
-
- abstract class ConfigDataBase {
- ConfigDataBase( Properties props )
- {
- ...
- }
- }
-
- and then a specific class
-
- public class ORBConfigData extends ConfigDataBase {
- ORBConfigData( Properties props )
- {
- super( props ) ;
- }
-
- private int foo1 = fooDefault ;
- private String foo2 = fooDefault2 ;
- private boolean foo3 = fooDefault3 ;
- private SomeObject foo4 = fooDefault4 ;
-
- public int getFoo1() { return foo1 ; }
- // and similarly
- }
-
- The constructor then uses reflection to automatically handle all of these variables with a number of
- assumptions:
- a. Standard names:
- private <type> foo { = <default> }
- public <type> getFoo() { return foo ; }
- as argument: -ORBfoo
- as property: com.sun.CORBA.foo (problems here)
- b. type specific parsing
- int: from Integer
- String: no-op
- boolean: true/false (from Boolean)
- Class: must be able to load class
- class XXX: XXX must have a public XXX( String ) constructor
-
- Custom parsing?
-
- What are valid prefixes?
- 1. provide com.sun.corba.prefix.XXX where XXX defines a prefix to look for
- (some security implications)
- 2. Extend security model to ORB implementation (I like this approach best so far)
-
-8. ORB config
-
- public interface ORBConfigurator {
- /** This method is called from ORB.init after all ORB properties have been
- * collected. The corba.ORB constructor will make sure that all required
- * registries are initialized and empty. This constructor will also initialize
- * some data used in the corba ORB public API, such as support for deferred
- * asynchronous invocation. However, all regisitration including things like
- * the dyanmic any factory should take place in the configurator. This method
- * is resonsible for making PI ORBInitializer calls, if PI is configured.
- */
- void configure( com.sun.corba.se.impl.core.ORB orb ) ;
- }
-
- The ORB will have a default configurator named
-
- com.sun.corba.se.impl.core.ORBConfiguratorImpl
-
- and also a property
-
- com.sun.CORBA.ORBConfiguratorClass
-
- than can be set to the name of the ORB configurator class to use. Note that this
- implementation can either be a straight Java implementation, or something more
- interpretive, such as an XML-based config description.
-
-9. We need to construct a list of all properties, and then make sure that security is respected.
- The basic security check is just:
-
- SecurityManager sman = System.getSecurityManager() ;
- if (sman != null)
- sman.checkPropertyAccess( key )
-
- and also
-
- sman.checkPropertiesAccess()
-
- We can construct a list of all properties as we do now, which allows the ORB
- to call System.getProperties() inside a doPrivileged() block. Then we create
- a subclass of java.util.Properties that overrides getProperty to
- do the checkPropertyAccess( key ) call. We also need to overload the
- enumerate method, either to make it illegal, call sman.checkPropertiesAccess,
- or just filter it to include only the accessible properties.
- And we also need to overload store, because it does not call enumerate internally.
-
- This allows us to provide all properties to an ORBConfigurator, while still preserving
- the security model. Then anyone that needs security can set up property permissions
- like com.foo.corba.* to allow access to only the properties they care about.
-
-10. ORB APIs
-
- The ORB needs registry support including:
- getSubcontractRegistry
- getServiceContextRegistry
-
- The ORB needs to provide access to a basic (and extensible) ORB configuration object,
- which supports at a minimum all of the standard CORBA defined properties.
-
- Also need registries for:
- ObjectAdapter (actually already in SubcontractRegistry, but needs extensions to
- ObjectAdapterFactory to work fully)
- TaggedComponentFactory
- TaggedProfileFactory
-
- What does an empty ORB provide?
- - Registration of all ORB components
- - Request dispatching to object adapters
- - Access to ORB properties data (as secure Properties object)
- - Access to ORB arguments
- - Access to ORB configuration data (base class, plus collections of base config
- data for plugins such as OAs and transports)
- - shutdown support (separate tracking of invocations vs. OA tracking in POA case?
- How should this be designed?)
- - INS support? (perhaps this could be pluggable too?)
- - How does create_output_stream get plugged in?
- - Can we separate the current IIOP transport into a TransportPluging?
- - PI support
- - CORBA::ORB API
- - NVList, DII
- - object <-> string (which includes INS?)
- - (dis)connect API for TOA (move all impl to TOAImpl?)
- - typecode/any
- - FVD
- - initial services registry
- - value factory registry
- - logging, other M&M support as needed
-
-ORB classes:
-
- core.ORB: abstract class providing internal interface
- corba.ORBImpl: internal implementation of CORBA APIs
- corba.ORBSingleton: the singleton ORB (not much change needed)
- corba.ConfigurationDataCollector: collects all source of config data and canonicalizes it
- Interceptor.PIHandler: the interface for PI
- Interceptor.PIHandlerImpl: standard implementation of PIHandler
- corba.ORBConfigurationData: extensible bean containing all ORB config data
-
-11. RequestHandler and ORB
-
- The RH interface is currently implemented in the ORB class, but might better be a separate
- class. The API is currently almost the same as a ServerSubcontract. Should we regularize
- this? Also, the API would need to be extended to handle shutdown properly.
-
- Extended API:
- - void run(): does not return until shutdown(boolean) is called.
- - shutdown(boolean) needs to be here so that requests can be
- synchhronized with shutdown. This is also a point where OAs
- need to be included (currently in shutdownServants)
-
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyBasicImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyBasicImpl.java
deleted file mode 100644
index 6a366cc..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyBasicImpl.java
+++ /dev/null
@@ -1,636 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TCKind;
-
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynAnyBasicImpl extends DynAnyImpl
-{
- //
- // Constructors
- //
-
- private DynAnyBasicImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynAnyBasicImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- // set the current position to 0 if any has components, otherwise to -1.
- index = NO_INDEX;
- }
-
- protected DynAnyBasicImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- // set the current position to 0 if any has components, otherwise to -1.
- index = NO_INDEX;
- }
-
- //
- // DynAny interface methods
- //
-
- public void assign (org.omg.DynamicAny.DynAny dyn_any)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- super.assign(dyn_any);
- index = NO_INDEX;
- }
-
- public void from_any (org.omg.CORBA.Any value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- super.from_any(value);
- index = NO_INDEX;
- }
-
- // Spec: Returns a copy of the internal Any
- public org.omg.CORBA.Any to_any() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return DynAnyUtil.copy(any, orb);
- }
-
- public boolean equal (org.omg.DynamicAny.DynAny dyn_any) {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (dyn_any == this) {
- return true;
- }
- // If the other DynAny is a constructed one we don't want it to have
- // to create its Any representation just for this test.
- if ( ! any.type().equal(dyn_any.type())) {
- return false;
- }
- //System.out.println("Comparing anys");
- return any.equal(getAny(dyn_any));
- }
-
- public void destroy() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (status == STATUS_DESTROYABLE) {
- status = STATUS_DESTROYED;
- }
- }
-
- public org.omg.DynamicAny.DynAny copy() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- // The flag "true" indicates copying the Any value
- try {
- return DynAnyUtil.createMostDerivedDynAny(any, orb, true);
- } catch (InconsistentTypeCode ictc) {
- return null; // impossible
- }
- }
-
- public org.omg.DynamicAny.DynAny current_component()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- return null;
- }
-
- public int component_count() {
- return 0;
- }
-
- public boolean next() {
- return false;
- }
-
- public boolean seek(int index) {
- return false;
- }
-
- public void rewind() {
- }
-
- public void insert_boolean(boolean value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_boolean)
- throw new TypeMismatch();
- any.insert_boolean(value);
- }
-
- public void insert_octet(byte value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_octet)
- throw new TypeMismatch();
- any.insert_octet(value);
- }
-
- public void insert_char(char value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_char)
- throw new TypeMismatch();
- any.insert_char(value);
- }
-
- public void insert_short(short value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_short)
- throw new TypeMismatch();
- any.insert_short(value);
- }
-
- public void insert_ushort(short value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_ushort)
- throw new TypeMismatch();
- any.insert_ushort(value);
- }
-
- public void insert_long(int value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_long)
- throw new TypeMismatch();
- any.insert_long(value);
- }
-
- public void insert_ulong(int value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_ulong)
- throw new TypeMismatch();
- any.insert_ulong(value);
- }
-
- public void insert_float(float value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_float)
- throw new TypeMismatch();
- any.insert_float(value);
- }
-
- public void insert_double(double value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_double)
- throw new TypeMismatch();
- any.insert_double(value);
- }
-
- public void insert_string(String value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_string)
- throw new TypeMismatch();
- if (value == null)
- throw new InvalidValue();
- // Throw InvalidValue if this is a bounded string and the length is exceeded
- try {
- if (any.type().length() > 0 && any.type().length() < value.length())
- throw new InvalidValue();
- } catch (BadKind bad) { // impossible
- }
- any.insert_string(value);
- }
-
- public void insert_reference(org.omg.CORBA.Object value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_objref)
- throw new TypeMismatch();
- any.insert_Object(value);
- }
-
- public void insert_typecode(org.omg.CORBA.TypeCode value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_TypeCode)
- throw new TypeMismatch();
- any.insert_TypeCode(value);
- }
-
- public void insert_longlong(long value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_longlong)
- throw new TypeMismatch();
- any.insert_longlong(value);
- }
-
- public void insert_ulonglong(long value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_ulonglong)
- throw new TypeMismatch();
- any.insert_ulonglong(value);
- }
-
- public void insert_wchar(char value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_wchar)
- throw new TypeMismatch();
- any.insert_wchar(value);
- }
-
- public void insert_wstring(String value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_wstring)
- throw new TypeMismatch();
- if (value == null)
- throw new InvalidValue();
- // Throw InvalidValue if this is a bounded string and the length is exceeded
- try {
- if (any.type().length() > 0 && any.type().length() < value.length())
- throw new InvalidValue();
- } catch (BadKind bad) { // impossible
- }
- any.insert_wstring(value);
- }
-
- public void insert_any(org.omg.CORBA.Any value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_any)
- throw new TypeMismatch();
- any.insert_any(value);
- }
-
- public void insert_dyn_any (org.omg.DynamicAny.DynAny value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_any)
- throw new TypeMismatch();
- // _REVISIT_ Copy value here?
- any.insert_any(value.to_any());
- }
-
- public void insert_val(java.io.Serializable value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- int kind = any.type().kind().value();
- if (kind != TCKind._tk_value && kind != TCKind._tk_value_box)
- throw new TypeMismatch();
- any.insert_Value(value);
- }
-
- public java.io.Serializable get_val()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- int kind = any.type().kind().value();
- if (kind != TCKind._tk_value && kind != TCKind._tk_value_box)
- throw new TypeMismatch();
- return any.extract_Value();
- }
-
- public boolean get_boolean()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_boolean)
- throw new TypeMismatch();
- return any.extract_boolean();
- }
-
- public byte get_octet()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_octet)
- throw new TypeMismatch();
- return any.extract_octet();
- }
-
- public char get_char()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_char)
- throw new TypeMismatch();
- return any.extract_char();
- }
-
- public short get_short()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_short)
- throw new TypeMismatch();
- return any.extract_short();
- }
-
- public short get_ushort()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_ushort)
- throw new TypeMismatch();
- return any.extract_ushort();
- }
-
- public int get_long()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_long)
- throw new TypeMismatch();
- return any.extract_long();
- }
-
- public int get_ulong()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_ulong)
- throw new TypeMismatch();
- return any.extract_ulong();
- }
-
- public float get_float()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_float)
- throw new TypeMismatch();
- return any.extract_float();
- }
-
- public double get_double()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_double)
- throw new TypeMismatch();
- return any.extract_double();
- }
-
- public String get_string()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_string)
- throw new TypeMismatch();
- return any.extract_string();
- }
-
- public org.omg.CORBA.Object get_reference()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_objref)
- throw new TypeMismatch();
- return any.extract_Object();
- }
-
- public org.omg.CORBA.TypeCode get_typecode()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_TypeCode)
- throw new TypeMismatch();
- return any.extract_TypeCode();
- }
-
- public long get_longlong()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_longlong)
- throw new TypeMismatch();
- return any.extract_longlong();
- }
-
- public long get_ulonglong()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_ulonglong)
- throw new TypeMismatch();
- return any.extract_ulonglong();
- }
-
- public char get_wchar()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_wchar)
- throw new TypeMismatch();
- return any.extract_wchar();
- }
-
- public String get_wstring()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_wstring)
- throw new TypeMismatch();
- return any.extract_wstring();
- }
-
- public org.omg.CORBA.Any get_any()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_any)
- throw new TypeMismatch();
- return any.extract_any();
- }
-
- public org.omg.DynamicAny.DynAny get_dyn_any()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_any)
- throw new TypeMismatch();
- // _REVISIT_ Copy value here?
- try {
- return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
- } catch (InconsistentTypeCode ictc) {
- // The spec doesn't allow us to throw back this exception
- // incase the anys any if of type Principal, native or abstract interface.
- return null;
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyCollectionImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyCollectionImpl.java
deleted file mode 100644
index 7643563..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyCollectionImpl.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-abstract class DynAnyCollectionImpl extends DynAnyConstructedImpl
-{
- //
- // Instance variables
- //
-
- // Keep in sync with DynAny[] components at all times.
- Any[] anys = null;
-
- //
- // Constructors
- //
-
- private DynAnyCollectionImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynAnyCollectionImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- }
-
- protected DynAnyCollectionImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- }
-
- //
- // Utility methods
- //
-
- protected void createDefaultComponentAt(int i, TypeCode contentType) {
- try {
- components[i] = DynAnyUtil.createMostDerivedDynAny(contentType, orb);
- } catch (InconsistentTypeCode itc) { // impossible
- }
- // get a hold of the default initialized Any without copying
- anys[i] = getAny(components[i]);
- }
-
- protected TypeCode getContentType() {
- try {
- return any.type().content_type();
- } catch (BadKind badKind) { // impossible
- return null;
- }
- }
-
- // This method has a different meaning for sequence and array:
- // For sequence value of 0 indicates an unbounded sequence,
- // values > 0 indicate a bounded sequence.
- // For array any value indicates the boundary.
- protected int getBound() {
- try {
- return any.type().length();
- } catch (BadKind badKind) { // impossible
- return 0;
- }
- }
-
- //
- // DynAny interface methods
- //
-
- // _REVISIT_ More efficient copy operation
-
- //
- // Collection methods
- //
-
- public org.omg.CORBA.Any[] get_elements () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return (checkInitComponents() ? anys : null);
- }
-
- protected abstract void checkValue(Object[] value)
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-
- // Initializes the elements of the ordered collection.
- // If value does not contain the same number of elements as the array dimension,
- // the operation raises InvalidValue.
- // If one or more elements have a type that is inconsistent with the collections TypeCode,
- // the operation raises TypeMismatch.
- // This operation does not change the current position.
- public void set_elements (org.omg.CORBA.Any[] value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- checkValue(value);
-
- components = new DynAny[value.length];
- anys = value;
-
- // We know that this is of kind tk_sequence or tk_array
- TypeCode expectedTypeCode = getContentType();
- for (int i=0; i<value.length; i++) {
- if (value[i] != null) {
- if (! value[i].type().equal(expectedTypeCode)) {
- clearData();
- // _REVISIT_ More info
- throw new TypeMismatch();
- }
- try {
- // Creates the appropriate subtype without copying the Any
- components[i] = DynAnyUtil.createMostDerivedDynAny(value[i], orb, false);
- //System.out.println(this + " created component " + components[i]);
- } catch (InconsistentTypeCode itc) {
- throw new InvalidValue();
- }
- } else {
- clearData();
- // _REVISIT_ More info
- throw new InvalidValue();
- }
- }
- index = (value.length == 0 ? NO_INDEX : 0);
- // Other representations are invalidated by this operation
- representations = REPRESENTATION_COMPONENTS;
- }
-
- public org.omg.DynamicAny.DynAny[] get_elements_as_dyn_any () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return (checkInitComponents() ? components : null);
- }
-
- // Same semantics as set_elements(Any[])
- public void set_elements_as_dyn_any (org.omg.DynamicAny.DynAny[] value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- checkValue(value);
-
- components = (value == null ? emptyComponents : value);
- anys = new Any[value.length];
-
- // We know that this is of kind tk_sequence or tk_array
- TypeCode expectedTypeCode = getContentType();
- for (int i=0; i<value.length; i++) {
- if (value[i] != null) {
- if (! value[i].type().equal(expectedTypeCode)) {
- clearData();
- // _REVISIT_ More info
- throw new TypeMismatch();
- }
- anys[i] = getAny(value[i]);
- } else {
- clearData();
- // _REVISIT_ More info
- throw new InvalidValue();
- }
- }
- index = (value.length == 0 ? NO_INDEX : 0);
- // Other representations are invalidated by this operation
- representations = REPRESENTATION_COMPONENTS;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyComplexImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyComplexImpl.java
deleted file mode 100644
index 4eb3c9a..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyComplexImpl.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-abstract class DynAnyComplexImpl extends DynAnyConstructedImpl
-{
- //
- // Instance variables
- //
-
- String[] names = null;
- // Instance variables components and names above are kept in sync
- // with these two arrays at all times.
- NameValuePair[] nameValuePairs = null;
- NameDynAnyPair[] nameDynAnyPairs = null;
-
- //
- // Constructors
- //
-
- private DynAnyComplexImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynAnyComplexImpl(ORB orb, Any any, boolean copyValue) {
- // We can be sure that typeCode is of kind tk_struct
- super(orb, any, copyValue);
- // Initialize components lazily, on demand.
- // This is an optimization in case the user is only interested in storing Anys.
- }
-
- protected DynAnyComplexImpl(ORB orb, TypeCode typeCode) {
- // We can be sure that typeCode is of kind tk_struct
- super(orb, typeCode);
- // For DynAnyComplex, the operation sets the current position to -1
- // for empty exceptions and to zero for all other TypeCodes.
- // The members (if any) are (recursively) initialized to their default values.
- index = 0;
- }
-
- //
- // DynAny interface methods
- //
-
- // _REVISIT_ Overridden to provide more efficient copying.
- // Copies all the internal representations which is faster than reconstructing them.
-/*
- public org.omg.DynamicAny.DynAny copy() {
- if (status == STATUS_DESTROYED) {
- throw new OBJECT_NOT_EXIST();
- }
- DynAnyComplexImpl returnValue = null;
- if ((representations & REPRESENTATION_ANY) != 0) {
- // The flag "true" indicates copying the Any value
- returnValue = (DynAnyComplexImpl)DynAnyUtil.createMostDerivedDynAny(any, orb, true);
- }
- if ((representations & REPRESENTATION_COMPONENTS) != 0) {
- }
- return returnValue;
- }
-*/
-
- //
- // Complex methods
- //
-
- public String current_member_name ()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if( ! checkInitComponents() || index < 0 || index >= names.length) {
- throw new InvalidValue();
- }
- return names[index];
- }
-
- public TCKind current_member_kind ()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if( ! checkInitComponents() || index < 0 || index >= components.length) {
- throw new InvalidValue();
- }
- return components[index].type().kind();
- }
-
- // Creates references to the parameter instead of copying it.
- public void set_members (org.omg.DynamicAny.NameValuePair[] value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (value == null || value.length == 0) {
- clearData();
- return;
- }
-
- Any memberAny;
- DynAny memberDynAny = null;
- String memberName;
- // We know that this is of kind tk_struct
- TypeCode expectedTypeCode = any.type();
-
- int expectedMemberCount = 0;
- try {
- expectedMemberCount = expectedTypeCode.member_count();
- } catch (BadKind badKind) { // impossible
- }
- if (expectedMemberCount != value.length) {
- clearData();
- throw new InvalidValue();
- }
-
- allocComponents(value);
-
- for (int i=0; i<value.length; i++) {
- if (value[i] != null) {
- memberName = value[i].id;
- String expectedMemberName = null;
- try {
- expectedMemberName = expectedTypeCode.member_name(i);
- } catch (BadKind badKind) { // impossible
- } catch (Bounds bounds) { // impossible
- }
- if ( ! (expectedMemberName.equals(memberName) || memberName.equals(""))) {
- clearData();
- // _REVISIT_ More info
- throw new TypeMismatch();
- }
- memberAny = value[i].value;
- TypeCode expectedMemberType = null;
- try {
- expectedMemberType = expectedTypeCode.member_type(i);
- } catch (BadKind badKind) { // impossible
- } catch (Bounds bounds) { // impossible
- }
- if (! expectedMemberType.equal(memberAny.type())) {
- clearData();
- // _REVISIT_ More info
- throw new TypeMismatch();
- }
- try {
- // Creates the appropriate subtype without copying the Any
- memberDynAny = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false);
- } catch (InconsistentTypeCode itc) {
- throw new InvalidValue();
- }
- addComponent(i, memberName, memberAny, memberDynAny);
- } else {
- clearData();
- // _REVISIT_ More info
- throw new InvalidValue();
- }
- }
- index = (value.length == 0 ? NO_INDEX : 0);
- representations = REPRESENTATION_COMPONENTS;
- }
-
- // Creates references to the parameter instead of copying it.
- public void set_members_as_dyn_any (org.omg.DynamicAny.NameDynAnyPair[] value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (value == null || value.length == 0) {
- clearData();
- return;
- }
-
- Any memberAny;
- DynAny memberDynAny;
- String memberName;
- // We know that this is of kind tk_struct
- TypeCode expectedTypeCode = any.type();
-
- int expectedMemberCount = 0;
- try {
- expectedMemberCount = expectedTypeCode.member_count();
- } catch (BadKind badKind) { // impossible
- }
- if (expectedMemberCount != value.length) {
- clearData();
- throw new InvalidValue();
- }
-
- allocComponents(value);
-
- for (int i=0; i<value.length; i++) {
- if (value[i] != null) {
- memberName = value[i].id;
- String expectedMemberName = null;
- try {
- expectedMemberName = expectedTypeCode.member_name(i);
- } catch (BadKind badKind) { // impossible
- } catch (Bounds bounds) { // impossible
- }
- if ( ! (expectedMemberName.equals(memberName) || memberName.equals(""))) {
- clearData();
- // _REVISIT_ More info
- throw new TypeMismatch();
- }
- memberDynAny = value[i].value;
- memberAny = getAny(memberDynAny);
- TypeCode expectedMemberType = null;
- try {
- expectedMemberType = expectedTypeCode.member_type(i);
- } catch (BadKind badKind) { // impossible
- } catch (Bounds bounds) { // impossible
- }
- if (! expectedMemberType.equal(memberAny.type())) {
- clearData();
- // _REVISIT_ More info
- throw new TypeMismatch();
- }
-
- addComponent(i, memberName, memberAny, memberDynAny);
- } else {
- clearData();
- // _REVISIT_ More info
- throw new InvalidValue();
- }
- }
- index = (value.length == 0 ? NO_INDEX : 0);
- representations = REPRESENTATION_COMPONENTS;
- }
-
- //
- // Utility methods
- //
-
- private void allocComponents(int length) {
- components = new DynAny[length];
- names = new String[length];
- nameValuePairs = new NameValuePair[length];
- nameDynAnyPairs = new NameDynAnyPair[length];
- for (int i=0; i<length; i++) {
- nameValuePairs[i] = new NameValuePair();
- nameDynAnyPairs[i] = new NameDynAnyPair();
- }
- }
-
- private void allocComponents(org.omg.DynamicAny.NameValuePair[] value) {
- components = new DynAny[value.length];
- names = new String[value.length];
- nameValuePairs = value;
- nameDynAnyPairs = new NameDynAnyPair[value.length];
- for (int i=0; i<value.length; i++) {
- nameDynAnyPairs[i] = new NameDynAnyPair();
- }
- }
-
- private void allocComponents(org.omg.DynamicAny.NameDynAnyPair[] value) {
- components = new DynAny[value.length];
- names = new String[value.length];
- nameValuePairs = new NameValuePair[value.length];
- for (int i=0; i<value.length; i++) {
- nameValuePairs[i] = new NameValuePair();
- }
- nameDynAnyPairs = value;
- }
-
- private void addComponent(int i, String memberName, Any memberAny, DynAny memberDynAny) {
- components[i] = memberDynAny;
- names[i] = (memberName != null ? memberName : "");
- nameValuePairs[i].id = memberName;
- nameValuePairs[i].value = memberAny;
- nameDynAnyPairs[i].id = memberName;
- nameDynAnyPairs[i].value = memberDynAny;
- if (memberDynAny instanceof DynAnyImpl)
- ((DynAnyImpl)memberDynAny).setStatus(STATUS_UNDESTROYABLE);
- }
-
- // Initializes components, names, nameValuePairs and nameDynAnyPairs representation
- // from the Any representation
- protected boolean initializeComponentsFromAny() {
- // This typeCode is of kind tk_struct.
- TypeCode typeCode = any.type();
- TypeCode memberType = null;
- Any memberAny;
- DynAny memberDynAny = null;
- String memberName = null;
- int length = 0;
-
- try {
- length = typeCode.member_count();
- } catch (BadKind badKind) { // impossible
- }
-
- InputStream input = any.create_input_stream();
-
- allocComponents(length);
-
- for (int i=0; i<length; i++) {
- try {
- memberName = typeCode.member_name(i);
- memberType = typeCode.member_type(i);
- } catch (BadKind badKind) { // impossible
- } catch (Bounds bounds) { // impossible
- }
- memberAny = DynAnyUtil.extractAnyFromStream(memberType, input, orb);
- try {
- // Creates the appropriate subtype without copying the Any
- memberDynAny = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false);
- // _DEBUG_
- //System.out.println("Created DynAny for " + memberName +
- // ", type " + memberType.kind().value());
- } catch (InconsistentTypeCode itc) { // impossible
- }
- addComponent(i, memberName, memberAny, memberDynAny);
- }
- return true;
- }
-
- // Initializes components, names, nameValuePairs and nameDynAnyPairs representation
- // from the internal TypeCode information with default values
- // This is not done recursively, only one level.
- // More levels are initialized lazily, on demand.
- protected boolean initializeComponentsFromTypeCode() {
- // This typeCode is of kind tk_struct.
- TypeCode typeCode = any.type();
- TypeCode memberType = null;
- Any memberAny;
- DynAny memberDynAny = null;
- String memberName;
- int length = 0;
-
- try {
- length = typeCode.member_count();
- } catch (BadKind badKind) { // impossible
- }
-
- allocComponents(length);
-
- for (int i=0; i<length; i++) {
- memberName = null;
- try {
- memberName = typeCode.member_name(i);
- memberType = typeCode.member_type(i);
- } catch (BadKind badKind) { // impossible
- } catch (Bounds bounds) { // impossible
- }
- try {
- memberDynAny = DynAnyUtil.createMostDerivedDynAny(memberType, orb);
- // _DEBUG_
- //System.out.println("Created DynAny for " + memberName +
- // ", type " + memberType.kind().value());
-/*
- if (memberDynAny instanceof DynAnyConstructedImpl) {
- if ( ! ((DynAnyConstructedImpl)memberDynAny).isRecursive()) {
- // This is the recursive part
- ((DynAnyConstructedImpl)memberDynAny).initializeComponentsFromTypeCode();
- }
- } // Other implementations have their own way of dealing with implementing the spec.
-*/
- } catch (InconsistentTypeCode itc) { // impossible
- }
- // get a hold of the default initialized Any without copying
- memberAny = getAny(memberDynAny);
- addComponent(i, memberName, memberAny, memberDynAny);
- }
- return true;
- }
-
- // It is probably right not to destroy the released component DynAnys.
- // Some other DynAny or a user variable might still hold onto them
- // and if not then the garbage collector will take care of it.
- protected void clearData() {
- super.clearData();
- names = null;
- nameValuePairs = null;
- nameDynAnyPairs = null;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyConstructedImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyConstructedImpl.java
deleted file mode 100644
index 8665b23..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyConstructedImpl.java
+++ /dev/null
@@ -1,937 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-import com.sun.corba.se.impl.corba.TypeCodeImpl; // needed for recursive type codes
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-abstract class DynAnyConstructedImpl extends DynAnyImpl
-{
- protected static final byte REPRESENTATION_NONE = 0;
- protected static final byte REPRESENTATION_TYPECODE = 1;
- protected static final byte REPRESENTATION_ANY = 2;
- protected static final byte REPRESENTATION_COMPONENTS = 4;
-
- protected static final byte RECURSIVE_UNDEF = -1;
- protected static final byte RECURSIVE_NO = 0;
- protected static final byte RECURSIVE_YES = 1;
-
- protected static final DynAny[] emptyComponents = new DynAny[0];
- //
- // Instance variables
- //
-
- // Constructed DynAnys maintain an ordered collection of component DynAnys.
- DynAny[] components = emptyComponents;
- byte representations = REPRESENTATION_NONE;
- byte isRecursive = RECURSIVE_UNDEF;
-
- //
- // Constructors
- //
-
- private DynAnyConstructedImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynAnyConstructedImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- //System.out.println(this + " constructed with any " + any);
- if (this.any != null) {
- representations = REPRESENTATION_ANY;
- }
- // set the current position to 0 if any has components, otherwise to -1.
- index = 0;
- }
-
- protected DynAnyConstructedImpl(ORB orb, TypeCode typeCode) {
- // assertion: typeCode has been checked to be valid for this particular subclass.
- // note: We don't copy TypeCodes since they are considered immutable.
- super(orb, typeCode);
- if (typeCode != null) {
- representations = REPRESENTATION_TYPECODE;
- }
- // set the current position to 0 if any has components, otherwise to -1.
- index = NO_INDEX;
-
- // _REVISIT_ Would need REPRESENTATION_TYPECODE for lazy initialization
- //if ( ! isRecursive()) {
- // initializeComponentsFromTypeCode();
- //}
- }
-
- protected boolean isRecursive() {
- if (isRecursive == RECURSIVE_UNDEF) {
- TypeCode typeCode = any.type();
- if (typeCode instanceof TypeCodeImpl) {
- if (((TypeCodeImpl)typeCode).is_recursive())
- isRecursive = RECURSIVE_YES;
- else
- isRecursive = RECURSIVE_NO;
- } else {
- // No way to find out unless the TypeCode spec changes.
- isRecursive = RECURSIVE_NO;
- }
- }
- return (isRecursive == RECURSIVE_YES);
- }
-
- //
- // DynAny traversal methods
- //
-
- public org.omg.DynamicAny.DynAny current_component()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX) {
- return null;
- }
- return (checkInitComponents() ? components[index] : null);
- }
-
- public int component_count() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return (checkInitComponents() ? components.length : 0);
- }
-
- public boolean next() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (checkInitComponents() == false) {
- return false;
- }
- index++;
- if (index >= 0 && index < components.length) {
- return true;
- } else {
- index = NO_INDEX;
- return false;
- }
- }
-
- public boolean seek(int newIndex) {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (newIndex < 0) {
- this.index = NO_INDEX;
- return false;
- }
- if (checkInitComponents() == false) {
- return false;
- }
- if (newIndex < components.length) {
- index = newIndex;
- return true;
- }
- return false;
- }
-
- public void rewind() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- this.seek(0);
- }
-
- //
- // Utility methods
- //
-
- protected void clearData() {
- super.clearData();
- // _REVISIT_ What about status?
- components = emptyComponents;
- index = NO_INDEX;
- representations = REPRESENTATION_NONE;
- }
-
- protected void writeAny(OutputStream out) {
- // If all we got is TypeCode representation (no value)
- // then we don't want to force creating a default value
- //System.out.println(this + " checkInitAny before writeAny");
- checkInitAny();
- super.writeAny(out);
- }
-
- // Makes sure that the components representation is initialized
- protected boolean checkInitComponents() {
- if ((representations & REPRESENTATION_COMPONENTS) == 0) {
- if ((representations & REPRESENTATION_ANY) != 0) {
- if (initializeComponentsFromAny()) {
- representations |= REPRESENTATION_COMPONENTS;
- } else {
- return false;
- }
- } else if ((representations & REPRESENTATION_TYPECODE) != 0) {
- if (initializeComponentsFromTypeCode()) {
- representations |= REPRESENTATION_COMPONENTS;
- } else {
- return false;
- }
- }
- }
- return true;
- }
-
- // Makes sure that the Any representation is initialized
- protected void checkInitAny() {
- if ((representations & REPRESENTATION_ANY) == 0) {
- //System.out.println(this + " checkInitAny: reps does not have REPRESENTATION_ANY");
- if ((representations & REPRESENTATION_COMPONENTS) != 0) {
- //System.out.println(this + " checkInitAny: reps has REPRESENTATION_COMPONENTS");
- if (initializeAnyFromComponents()) {
- representations |= REPRESENTATION_ANY;
- }
- } else if ((representations & REPRESENTATION_TYPECODE) != 0) {
- //System.out.println(this + " checkInitAny: reps has REPRESENTATION_TYPECODE");
- if (representations == REPRESENTATION_TYPECODE && isRecursive())
- return;
- if (initializeComponentsFromTypeCode()) {
- representations |= REPRESENTATION_COMPONENTS;
- }
- if (initializeAnyFromComponents()) {
- representations |= REPRESENTATION_ANY;
- }
- }
- } else {
- //System.out.println(this + " checkInitAny: reps != REPRESENTATION_ANY");
- }
- return;
- }
-
- protected abstract boolean initializeComponentsFromAny();
- protected abstract boolean initializeComponentsFromTypeCode();
-
- // Collapses the whole DynAny hierarchys values into one single streamed Any
- protected boolean initializeAnyFromComponents() {
- //System.out.println(this + " initializeAnyFromComponents");
- OutputStream out = any.create_output_stream();
- for (int i=0; i<components.length; i++) {
- if (components[i] instanceof DynAnyImpl) {
- ((DynAnyImpl)components[i]).writeAny(out);
- } else {
- // Not our implementation. Nothing we can do to prevent copying.
- components[i].to_any().write_value(out);
- }
- }
- any.read_value(out.create_input_stream(), any.type());
- return true;
- }
-
- //
- // DynAny interface methods
- //
-
- public void assign (org.omg.DynamicAny.DynAny dyn_any)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- clearData();
- super.assign(dyn_any);
- representations = REPRESENTATION_ANY;
- index = 0;
- }
-
- public void from_any (org.omg.CORBA.Any value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- clearData();
- super.from_any(value);
- representations = REPRESENTATION_ANY;
- index = 0;
- }
-
- // Spec: Returns a copy of the internal Any
- public org.omg.CORBA.Any to_any() {
- //System.out.println(this + " to_any ");
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- checkInitAny();
- // Anys value may still be uninitialized if DynAny was initialized by TypeCode only
- return DynAnyUtil.copy(any, orb);
- }
-
- public boolean equal (org.omg.DynamicAny.DynAny dyn_any) {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (dyn_any == this) {
- return true;
- }
- if ( ! any.type().equal(dyn_any.type())) {
- return false;
- }
- // This changes the current position of dyn_any.
- // Make sure that our position isn't changed.
- if (checkInitComponents() == false) {
- return false;
- }
- DynAny currentComponent = null;
- try {
- // Remember the current position to restore it later
- currentComponent = dyn_any.current_component();
- for (int i=0; i<components.length; i++) {
- if (dyn_any.seek(i) == false)
- return false;
- //System.out.println(this + " comparing component " + i + "=" + components[i] +
- // " of type " + components[i].type().kind().value());
- if ( ! components[i].equal(dyn_any.current_component())) {
- //System.out.println("Not equal component " + i);
- return false;
- }
- }
- } catch (TypeMismatch tm) {
- // impossible, we checked the type codes already
- } finally {
- // Restore the current position of the other DynAny
- DynAnyUtil.set_current_component(dyn_any, currentComponent);
- }
- return true;
- }
-
- public void destroy() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (status == STATUS_DESTROYABLE) {
- status = STATUS_DESTROYED;
- for (int i=0; i<components.length; i++) {
- if (components[i] instanceof DynAnyImpl) {
- ((DynAnyImpl)components[i]).setStatus(STATUS_DESTROYABLE);
- }
- components[i].destroy();
- }
- }
- }
-
- public org.omg.DynamicAny.DynAny copy() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- checkInitAny();
- try {
- return DynAnyUtil.createMostDerivedDynAny(any, orb, true);
- } catch (InconsistentTypeCode ictc) {
- return null; // impossible
- }
- }
-
- // getter / setter methods
-
- public void insert_boolean(boolean value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_boolean(value);
- }
-
- public void insert_octet(byte value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_octet(value);
- }
-
- public void insert_char(char value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_char(value);
- }
-
- public void insert_short(short value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_short(value);
- }
-
- public void insert_ushort(short value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_ushort(value);
- }
-
- public void insert_long(int value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_long(value);
- }
-
- public void insert_ulong(int value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_ulong(value);
- }
-
- public void insert_float(float value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_float(value);
- }
-
- public void insert_double(double value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_double(value);
- }
-
- public void insert_string(String value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_string(value);
- }
-
- public void insert_reference(org.omg.CORBA.Object value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_reference(value);
- }
-
- public void insert_typecode(org.omg.CORBA.TypeCode value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_typecode(value);
- }
-
- public void insert_longlong(long value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_longlong(value);
- }
-
- public void insert_ulonglong(long value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_ulonglong(value);
- }
-
- public void insert_wchar(char value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_wchar(value);
- }
-
- public void insert_wstring(String value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_wstring(value);
- }
-
- public void insert_any(org.omg.CORBA.Any value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_any(value);
- }
-
- public void insert_dyn_any (org.omg.DynamicAny.DynAny value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_dyn_any(value);
- }
-
- public void insert_val(java.io.Serializable value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- currentComponent.insert_val(value);
- }
-
- public java.io.Serializable get_val()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_val();
- }
-
- public boolean get_boolean()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_boolean();
- }
-
- public byte get_octet()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_octet();
- }
-
- public char get_char()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_char();
- }
-
- public short get_short()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_short();
- }
-
- public short get_ushort()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_ushort();
- }
-
- public int get_long()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_long();
- }
-
- public int get_ulong()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_ulong();
- }
-
- public float get_float()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_float();
- }
-
- public double get_double()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_double();
- }
-
- public String get_string()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_string();
- }
-
- public org.omg.CORBA.Object get_reference()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_reference();
- }
-
- public org.omg.CORBA.TypeCode get_typecode()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_typecode();
- }
-
- public long get_longlong()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_longlong();
- }
-
- public long get_ulonglong()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_ulonglong();
- }
-
- public char get_wchar()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_wchar();
- }
-
- public String get_wstring()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_wstring();
- }
-
- public org.omg.CORBA.Any get_any()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_any();
- }
-
- public org.omg.DynamicAny.DynAny get_dyn_any()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (index == NO_INDEX)
- throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
- DynAny currentComponent = current_component();
- if (DynAnyUtil.isConstructedDynAny(currentComponent))
- throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
- return currentComponent.get_dyn_any();
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyFactoryImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyFactoryImpl.java
deleted file mode 100644
index 95025ee..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyFactoryImpl.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyFactoryPackage.*;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynAnyFactoryImpl
- extends org.omg.CORBA.LocalObject
- implements org.omg.DynamicAny.DynAnyFactory
-{
- //
- // Instance variables
- //
-
- private ORB orb;
-
- //
- // Constructors
- //
-
- private DynAnyFactoryImpl() {
- this.orb = null;
- }
-
- public DynAnyFactoryImpl(ORB orb) {
- this.orb = orb;
- }
-
- //
- // DynAnyFactory interface methods
- //
-
- // Returns the most derived DynAny type based on the Anys TypeCode.
- public org.omg.DynamicAny.DynAny create_dyn_any (org.omg.CORBA.Any any)
- throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
- {
- return DynAnyUtil.createMostDerivedDynAny(any, orb, true);
- }
-
- // Returns the most derived DynAny type based on the TypeCode.
- public org.omg.DynamicAny.DynAny create_dyn_any_from_type_code (org.omg.CORBA.TypeCode type)
- throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
- {
- return DynAnyUtil.createMostDerivedDynAny(type, orb);
- }
-
- // Needed for org.omg.CORBA.Object
-
- private String[] __ids = { "IDL:omg.org/DynamicAny/DynAnyFactory:1.0" };
-
- public String[] _ids() {
- return (String[]) __ids.clone();
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyImpl.java
deleted file mode 100644
index 96da602..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyImpl.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.ORBPackage.InvalidName;
-import org.omg.CORBA.portable.OutputStream;
-
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-abstract class DynAnyImpl extends org.omg.CORBA.LocalObject implements DynAny
-{
- protected static final int NO_INDEX = -1;
- // A DynAny is destroyable if it is the root of a DynAny hierarchy.
- protected static final byte STATUS_DESTROYABLE = 0;
- // A DynAny is undestroyable if it is a node in a DynAny hierarchy other than the root.
- protected static final byte STATUS_UNDESTROYABLE = 1;
- // A DynAny is destroyed if its root has been destroyed.
- protected static final byte STATUS_DESTROYED = 2;
-
- //
- // Instance variables
- //
-
- protected ORB orb = null;
- protected ORBUtilSystemException wrapper ;
-
- // An Any is used internally to implement the basic DynAny.
- // It stores the DynAnys TypeCode.
- // For primitive types it is the only representation.
- // For complex types it is the streamed representation.
- protected Any any = null;
- // Destroyable is the default status for free standing DynAnys.
- protected byte status = STATUS_DESTROYABLE;
- protected int index = NO_INDEX;
-
- //
- // Constructors
- //
-
- protected DynAnyImpl() {
- wrapper = ORBUtilSystemException.get(
- CORBALogDomains.RPC_PRESENTATION ) ;
- }
-
- protected DynAnyImpl(ORB orb, Any any, boolean copyValue) {
- this.orb = orb;
- wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_PRESENTATION ) ;
- if (copyValue)
- this.any = DynAnyUtil.copy(any, orb);
- else
- this.any = any;
- // set the current position to 0 if any has components, otherwise to -1.
- index = NO_INDEX;
- }
-
- protected DynAnyImpl(ORB orb, TypeCode typeCode) {
- this.orb = orb;
- wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_PRESENTATION ) ;
- this.any = DynAnyUtil.createDefaultAnyOfType(typeCode, orb);
- }
-
- protected DynAnyFactory factory() {
- try {
- return (DynAnyFactory)orb.resolve_initial_references(
- ORBConstants.DYN_ANY_FACTORY_NAME );
- } catch (InvalidName in) {
- throw new RuntimeException("Unable to find DynAnyFactory");
- }
- }
-
- protected Any getAny() {
- return any;
- }
-
- // Uses getAny() if this is our implementation, otherwise uses to_any()
- // which copies the Any.
- protected Any getAny(DynAny dynAny) {
- if (dynAny instanceof DynAnyImpl)
- return ((DynAnyImpl)dynAny).getAny();
- else
- // _REVISIT_ Nothing we can do about copying at this point
- // if this is not our implementation of DynAny.
- // To prevent this we would need another representation,
- // one where component DynAnys are initialized but not the component Anys.
- return dynAny.to_any();
- }
-
- protected void writeAny(OutputStream out) {
- //System.out.println(this + " writeAny of type " + type().kind().value());
- any.write_value(out);
- }
-
- protected void setStatus(byte newStatus) {
- status = newStatus;
- }
-
- protected void clearData() {
- // This clears the data part of the Any while keeping the TypeCode info.
- any.type(any.type());
- }
-
- //
- // DynAny interface methods
- //
-
- public org.omg.CORBA.TypeCode type() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return any.type();
- }
-
- // Makes a copy of the Any value inside the parameter
- public void assign (org.omg.DynamicAny.DynAny dyn_any)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if ((any != null) && (! any.type().equal(dyn_any.type()))) {
- throw new TypeMismatch();
- }
- any = dyn_any.to_any();
- }
-
- // Makes a copy of the Any parameter
- public void from_any (org.omg.CORBA.Any value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if ((any != null) && (! any.type().equal(value.type()))) {
- throw new TypeMismatch();
- }
- // If the passed Any does not contain a legal value
- // (such as a null string), the operation raises InvalidValue.
- Any tempAny = null;
- try {
- tempAny = DynAnyUtil.copy(value, orb);
- } catch (Exception e) {
- throw new InvalidValue();
- }
- if ( ! DynAnyUtil.isInitialized(tempAny)) {
- throw new InvalidValue();
- }
- any = tempAny;
- }
-
- public abstract org.omg.CORBA.Any to_any();
- public abstract boolean equal (org.omg.DynamicAny.DynAny dyn_any);
- public abstract void destroy();
- public abstract org.omg.DynamicAny.DynAny copy();
-
- // Needed for org.omg.CORBA.Object
-
- private String[] __ids = { "IDL:omg.org/DynamicAny/DynAny:1.0" };
-
- public String[] _ids() {
- return (String[]) __ids.clone();
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyUtil.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyUtil.java
deleted file mode 100644
index ee90d1a..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyUtil.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.portable.OutputStream;
-//import org.omg.CORBA.ORBPackage.*;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-import java.math.BigDecimal;
-import com.sun.corba.se.impl.corba.AnyImpl;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynAnyUtil
-{
- static boolean isConsistentType(TypeCode typeCode) {
- int kind = typeCode.kind().value();
- return (kind != TCKind._tk_Principal &&
- kind != TCKind._tk_native &&
- kind != TCKind._tk_abstract_interface);
- }
-
- static boolean isConstructedDynAny(DynAny dynAny) {
- // DynFixed is constructed but not a subclass of DynAnyConstructedImpl
- //return (dynAny instanceof DynAnyConstructedImpl);
- int kind = dynAny.type().kind().value();
- return (kind == TCKind._tk_sequence ||
- kind == TCKind._tk_struct ||
- kind == TCKind._tk_array ||
- kind == TCKind._tk_union ||
- kind == TCKind._tk_enum ||
- kind == TCKind._tk_fixed ||
- kind == TCKind._tk_value ||
- kind == TCKind._tk_value_box);
- }
-
- static DynAny createMostDerivedDynAny(Any any, ORB orb, boolean copyValue)
- throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
- {
- if (any == null || ! DynAnyUtil.isConsistentType(any.type()))
- throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode();
-
- switch (any.type().kind().value()) {
- case TCKind._tk_sequence:
- return new DynSequenceImpl(orb, any, copyValue);
- case TCKind._tk_struct:
- return new DynStructImpl(orb, any, copyValue);
- case TCKind._tk_array:
- return new DynArrayImpl(orb, any, copyValue);
- case TCKind._tk_union:
- return new DynUnionImpl(orb, any, copyValue);
- case TCKind._tk_enum:
- return new DynEnumImpl(orb, any, copyValue);
- case TCKind._tk_fixed:
- return new DynFixedImpl(orb, any, copyValue);
- case TCKind._tk_value:
- return new DynValueImpl(orb, any, copyValue);
- case TCKind._tk_value_box:
- return new DynValueBoxImpl(orb, any, copyValue);
- default:
- return new DynAnyBasicImpl(orb, any, copyValue);
- }
- }
-
- static DynAny createMostDerivedDynAny(TypeCode typeCode, ORB orb)
- throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
- {
- if (typeCode == null || ! DynAnyUtil.isConsistentType(typeCode))
- throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode();
-
- switch (typeCode.kind().value()) {
- case TCKind._tk_sequence:
- return new DynSequenceImpl(orb, typeCode);
- case TCKind._tk_struct:
- return new DynStructImpl(orb, typeCode);
- case TCKind._tk_array:
- return new DynArrayImpl(orb, typeCode);
- case TCKind._tk_union:
- return new DynUnionImpl(orb, typeCode);
- case TCKind._tk_enum:
- return new DynEnumImpl(orb, typeCode);
- case TCKind._tk_fixed:
- return new DynFixedImpl(orb, typeCode);
- case TCKind._tk_value:
- return new DynValueImpl(orb, typeCode);
- case TCKind._tk_value_box:
- return new DynValueBoxImpl(orb, typeCode);
- default:
- return new DynAnyBasicImpl(orb, typeCode);
- }
- }
-
- // Extracts a member value according to the given TypeCode from the given complex Any
- // (at the Anys current internal stream position, consuming the anys stream on the way)
- // and returns it wrapped into a new Any
-/*
- static Any extractAnyFromAny(TypeCode memberType, Any any, ORB orb) {
- // Moved this functionality into AnyImpl because it is needed for Any.equal()
- return ((AnyImpl)any).extractAny(memberType, orb);
- }
-*/
-
- // Extracts a member value according to the given TypeCode from the given complex Any
- // (at the Anys current internal stream position, consuming the anys stream on the way)
- // and returns it wrapped into a new Any
- static Any extractAnyFromStream(TypeCode memberType, InputStream input, ORB orb) {
- return AnyImpl.extractAnyFromStream(memberType, input, orb);
- }
-
- // Creates a default Any of the given type.
- static Any createDefaultAnyOfType(TypeCode typeCode, ORB orb) {
- ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_PRESENTATION ) ;
-
- Any returnValue = orb.create_any();
- // The spec for DynAny differs from Any on initialization via type code:
- // - false for boolean
- // - zero for numeric types
- // - zero for types octet, char, and wchar
- // - the empty string for string and wstring
- // - nil for object references
- // - a type code with a TCKind value of tk_null for type codes
- // - for Any values, an Any containing a type code with a TCKind value of tk_null
- // type and no value
- switch (typeCode.kind().value()) {
- case TCKind._tk_boolean:
- // false for boolean
- returnValue.insert_boolean(false);
- break;
- case TCKind._tk_short:
- // zero for numeric types
- returnValue.insert_short((short)0);
- break;
- case TCKind._tk_ushort:
- // zero for numeric types
- returnValue.insert_ushort((short)0);
- break;
- case TCKind._tk_long:
- // zero for numeric types
- returnValue.insert_long(0);
- break;
- case TCKind._tk_ulong:
- // zero for numeric types
- returnValue.insert_ulong(0);
- break;
- case TCKind._tk_longlong:
- // zero for numeric types
- returnValue.insert_longlong((long)0);
- break;
- case TCKind._tk_ulonglong:
- // zero for numeric types
- returnValue.insert_ulonglong((long)0);
- break;
- case TCKind._tk_float:
- // zero for numeric types
- returnValue.insert_float((float)0.0);
- break;
- case TCKind._tk_double:
- // zero for numeric types
- returnValue.insert_double((double)0.0);
- break;
- case TCKind._tk_octet:
- // zero for types octet, char, and wchar
- returnValue.insert_octet((byte)0);
- break;
- case TCKind._tk_char:
- // zero for types octet, char, and wchar
- returnValue.insert_char((char)0);
- break;
- case TCKind._tk_wchar:
- // zero for types octet, char, and wchar
- returnValue.insert_wchar((char)0);
- break;
- case TCKind._tk_string:
- // the empty string for string and wstring
- // Make sure that type code for bounded strings gets respected
- returnValue.type(typeCode);
- // Doesn't erase the type of bounded string
- returnValue.insert_string("");
- break;
- case TCKind._tk_wstring:
- // the empty string for string and wstring
- // Make sure that type code for bounded strings gets respected
- returnValue.type(typeCode);
- // Doesn't erase the type of bounded string
- returnValue.insert_wstring("");
- break;
- case TCKind._tk_objref:
- // nil for object references
- returnValue.insert_Object(null);
- break;
- case TCKind._tk_TypeCode:
- // a type code with a TCKind value of tk_null for type codes
- // We can reuse the type code that's already in the any.
- returnValue.insert_TypeCode(returnValue.type());
- break;
- case TCKind._tk_any:
- // for Any values, an Any containing a type code with a TCKind value
- // of tk_null type and no value.
- // This is exactly what the default AnyImpl constructor provides.
- // _REVISIT_ Note that this inner Any is considered uninitialized.
- returnValue.insert_any(orb.create_any());
- break;
- case TCKind._tk_struct:
- case TCKind._tk_union:
- case TCKind._tk_enum:
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- case TCKind._tk_except:
- case TCKind._tk_value:
- case TCKind._tk_value_box:
- // There are no default value for complex types since there is no
- // concept of a hierarchy of Anys. Only DynAnys can be arrange in
- // a hierarchy to mirror the TypeCode hierarchy.
- // See DynAnyConstructedImpl.initializeComponentsFromTypeCode()
- // on how this DynAny hierarchy is created from TypeCodes.
- returnValue.type(typeCode);
- break;
- case TCKind._tk_fixed:
- returnValue.insert_fixed(new BigDecimal("0.0"), typeCode);
- break;
- case TCKind._tk_native:
- case TCKind._tk_alias:
- case TCKind._tk_void:
- case TCKind._tk_Principal:
- case TCKind._tk_abstract_interface:
- returnValue.type(typeCode);
- break;
- case TCKind._tk_null:
- // Any is already initialized to null
- break;
- case TCKind._tk_longdouble:
- // Unspecified for Java
- throw wrapper.tkLongDoubleNotSupported() ;
- default:
- throw wrapper.typecodeNotSupported() ;
- }
- return returnValue;
- }
-/*
- static Any setTypeOfAny(TypeCode typeCode, Any value) {
- if (value != null) {
- value.read_value(value.create_input_stream(), typeCode);
- }
- return value;
- }
-*/
- static Any copy(Any inAny, ORB orb) {
- return new AnyImpl(orb, inAny);
- }
-
-/*
- static Any copy(Any inAny, ORB orb) {
- Any outAny = null;
- if (inAny != null && orb != null) {
- outAny = orb.create_any();
- outAny.read_value(inAny.create_input_stream(), inAny.type());
- // isInitialized is set to true
- }
- return outAny;
- }
-*/
-
- static DynAny convertToNative(DynAny dynAny, ORB orb) {
- if (dynAny instanceof DynAnyImpl) {
- return dynAny;
- } else {
- // if copy flag wasn't true we would be using our DynAny with
- // a foreign Any in it.
- try {
- return createMostDerivedDynAny(dynAny.to_any(), orb, true);
- } catch (InconsistentTypeCode ictc) {
- return null;
- }
- }
- }
-
- static boolean isInitialized(Any any) {
- // Returning simply the value of Any.isInitialized() is not enough.
- // The DynAny spec says that Anys containing null strings do not contain
- // a "legal value" (see ptc 99-10-07, 9.2.3.3)
- boolean isInitialized = ((AnyImpl)any).isInitialized();
- switch (any.type().kind().value()) {
- case TCKind._tk_string:
- return (isInitialized && (any.extract_string() != null));
- case TCKind._tk_wstring:
- return (isInitialized && (any.extract_wstring() != null));
- }
- return isInitialized;
- }
-
- // This is a convenient method to reset the current component to where it was
- // before we changed it. See DynAnyConstructedImpl.equal for use.
- static boolean set_current_component(DynAny dynAny, DynAny currentComponent) {
- if (currentComponent != null) {
- try {
- dynAny.rewind();
- do {
- if (dynAny.current_component() == currentComponent)
- return true;
- } while (dynAny.next());
- } catch (TypeMismatch tm) { /* impossible */ }
- }
- return false;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynArrayImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynArrayImpl.java
deleted file mode 100644
index cb46958..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynArrayImpl.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynArrayImpl extends DynAnyCollectionImpl implements DynArray
-{
- //
- // Constructors
- //
-
- private DynArrayImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynArrayImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- }
-
- protected DynArrayImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- }
-
- // Initializes components and anys representation
- // from the Any representation
- protected boolean initializeComponentsFromAny() {
- // This typeCode is of kind tk_array.
- TypeCode typeCode = any.type();
- int length = getBound();
- TypeCode contentType = getContentType();
- InputStream input;
-
- try {
- input = any.create_input_stream();
- } catch (BAD_OPERATION e) {
- return false;
- }
-
- components = new DynAny[length];
- anys = new Any[length];
-
- for (int i=0; i<length; i++) {
- // _REVISIT_ Could use read_xxx_array() methods on InputStream for efficiency
- // but only for primitive types
- anys[i] = DynAnyUtil.extractAnyFromStream(contentType, input, orb);
- try {
- // Creates the appropriate subtype without copying the Any
- components[i] = DynAnyUtil.createMostDerivedDynAny(anys[i], orb, false);
- } catch (InconsistentTypeCode itc) { // impossible
- }
- }
- return true;
- }
-
- // Initializes components and anys representation
- // from the internal TypeCode information with default values.
- // This is not done recursively, only one level.
- // More levels are initialized lazily, on demand.
- protected boolean initializeComponentsFromTypeCode() {
- // This typeCode is of kind tk_array.
- TypeCode typeCode = any.type();
- int length = getBound();
- TypeCode contentType = getContentType();
-
- components = new DynAny[length];
- anys = new Any[length];
-
- for (int i=0; i<length; i++) {
- createDefaultComponentAt(i, contentType);
- }
- return true;
- }
-
- //
- // DynArray interface methods
- //
-
- // Initializes the elements of the array.
- // If value does not contain the same number of elements as the array dimension,
- // the operation raises InvalidValue.
- // If one or more elements have a type that is inconsistent with the DynArrays TypeCode,
- // the operation raises TypeMismatch.
- // This operation does not change the current position.
-/*
- public void set_elements (org.omg.CORBA.Any[] value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-*/
-
- //
- // Utility methods
- //
-
- protected void checkValue(Object[] value)
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (value == null || value.length != getBound()) {
- throw new InvalidValue();
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynEnumImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynEnumImpl.java
deleted file mode 100644
index 9777971..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynEnumImpl.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.*;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynEnumImpl extends DynAnyBasicImpl implements DynEnum
-{
- //
- // Instance variables
- //
-
- // This int and the any value are kept in sync at all times
- int currentEnumeratorIndex = NO_INDEX;
-
- //
- // Constructors
- //
-
- private DynEnumImpl() {
- this(null, (Any)null, false);
- }
-
- // The current position of a DynEnum is always -1.
- protected DynEnumImpl(ORB orb, Any anAny, boolean copyValue) {
- super(orb, anAny, copyValue);
- index = NO_INDEX;
- // The any doesn't have to be initialized. We have a default value in this case.
- try {
- currentEnumeratorIndex = any.extract_long();
- } catch (BAD_OPERATION e) {
- // _REVISIT_: Fix Me
- currentEnumeratorIndex = 0;
- any.type(any.type());
- any.insert_long(0);
- }
- }
-
- // Sets the current position to -1 and sets the value of the enumerator
- // to the first enumerator value indicated by the TypeCode.
- protected DynEnumImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- index = NO_INDEX;
- currentEnumeratorIndex = 0;
- any.insert_long(0);
- }
-
- //
- // Utility methods
- //
-
- private int memberCount() {
- int memberCount = 0;
- try {
- memberCount = any.type().member_count();
- } catch (BadKind bad) {
- }
- return memberCount;
- }
-
- private String memberName(int i) {
- String memberName = null;
- try {
- memberName = any.type().member_name(i);
- } catch (BadKind bad) {
- } catch (Bounds bounds) {
- }
- return memberName;
- }
-
- private int computeCurrentEnumeratorIndex(String value) {
- int memberCount = memberCount();
- for (int i=0; i<memberCount; i++) {
- if (memberName(i).equals(value)) {
- return i;
- }
- }
- return NO_INDEX;
- }
-
- //
- // DynAny interface methods
- //
-
- // Returns always 0 for DynEnum
- public int component_count() {
- return 0;
- }
-
- // Calling current_component on a DynAny that cannot have components,
- // such as a DynEnum or an empty exception, raises TypeMismatch.
- public org.omg.DynamicAny.DynAny current_component()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- throw new TypeMismatch();
- }
-
- //
- // DynEnum interface methods
- //
-
- // Returns the value of the DynEnum as an IDL identifier.
- public String get_as_string () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return memberName(currentEnumeratorIndex);
- }
-
- // Sets the value of the DynEnum to the enumerated value
- // whose IDL identifier is passed in the value parameter.
- // If value contains a string that is not a valid IDL identifier
- // for the corresponding enumerated type, the operation raises InvalidValue.
- public void set_as_string (String value)
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- int newIndex = computeCurrentEnumeratorIndex(value);
- if (newIndex == NO_INDEX) {
- throw new InvalidValue();
- }
- currentEnumeratorIndex = newIndex;
- any.insert_long(newIndex);
- }
-
- // Returns the value of the DynEnum as the enumerated values ordinal value.
- // Enumerators have ordinal values 0 to n-1,
- // as they appear from left to right in the corresponding IDL definition.
- public int get_as_ulong () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return currentEnumeratorIndex;
- }
-
- // Sets the value of the DynEnum as the enumerated values ordinal value.
- // If value contains a value that is outside the range of ordinal values
- // for the corresponding enumerated type, the operation raises InvalidValue.
- public void set_as_ulong (int value)
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (value < 0 || value >= memberCount()) {
- throw new InvalidValue();
- }
- currentEnumeratorIndex = value;
- any.insert_long(value);
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynFixedImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynFixedImpl.java
deleted file mode 100644
index 5486f9b..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynFixedImpl.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.*;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynFixedImpl extends DynAnyBasicImpl implements DynFixed
-{
- //
- // Constructors
- //
-
- private DynFixedImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynFixedImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- }
-
- // Sets the current position to -1 and the value to zero.
- protected DynFixedImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- index = NO_INDEX;
- }
-
- //
- // DynAny interface methods
- //
-/*
- public int component_count() {
- return 0;
- }
-*/
- //
- // DynFixed interface methods
- //
-
- public String get_value () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return any.extract_fixed().toString();
- }
-
- // Initializes the value of the DynFixed.
- // The val string must contain a fixed string constant in the same format
- // as used for IDL fixed-point literals.
- //
- // It may consist of an integer part, an optional decimal point,
- // a fraction part and an optional letter d or D.
- // The integer and fraction parts both must be sequences of decimal (base 10) digits.
- // Either the integer part or the fraction part, but not both, may be missing.
- //
- // If val contains a value whose scale exceeds that of the DynFixed or is not initialized,
- // the operation raises InvalidValue.
- // The return value is true if val can be represented as the DynFixed without loss of precision.
- // If val has more fractional digits than can be represented in the DynFixed,
- // fractional digits are truncated and the return value is false.
- // If val does not contain a valid fixed-point literal or contains extraneous characters
- // other than leading or trailing white space, the operation raises TypeMismatch.
- //
- public boolean set_value (String val)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- int digits = 0;
- int scale = 0;
- boolean preservedPrecision = true;
- try {
- digits = any.type().fixed_digits();
- scale = any.type().fixed_scale();
- } catch (BadKind ex) { // impossible
- }
- // First get rid of leading or trailing whitespace which is allowed
- String string = val.trim();
- if (string.length() == 0)
- throw new TypeMismatch();
- // Now scan for the sign
- String sign = "";
- if (string.charAt(0) == '-') {
- sign = "-";
- string = string.substring(1);
- } else if (string.charAt(0) == '+') {
- sign = "+";
- string = string.substring(1);
- }
- // Now get rid of the letter d or D.
- int dIndex = string.indexOf('d');
- if (dIndex == -1) {
- dIndex = string.indexOf('D');
- }
- if (dIndex != -1) {
- string = string.substring(0, dIndex);
- }
- // Just to be sure
- if (string.length() == 0)
- throw new TypeMismatch();
- // Now look for the dot to determine the integer part
- String integerPart;
- String fractionPart;
- int currentScale;
- int currentDigits;
- int dotIndex = string.indexOf('.');
- if (dotIndex == -1) {
- integerPart = string;
- fractionPart = null;
- currentScale = 0;
- currentDigits = integerPart.length();
- } else if (dotIndex == 0 ) {
- integerPart = null;
- fractionPart = string;
- currentScale = fractionPart.length();
- currentDigits = currentScale;
- } else {
- integerPart = string.substring(0, dotIndex);
- fractionPart = string.substring(dotIndex + 1);
- currentScale = fractionPart.length();
- currentDigits = integerPart.length() + currentScale;
- }
- // Let's see if we have to drop some precision
- if (currentDigits > digits) {
- preservedPrecision = false;
- // truncate the fraction part
- if (integerPart.length() < digits) {
- fractionPart = fractionPart.substring(0, digits - integerPart.length());
- } else if (integerPart.length() == digits) {
- // currentScale > 0
- // drop the fraction completely
- fractionPart = null;
- } else {
- // integerPart.length() > digits
- // unable to truncate fraction part
- throw new InvalidValue();
- }
- }
- // If val contains a value whose scale exceeds that of the DynFixed or is not initialized,
- // the operation raises InvalidValue.
- // Reinterpreted to mean raise InvalidValue only if the integer part exceeds precision,
- // which is handled above (integerPart.length() > digits)
-/*
- if (currentScale > scale) {
- throw new InvalidValue("Scale exceeds " + scale);
- }
-*/
- // Now check whether both parts are valid numbers
- BigDecimal result;
- try {
- new BigInteger(integerPart);
- if (fractionPart == null) {
- result = new BigDecimal(sign + integerPart);
- } else {
- new BigInteger(fractionPart);
- result = new BigDecimal(sign + integerPart + "." + fractionPart);
- }
- } catch (NumberFormatException nfe) {
- throw new TypeMismatch();
- }
- any.insert_fixed(result, any.type());
- return preservedPrecision;
- }
-
- public String toString() {
- int digits = 0;
- int scale = 0;
- try {
- digits = any.type().fixed_digits();
- scale = any.type().fixed_scale();
- } catch (BadKind ex) { // impossible
- }
- return "DynFixed with value=" + this.get_value() + ", digits=" + digits + ", scale=" + scale;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynSequenceImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynSequenceImpl.java
deleted file mode 100644
index 1cf5303..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynSequenceImpl.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-// _REVIST_ Could make this a subclass of DynArrayImpl
-// But that would mean that an object that implements DynSequence also implements DynArray
-// which the spec doesn't mention (it also doesn't forbid it).
-public class DynSequenceImpl extends DynAnyCollectionImpl implements DynSequence
-{
- //
- // Constructors
- //
-
- private DynSequenceImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynSequenceImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- }
-
- // Sets the current position to -1 and creates an empty sequence.
- protected DynSequenceImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- }
-
- // Initializes components and anys representation
- // from the Any representation
- protected boolean initializeComponentsFromAny() {
- // This typeCode is of kind tk_sequence.
- TypeCode typeCode = any.type();
- int length;
- TypeCode contentType = getContentType();
- InputStream input;
-
- try {
- input = any.create_input_stream();
- } catch (BAD_OPERATION e) {
- return false;
- }
-
- length = input.read_long();
- components = new DynAny[length];
- anys = new Any[length];
-
- for (int i=0; i<length; i++) {
- // _REVISIT_ Could use read_xxx_array() methods on InputStream for efficiency
- // but only for primitive types
- anys[i] = DynAnyUtil.extractAnyFromStream(contentType, input, orb);
- try {
- // Creates the appropriate subtype without copying the Any
- components[i] = DynAnyUtil.createMostDerivedDynAny(anys[i], orb, false);
- } catch (InconsistentTypeCode itc) { // impossible
- }
- }
- return true;
- }
-
- // Sets the current position to -1 and creates an empty sequence.
- protected boolean initializeComponentsFromTypeCode() {
- // already done in the type code constructor
- components = new DynAny[0];
- anys = new Any[0];
- return true;
- }
-
- // Collapses the whole DynAny hierarchys values into one single streamed Any
- protected boolean initializeAnyFromComponents() {
- OutputStream out = any.create_output_stream();
- // Writing the length first is the only difference to supers implementation
- out.write_long(components.length);
- for (int i=0; i<components.length; i++) {
- if (components[i] instanceof DynAnyImpl) {
- ((DynAnyImpl)components[i]).writeAny(out);
- } else {
- // Not our implementation. Nothing we can do to prevent copying.
- components[i].to_any().write_value(out);
- }
- }
- any.read_value(out.create_input_stream(), any.type());
- return true;
- }
-
-
- //
- // DynSequence interface methods
- //
-
- // Returns the current length of the sequence
- public int get_length() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return (checkInitComponents() ? components.length : 0);
- }
-
- // Sets the length of the sequence. Increasing the length of a sequence
- // adds new elements at the tail without affecting the values of already
- // existing elements. Newly added elements are default-initialized.
- //
- // Increasing the length of a sequence sets the current position to the first
- // newly-added element if the previous current position was -1.
- // Otherwise, if the previous current position was not -1,
- // the current position is not affected.
- //
- // Increasing the length of a bounded sequence to a value larger than the bound
- // raises InvalidValue.
- //
- // Decreasing the length of a sequence removes elements from the tail
- // without affecting the value of those elements that remain.
- // The new current position after decreasing the length of a sequence is determined
- // as follows:
- // ?f the length of the sequence is set to zero, the current position is set to -1.
- // ?f the current position is -1 before decreasing the length, it remains at -1.
- // ?f the current position indicates a valid element and that element is not removed
- // when the length is decreased, the current position remains unaffected.
- // ?f the current position indicates a valid element and that element is removed, the
- // current position is set to -1.
- public void set_length(int len)
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- int bound = getBound();
- if (bound > 0 && len > bound) {
- throw new InvalidValue();
- }
-
- checkInitComponents();
-
- int oldLength = components.length;
- if (len > oldLength) {
- // Increase length
- DynAny[] newComponents = new DynAny[len];
- Any[] newAnys = new Any[len];
- System.arraycopy(components, 0, newComponents, 0, oldLength);
- System.arraycopy(anys, 0, newAnys, 0, oldLength);
- components = newComponents;
- anys = newAnys;
-
- // Newly added elements are default-initialized
- TypeCode contentType = getContentType();
- for (int i=oldLength; i<len; i++) {
- createDefaultComponentAt(i, contentType);
- }
-
- // Increasing the length of a sequence sets the current position to the first
- // newly-added element if the previous current position was -1.
- if (index == NO_INDEX)
- index = oldLength;
- } else if (len < oldLength) {
- // Decrease length
- DynAny[] newComponents = new DynAny[len];
- Any[] newAnys = new Any[len];
- System.arraycopy(components, 0, newComponents, 0, len);
- System.arraycopy(anys, 0, newAnys, 0, len);
- // It is probably right not to destroy the released component DynAnys.
- // Some other DynAny or a user variable might still hold onto them
- // and if not then the garbage collector will take care of it.
- //for (int i=len; i<oldLength; i++) {
- // components[i].destroy();
- //}
- components = newComponents;
- anys = newAnys;
-
- // ?f the length of the sequence is set to zero, the current position is set to -1.
- // ?f the current position is -1 before decreasing the length, it remains at -1.
- // ?f the current position indicates a valid element and that element is not removed
- // when the length is decreased, the current position remains unaffected.
- // ?f the current position indicates a valid element and that element is removed,
- // the current position is set to -1.
- if (len == 0 || index >= len) {
- index = NO_INDEX;
- }
- } else {
- // Length unchanged
- // Maybe components is now default initialized from type code
- if (index == NO_INDEX && len > 0) {
- index = 0;
- }
- }
- }
-
- // Initializes the elements of the sequence.
- // The length of the DynSequence is set to the length of value.
- // The current position is set to zero if value has non-zero length
- // and to -1 if value is a zero-length sequence.
- // If the length of value exceeds the bound of a bounded sequence,
- // the operation raises InvalidValue.
- // If value contains one or more elements whose TypeCode is not equivalent
- // to the element TypeCode of the DynSequence, the operation raises TypeMismatch.
-/*
- public void set_elements(org.omg.CORBA.Any[] value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-*/
-
- //
- // Utility methods
- //
-
- protected void checkValue(Object[] value)
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (value == null || value.length == 0) {
- clearData();
- index = NO_INDEX;
- return;
- } else {
- index = 0;
- }
- int bound = getBound();
- if (bound > 0 && value.length > bound) {
- throw new InvalidValue();
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynStructImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynStructImpl.java
deleted file mode 100644
index 43145e2..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynStructImpl.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynStructImpl extends DynAnyComplexImpl implements DynStruct
-{
- //
- // Constructors
- //
-
- private DynStructImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynStructImpl(ORB orb, Any any, boolean copyValue) {
- // We can be sure that typeCode is of kind tk_struct
- super(orb, any, copyValue);
- // Initialize components lazily, on demand.
- // This is an optimization in case the user is only interested in storing Anys.
- }
-
- protected DynStructImpl(ORB orb, TypeCode typeCode) {
- // We can be sure that typeCode is of kind tk_struct
- super(orb, typeCode);
- // For DynStruct, the operation sets the current position to -1
- // for empty exceptions and to zero for all other TypeCodes.
- // The members (if any) are (recursively) initialized to their default values.
- index = 0;
- }
-
- //
- // Methods differing from DynValues
- //
-
- public org.omg.DynamicAny.NameValuePair[] get_members () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- checkInitComponents();
- return nameValuePairs;
- }
-
- public org.omg.DynamicAny.NameDynAnyPair[] get_members_as_dyn_any () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- checkInitComponents();
- return nameDynAnyPairs;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynUnionImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynUnionImpl.java
deleted file mode 100644
index 51a44b5..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynUnionImpl.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynUnionImpl extends DynAnyConstructedImpl implements DynUnion
-{
- //
- // Instance variables
- //
-
- DynAny discriminator = null;
- // index either points to the discriminator or the named member is it exists.
- // The currently active member, which is of the same type as the discriminator.
- DynAny currentMember = null;
- int currentMemberIndex = NO_INDEX;
-
- //
- // Constructors
- //
-
- private DynUnionImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynUnionImpl(ORB orb, Any any, boolean copyValue) {
- // We can be sure that typeCode is of kind tk_union
- super(orb, any, copyValue);
- }
-
- protected DynUnionImpl(ORB orb, TypeCode typeCode) {
- // We can be sure that typeCode is of kind tk_union
- super(orb, typeCode);
- }
-
- protected boolean initializeComponentsFromAny() {
- try {
- InputStream input = any.create_input_stream();
- Any discriminatorAny = DynAnyUtil.extractAnyFromStream(discriminatorType(), input, orb);
- discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
- currentMemberIndex = currentUnionMemberIndex(discriminatorAny);
- Any memberAny = DynAnyUtil.extractAnyFromStream(memberType(currentMemberIndex), input, orb);
- currentMember = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false);
- components = new DynAny[] {discriminator, currentMember};
- } catch (InconsistentTypeCode ictc) { // impossible
- }
- return true;
- }
-
- // Sets the current position to zero.
- // The discriminator value is set to a value consistent with the first named member
- // of the union. That member is activated and (recursively) initialized to its default value.
- protected boolean initializeComponentsFromTypeCode() {
- //System.out.println(this + " initializeComponentsFromTypeCode");
- try {
- // We can be sure that memberCount() > 0 according to the IDL language spec
- discriminator = DynAnyUtil.createMostDerivedDynAny(memberLabel(0), orb, false);
- index = 0;
- currentMemberIndex = 0;
- currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(0), orb);
- components = new DynAny[] {discriminator, currentMember};
- } catch (InconsistentTypeCode ictc) { // impossible
- }
- return true;
- }
-
- //
- // Convenience methods
- //
-
- private TypeCode discriminatorType() {
- TypeCode discriminatorType = null;
- try {
- discriminatorType = any.type().discriminator_type();
- } catch (BadKind bad) {
- }
- return discriminatorType;
- }
-
- private int memberCount() {
- int memberCount = 0;
- try {
- memberCount = any.type().member_count();
- } catch (BadKind bad) {
- }
- return memberCount;
- }
-
- private Any memberLabel(int i) {
- Any memberLabel = null;
- try {
- memberLabel = any.type().member_label(i);
- } catch (BadKind bad) {
- } catch (Bounds bounds) {
- }
- return memberLabel;
- }
-
- private TypeCode memberType(int i) {
- TypeCode memberType = null;
- try {
- memberType = any.type().member_type(i);
- } catch (BadKind bad) {
- } catch (Bounds bounds) {
- }
- return memberType;
- }
-
- private String memberName(int i) {
- String memberName = null;
- try {
- memberName = any.type().member_name(i);
- } catch (BadKind bad) {
- } catch (Bounds bounds) {
- }
- return memberName;
- }
-
- private int defaultIndex() {
- int defaultIndex = -1;
- try {
- defaultIndex = any.type().default_index();
- } catch (BadKind bad) {
- }
- return defaultIndex;
- }
-
- private int currentUnionMemberIndex(Any discriminatorValue) {
- int memberCount = memberCount();
- Any memberLabel;
- for (int i=0; i<memberCount; i++) {
- memberLabel = memberLabel(i);
- if (memberLabel.equal(discriminatorValue)) {
- return i;
- }
- }
- if (defaultIndex() != -1) {
- return defaultIndex();
- }
- return NO_INDEX;
- }
-
- protected void clearData() {
- super.clearData();
- discriminator = null;
- // Necessary to guarantee OBJECT_NOT_EXIST in member()
- currentMember.destroy();
- currentMember = null;
- currentMemberIndex = NO_INDEX;
- }
-
- //
- // DynAny interface methods
- //
-
- // _REVISIT_ More efficient copy operation
-
- //
- // DynUnion interface methods
- //
-
- /**
- * Returns the current discriminator value.
- */
- public org.omg.DynamicAny.DynAny get_discriminator () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return (checkInitComponents() ? discriminator : null);
- }
-
- // Sets the discriminator of the DynUnion to the specified value.
- // If the TypeCode of the parameter is not equivalent
- // to the TypeCode of the unions discriminator, the operation raises TypeMismatch.
- //
- // Setting the discriminator to a value that is consistent with the currently
- // active union member does not affect the currently active member.
- // Setting the discriminator to a value that is inconsistent with the currently
- // active member deactivates the member and activates the member that is consistent
- // with the new discriminator value (if there is a member for that value)
- // by initializing the member to its default value.
- //
- // If the discriminator value indicates a non-existent union member
- // this operation sets the current position to 0
- // (has_no_active_member returns true in this case).
- // Otherwise the current position is set to 1 (has_no_active_member returns false and
- // component_count returns 2 in this case).
- public void set_discriminator (org.omg.DynamicAny.DynAny newDiscriminator)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if ( ! newDiscriminator.type().equal(discriminatorType())) {
- throw new TypeMismatch();
- }
- newDiscriminator = DynAnyUtil.convertToNative(newDiscriminator, orb);
- Any newDiscriminatorAny = getAny(newDiscriminator);
- int newCurrentMemberIndex = currentUnionMemberIndex(newDiscriminatorAny);
- if (newCurrentMemberIndex == NO_INDEX) {
- clearData();
- index = 0;
- } else {
- // _REVISIT_ Could possibly optimize here if we don't need to initialize components
- checkInitComponents();
- if (currentMemberIndex == NO_INDEX || newCurrentMemberIndex != currentMemberIndex) {
- clearData();
- index = 1;
- currentMemberIndex = newCurrentMemberIndex;
- try {
- currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(currentMemberIndex), orb);
- } catch (InconsistentTypeCode ictc) {}
- discriminator = newDiscriminator;
- components = new DynAny[] { discriminator, currentMember };
- representations = REPRESENTATION_COMPONENTS;
- }
- }
- }
-
- // Sets the discriminator to a value that is consistent with the value
- // of the default case of a union; it sets the current position to
- // zero and causes component_count to return 2.
- // Calling set_to_default_member on a union that does not have an explicit
- // default case raises TypeMismatch.
- public void set_to_default_member ()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- int defaultIndex = defaultIndex();
- if (defaultIndex == -1) {
- throw new TypeMismatch();
- }
- try {
- clearData();
- index = 1;
- currentMemberIndex = defaultIndex;
- currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
- components = new DynAny[] {discriminator, currentMember};
- Any discriminatorAny = orb.create_any();
- discriminatorAny.insert_octet((byte)0);
- discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
- representations = REPRESENTATION_COMPONENTS;
- } catch (InconsistentTypeCode ictc) {}
- }
-
- // Sets the discriminator to a value that does not correspond
- // to any of the unions case labels.
- // It sets the current position to zero and causes component_count to return 1.
- // Calling set_to_no_active_member on a union that has an explicit default case
- // or on a union that uses the entire range of discriminator values
- // for explicit case labels raises TypeMismatch.
- public void set_to_no_active_member ()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- // _REVISIT_ How does one check for "entire range of discriminator values"?
- if (defaultIndex() != -1) {
- throw new TypeMismatch();
- }
- checkInitComponents();
- Any discriminatorAny = getAny(discriminator);
- // erase the discriminators value so that it does not correspond
- // to any of the unions case labels
- discriminatorAny.type(discriminatorAny.type());
- index = 0;
- currentMemberIndex = NO_INDEX;
- // Necessary to guarantee OBJECT_NOT_EXIST in member()
- currentMember.destroy();
- currentMember = null;
- components[0] = discriminator;
- representations = REPRESENTATION_COMPONENTS;
- }
-
- // Returns true if the union has no active member
- // (that is, the unions value consists solely of its discriminator because the
- // discriminator has a value that is not listed as an explicit case label).
- // Calling this operation on a union that has a default case returns false.
- // Calling this operation on a union that uses the entire range of discriminator
- // values for explicit case labels returns false.
- public boolean has_no_active_member () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- // _REVISIT_ How does one check for "entire range of discriminator values"?
- if (defaultIndex() != -1) {
- return false;
- }
- checkInitComponents();
- return (checkInitComponents() ? (currentMemberIndex == NO_INDEX) : false);
- }
-
- public org.omg.CORBA.TCKind discriminator_kind () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return discriminatorType().kind();
- }
-
- // Returns the currently active member.
- // If the union has no active member, the operation raises InvalidValue.
- // Note that the returned reference remains valid only for as long
- // as the currently active member does not change.
- // Using the returned reference beyond the life time
- // of the currently active member raises OBJECT_NOT_EXIST.
- public org.omg.DynamicAny.DynAny member ()
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if ( ! checkInitComponents() || currentMemberIndex == NO_INDEX)
- throw new InvalidValue();
- return currentMember;
- }
-
- // Returns the name of the currently active member.
- // If the unions TypeCode does not contain a member name for the currently active member,
- // the operation returns an empty string.
- // Calling member_name on a union without an active member raises InvalidValue.
- public String member_name ()
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if ( ! checkInitComponents() || currentMemberIndex == NO_INDEX)
- throw new InvalidValue();
- String memberName = memberName(currentMemberIndex);
- return (memberName == null ? "" : memberName);
- }
-
- // Returns the TCKind value of the TypeCode of the currently active member.
- // If the union has no active member, the operation raises InvalidValue.
- public org.omg.CORBA.TCKind member_kind ()
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if ( ! checkInitComponents() || currentMemberIndex == NO_INDEX)
- throw new InvalidValue();
- return memberType(currentMemberIndex).kind();
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynValueBoxImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynValueBoxImpl.java
deleted file mode 100644
index 60ad744..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynValueBoxImpl.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynValueBoxImpl extends DynValueCommonImpl implements DynValueBox
-{
- //
- // Constructors
- //
-
- private DynValueBoxImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynValueBoxImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- }
-
- protected DynValueBoxImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- }
-
- //
- // DynValueBox methods
- //
-
- public Any get_boxed_value()
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (isNull) {
- throw new InvalidValue();
- }
- checkInitAny();
- return any;
- }
-
- public void set_boxed_value(org.omg.CORBA.Any boxed)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- if ( ! isNull && ! boxed.type().equal(this.type())) {
- throw new TypeMismatch();
- }
- clearData();
- any = boxed;
- representations = REPRESENTATION_ANY;
- index = 0;
- isNull = false;
- }
-
- public DynAny get_boxed_value_as_dyn_any()
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (isNull) {
- throw new InvalidValue();
- }
- checkInitComponents();
- return components[0];
- }
-
- public void set_boxed_value_as_dyn_any(DynAny boxed)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- if ( ! isNull && ! boxed.type().equal(this.type())) {
- throw new TypeMismatch();
- }
- clearData();
- components = new DynAny[] {boxed};
- representations = REPRESENTATION_COMPONENTS;
- index = 0;
- isNull = false;
- }
-
- protected boolean initializeComponentsFromAny() {
- try {
- components = new DynAny[] {DynAnyUtil.createMostDerivedDynAny(any, orb, false)};
- } catch (InconsistentTypeCode ictc) {
- return false; // impossible
- }
- return true;
- }
-
- protected boolean initializeComponentsFromTypeCode() {
- try {
- any = DynAnyUtil.createDefaultAnyOfType(any.type(), orb);
- components = new DynAny[] {DynAnyUtil.createMostDerivedDynAny(any, orb, false)};
- } catch (InconsistentTypeCode ictc) {
- return false; // impossible
- }
- return true;
- }
-
- protected boolean initializeAnyFromComponents() {
- any = getAny(components[0]);
- return true;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynValueCommonImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynValueCommonImpl.java
deleted file mode 100644
index 215551c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynValueCommonImpl.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-abstract class DynValueCommonImpl extends DynAnyComplexImpl implements DynValueCommon
-{
- //
- // Constructors
- //
-
- protected boolean isNull;
-
- private DynValueCommonImpl() {
- this(null, (Any)null, false);
- isNull = true;
- }
-
- protected DynValueCommonImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- isNull = checkInitComponents();
- }
-
- protected DynValueCommonImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- isNull = true;
- }
-
- //
- // DynValueCommon methods
- //
-
- // Returns TRUE if this object represents a null valuetype
- public boolean is_null() {
- return isNull;
- }
-
- // Changes the representation to a null valuetype.
- public void set_to_null() {
- isNull = true;
- clearData();
- }
-
- // If this object represents a null valuetype then this operation
- // replaces it with a newly constructed value with its components
- // initialized to default values as in DynAnyFactory::create_dyn_any_from_type_code.
- // If this object represents a non-null valuetype, then this operation has no effect.
- public void set_to_value() {
- if (isNull) {
- isNull = false;
- // the rest is done lazily
- }
- // else: there is nothing to do
- }
-
- //
- // Methods differing from DynStruct
- //
-
- // Required to raise InvalidValue if this is a null value type.
- public org.omg.DynamicAny.NameValuePair[] get_members ()
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (isNull) {
- throw new InvalidValue();
- }
- checkInitComponents();
- return nameValuePairs;
- }
-
- // Required to raise InvalidValue if this is a null value type.
- public org.omg.DynamicAny.NameDynAnyPair[] get_members_as_dyn_any ()
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (isNull) {
- throw new InvalidValue();
- }
- checkInitComponents();
- return nameDynAnyPairs;
- }
-
- //
- // Overridden methods
- //
-
- // Overridden to change to non-null status.
- public void set_members (org.omg.DynamicAny.NameValuePair[] value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- super.set_members(value);
- // If we didn't get an exception then this must be a valid non-null value
- isNull = false;
- }
-
- // Overridden to change to non-null status.
- public void set_members_as_dyn_any (org.omg.DynamicAny.NameDynAnyPair[] value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- super.set_members_as_dyn_any(value);
- // If we didn't get an exception then this must be a valid non-null value
- isNull = false;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynValueImpl.java b/src/share/classes/com/sun/corba/se/impl/dynamicany/DynValueImpl.java
deleted file mode 100644
index 2556895..0000000
--- a/src/share/classes/com/sun/corba/se/impl/dynamicany/DynValueImpl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynValueImpl extends DynValueCommonImpl implements DynValue
-{
- //
- // Constructors
- //
-
- private DynValueImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynValueImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- }
-
- protected DynValueImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerFactory.java b/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerFactory.java
deleted file mode 100644
index b61926b..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerFactory.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import com.sun.corba.se.impl.encoding.BufferManagerRead;
-import com.sun.corba.se.impl.encoding.BufferManagerReadGrow;
-import com.sun.corba.se.impl.encoding.BufferManagerReadStream;
-import com.sun.corba.se.impl.encoding.BufferManagerWrite;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.orb.ORB;
-
-import org.omg.CORBA.INTERNAL;
-
-/**
- * Creates read/write buffer managers to handle over/under flow
- * in CDR*putStream.
- */
-
-public class BufferManagerFactory
-{
- public static final int GROW = 0;
- public static final int COLLECT = 1;
- public static final int STREAM = 2;
-
- // The next two methods allow creation of BufferManagers based on GIOP version.
- // We may want more criteria to be involved in this decision.
- // These are only used for sending messages (so could be fragmenting)
- public static BufferManagerRead newBufferManagerRead(
- GIOPVersion version, byte encodingVersion, ORB orb) {
-
- // REVISIT - On the reading side, shouldn't we monitor the incoming
- // fragments on a given connection to determine what fragment size
- // they're using, then use that ourselves?
-
- if (encodingVersion != Message.CDR_ENC_VERSION) {
- return new BufferManagerReadGrow(orb);
- }
-
- switch (version.intValue())
- {
- case GIOPVersion.VERSION_1_0:
- return new BufferManagerReadGrow(orb);
- case GIOPVersion.VERSION_1_1:
- case GIOPVersion.VERSION_1_2:
- // The stream reader can handle fragmented and
- // non fragmented messages
- return new BufferManagerReadStream(orb);
- default:
- // REVISIT - what is appropriate?
- throw new INTERNAL("Unknown GIOP version: "
- + version);
- }
- }
-
- public static BufferManagerRead newBufferManagerRead(
- int strategy, byte encodingVersion, ORB orb) {
-
- if (encodingVersion != Message.CDR_ENC_VERSION) {
- if (strategy != BufferManagerFactory.GROW) {
- ORBUtilSystemException wrapper =
- ORBUtilSystemException.get((ORB)orb,
- CORBALogDomains.RPC_ENCODING);
- throw wrapper.invalidBuffMgrStrategy("newBufferManagerRead");
- }
- return new BufferManagerReadGrow(orb);
- }
- switch (strategy) {
- case BufferManagerFactory.GROW:
- return new BufferManagerReadGrow(orb);
- case BufferManagerFactory.COLLECT:
- throw new INTERNAL("Collect strategy invalid for reading");
- case BufferManagerFactory.STREAM:
- return new BufferManagerReadStream(orb);
- default:
- throw new INTERNAL("Unknown buffer manager read strategy: "
- + strategy);
- }
- }
-
- public static BufferManagerWrite newBufferManagerWrite(
- int strategy, byte encodingVersion, ORB orb) {
- if (encodingVersion != Message.CDR_ENC_VERSION) {
- if (strategy != BufferManagerFactory.GROW) {
- ORBUtilSystemException wrapper =
- ORBUtilSystemException.get((ORB)orb,
- CORBALogDomains.RPC_ENCODING);
- throw wrapper.invalidBuffMgrStrategy("newBufferManagerWrite");
- }
- return new BufferManagerWriteGrow(orb);
- }
- switch (strategy) {
- case BufferManagerFactory.GROW:
- return new BufferManagerWriteGrow(orb);
- case BufferManagerFactory.COLLECT:
- return new BufferManagerWriteCollect(orb);
- case BufferManagerFactory.STREAM:
- return new BufferManagerWriteStream(orb);
- default:
- throw new INTERNAL("Unknown buffer manager write strategy: "
- + strategy);
- }
- }
-
- public static BufferManagerWrite newBufferManagerWrite(
- GIOPVersion version, byte encodingVersion, ORB orb) {
- if (encodingVersion != Message.CDR_ENC_VERSION) {
- return new BufferManagerWriteGrow(orb);
- }
- return BufferManagerFactory.newBufferManagerWrite(
- orb.getORBData().getGIOPBuffMgrStrategy(version),
- encodingVersion, orb);
- }
-
- public static BufferManagerRead defaultBufferManagerRead(ORB orb) {
- return new BufferManagerReadGrow(orb);
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerRead.java b/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerRead.java
deleted file mode 100644
index 2fb2c3f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerRead.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.ByteBuffer;
-import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-public interface BufferManagerRead
-{
- /**
- * Case: Called from ReaderThread on complete message or fragments.
- * The given buf may be entire message or a fragment.
- *
- * The ReaderThread finds the ReadBufferManager instance either in
- * in a fragment map (when collecting - GIOP 1.2 phase 1) or
- * in an active server requests map (when streaming - GIOP 1.2 phase 2).
- *
- * As a model for implementation see IIOPInputStream's
- * constructor of the same name. There are going to be some variations.
- *
- */
-
- public void processFragment ( ByteBuffer byteBuffer,
- FragmentMessage header);
-
-
- /**
- * Case: called from CDRInputStream constructor before unmarshaling.
- *
- * Does:
- *
- * this.bufQ.get()
- *
- * If streaming then sync on bufQ and wait if empty.
- */
-
-
- /**
- * Case: called from CDRInputStream.grow.
- *
- * Does:
- *
- * this.bufQ.get()
- *
- * If streaming then sync on bufQ and wait if empty.
- */
-
- public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi);
-
- /**
- * Called once after creating this buffer manager and before
- * it begins processing.
- */
- public void init(Message header);
-
- /**
- * Returns the mark/reset handler for this stream.
- */
- public MarkAndResetHandler getMarkAndResetHandler();
-
- /*
- * Signals that the processing be cancelled.
- */
- public void cancelProcessing(int requestId);
-
- /*
- * Close BufferManagerRead and perform any oustanding cleanup.
- */
- public void close(ByteBufferWithInfo bbwi);
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadGrow.java b/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadGrow.java
deleted file mode 100644
index 1e827fa..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadGrow.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.ByteBuffer;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-public class BufferManagerReadGrow
- implements BufferManagerRead, MarkAndResetHandler
-{
- // REVISIT - This should go in an abstract class called
- // BufferManagerReadBase which should implement
- // BufferManagerRead. Then, this class should extend
- // BufferManagerReadBase.
- private ORB orb ;
-
- private ORBUtilSystemException wrapper ;
-
- BufferManagerReadGrow( ORB orb )
- {
- this.orb = orb ;
- this.wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- }
-
- public void processFragment (ByteBuffer byteBuffer, FragmentMessage header)
- {
- // REVISIT - should we consider throwing an exception similar to what's
- // done for underflow()???
- }
-
- public void init(Message msg) {}
-
- public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
- {
- throw wrapper.unexpectedEof() ;
- }
-
- public void cancelProcessing(int requestId) {}
-
- // Mark and reset handler -------------------------
-
- private Object streamMemento;
- private RestorableInputStream inputStream;
- private boolean markEngaged = false;
-
- public MarkAndResetHandler getMarkAndResetHandler() {
- return this;
- }
-
- public void mark(RestorableInputStream is) {
- markEngaged = true;
- inputStream = is;
- streamMemento = inputStream.createStreamMemento();
- }
-
- // This will never happen
- public void fragmentationOccured(ByteBufferWithInfo newFragment) {}
-
- public void reset() {
-
- if (!markEngaged)
- return;
-
- markEngaged = false;
- inputStream.restoreInternalState(streamMemento);
- streamMemento = null;
- }
-
- // Nothing to close and cleanup.
- public void close(ByteBufferWithInfo bbwi) {}
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadStream.java
deleted file mode 100644
index bc87a38..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadStream.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (c) 2000, 2009, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.ByteBuffer;
-import com.sun.corba.se.pept.transport.ByteBufferPool;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.protocol.RequestCanceledException;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-import java.util.*;
-
-public class BufferManagerReadStream
- implements BufferManagerRead, MarkAndResetHandler
-{
- private boolean receivedCancel = false;
- private int cancelReqId = 0;
-
- // We should convert endOfStream to a final static dummy end node
- private boolean endOfStream = true;
- private BufferQueue fragmentQueue = new BufferQueue();
- private long FRAGMENT_TIMEOUT = 60000;
-
- // REVISIT - This should go in BufferManagerRead. But, since
- // BufferManagerRead is an interface. BufferManagerRead
- // might ought to be an abstract class instead of an
- // interface.
- private ORB orb ;
- private ORBUtilSystemException wrapper ;
- private boolean debug = false;
-
- BufferManagerReadStream( ORB orb )
- {
- this.orb = orb ;
- this.wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- debug = orb.transportDebugFlag;
- }
-
- public void cancelProcessing(int requestId) {
- synchronized(fragmentQueue) {
- receivedCancel = true;
- cancelReqId = requestId;
- fragmentQueue.notify();
- }
- }
-
- public void processFragment(ByteBuffer byteBuffer, FragmentMessage msg)
- {
- ByteBufferWithInfo bbwi =
- new ByteBufferWithInfo(orb, byteBuffer, msg.getHeaderLength());
-
- synchronized (fragmentQueue) {
- if (debug)
- {
- // print address of ByteBuffer being queued
- int bbAddress = System.identityHashCode(byteBuffer);
- StringBuffer sb = new StringBuffer(80);
- sb.append("processFragment() - queueing ByteBuffer id (");
- sb.append(bbAddress).append(") to fragment queue.");
- String strMsg = sb.toString();
- dprint(strMsg);
- }
- fragmentQueue.enqueue(bbwi);
- endOfStream = !msg.moreFragmentsToFollow();
- fragmentQueue.notify();
- }
- }
-
- public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
- {
-
- ByteBufferWithInfo result = null;
-
- try {
- //System.out.println("ENTER underflow");
-
- synchronized (fragmentQueue) {
-
- if (receivedCancel) {
- throw new RequestCanceledException(cancelReqId);
- }
-
- while (fragmentQueue.size() == 0) {
-
- if (endOfStream) {
- throw wrapper.endOfStream() ;
- }
-
- boolean interrupted = false;
- try {
- fragmentQueue.wait(FRAGMENT_TIMEOUT);
- } catch (InterruptedException e) {
- interrupted = true;
- }
-
- if (!interrupted && fragmentQueue.size() == 0) {
- throw wrapper.bufferReadManagerTimeout();
- }
-
- if (receivedCancel) {
- throw new RequestCanceledException(cancelReqId);
- }
- }
-
- result = fragmentQueue.dequeue();
- result.fragmented = true;
-
- if (debug)
- {
- // print address of ByteBuffer being dequeued
- int bbAddr = System.identityHashCode(result.byteBuffer);
- StringBuffer sb1 = new StringBuffer(80);
- sb1.append("underflow() - dequeued ByteBuffer id (");
- sb1.append(bbAddr).append(") from fragment queue.");
- String msg1 = sb1.toString();
- dprint(msg1);
- }
-
- // VERY IMPORTANT
- // Release bbwi.byteBuffer to the ByteBufferPool only if
- // this BufferManagerStream is not marked for potential restore.
- if (markEngaged == false && bbwi != null && bbwi.byteBuffer != null)
- {
- ByteBufferPool byteBufferPool = getByteBufferPool();
-
- if (debug)
- {
- // print address of ByteBuffer being released
- int bbAddress = System.identityHashCode(bbwi.byteBuffer);
- StringBuffer sb = new StringBuffer(80);
- sb.append("underflow() - releasing ByteBuffer id (");
- sb.append(bbAddress).append(") to ByteBufferPool.");
- String msg = sb.toString();
- dprint(msg);
- }
-
- byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
- bbwi.byteBuffer = null;
- bbwi = null;
- }
- }
- return result;
- } finally {
- //System.out.println("EXIT underflow");
- }
- }
-
- public void init(Message msg) {
- if (msg != null)
- endOfStream = !msg.moreFragmentsToFollow();
- }
-
- // Release any queued ByteBufferWithInfo's byteBuffers to the
- // ByteBufferPoool
- public void close(ByteBufferWithInfo bbwi)
- {
- int inputBbAddress = 0;
-
- // release ByteBuffers on fragmentQueue
- if (fragmentQueue != null)
- {
- synchronized (fragmentQueue)
- {
- // IMPORTANT: The fragment queue may have one ByteBuffer
- // on it that's also on the CDRInputStream if
- // this method is called when the stream is 'marked'.
- // Thus, we'll compare the ByteBuffer passed
- // in (from a CDRInputStream) with all ByteBuffers
- // on the stack. If one is found to equal, it will
- // not be released to the ByteBufferPool.
- if (bbwi != null)
- {
- inputBbAddress = System.identityHashCode(bbwi.byteBuffer);
- }
-
- ByteBufferWithInfo abbwi = null;
- ByteBufferPool byteBufferPool = getByteBufferPool();
- while (fragmentQueue.size() != 0)
- {
- abbwi = fragmentQueue.dequeue();
- if (abbwi != null && abbwi.byteBuffer != null)
- {
- int bbAddress = System.identityHashCode(abbwi.byteBuffer);
- if (inputBbAddress != bbAddress)
- {
- if (debug)
- {
- // print address of ByteBuffer released
- StringBuffer sb = new StringBuffer(80);
- sb.append("close() - fragmentQueue is ")
- .append("releasing ByteBuffer id (")
- .append(bbAddress).append(") to ")
- .append("ByteBufferPool.");
- String msg = sb.toString();
- dprint(msg);
- }
- }
- byteBufferPool.releaseByteBuffer(abbwi.byteBuffer);
- }
- }
- }
- fragmentQueue = null;
- }
-
- // release ByteBuffers on fragmentStack
- if (fragmentStack != null && fragmentStack.size() != 0)
- {
- // IMPORTANT: The fragment stack may have one ByteBuffer
- // on it that's also on the CDRInputStream if
- // this method is called when the stream is 'marked'.
- // Thus, we'll compare the ByteBuffer passed
- // in (from a CDRInputStream) with all ByteBuffers
- // on the stack. If one is found to equal, it will
- // not be released to the ByteBufferPool.
- if (bbwi != null)
- {
- inputBbAddress = System.identityHashCode(bbwi.byteBuffer);
- }
-
- ByteBufferWithInfo abbwi = null;
- ByteBufferPool byteBufferPool = getByteBufferPool();
- ListIterator itr = fragmentStack.listIterator();
- while (itr.hasNext())
- {
- abbwi = (ByteBufferWithInfo)itr.next();
-
- if (abbwi != null && abbwi.byteBuffer != null)
- {
- int bbAddress = System.identityHashCode(abbwi.byteBuffer);
- if (inputBbAddress != bbAddress)
- {
- if (debug)
- {
- // print address of ByteBuffer being released
- StringBuffer sb = new StringBuffer(80);
- sb.append("close() - fragmentStack - releasing ")
- .append("ByteBuffer id (" + bbAddress + ") to ")
- .append("ByteBufferPool.");
- String msg = sb.toString();
- dprint(msg);
- }
- byteBufferPool.releaseByteBuffer(abbwi.byteBuffer);
- }
- }
- }
- fragmentStack = null;
- }
-
- }
-
- protected ByteBufferPool getByteBufferPool()
- {
- return orb.getByteBufferPool();
- }
-
- private void dprint(String msg)
- {
- ORBUtility.dprint("BufferManagerReadStream", msg);
- }
-
- // Mark and reset handler ----------------------------------------
-
- private boolean markEngaged = false;
-
- // List of fragment ByteBufferWithInfos received since
- // the mark was engaged.
- private LinkedList fragmentStack = null;
- private RestorableInputStream inputStream = null;
-
- // Original state of the stream
- private Object streamMemento = null;
-
- public void mark(RestorableInputStream inputStream)
- {
- this.inputStream = inputStream;
- markEngaged = true;
-
- // Get the magic Object that the stream will use to
- // reconstruct it's state when reset is called
- streamMemento = inputStream.createStreamMemento();
-
- if (fragmentStack != null) {
- fragmentStack.clear();
- }
- }
-
- // Collects fragments received since the mark was engaged.
- public void fragmentationOccured(ByteBufferWithInfo newFragment)
- {
- if (!markEngaged)
- return;
-
- if (fragmentStack == null)
- fragmentStack = new LinkedList();
-
- fragmentStack.addFirst(new ByteBufferWithInfo(newFragment));
- }
-
- public void reset()
- {
- if (!markEngaged) {
- // REVISIT - call to reset without call to mark
- return;
- }
-
- markEngaged = false;
-
- // If we actually did peek across fragments, we need
- // to push those fragments onto the front of the
- // buffer queue.
- if (fragmentStack != null && fragmentStack.size() != 0) {
- ListIterator iter = fragmentStack.listIterator();
-
- synchronized(fragmentQueue) {
- while (iter.hasNext()) {
- fragmentQueue.push((ByteBufferWithInfo)iter.next());
- }
- }
-
- fragmentStack.clear();
- }
-
- // Give the stream the magic Object to restore
- // it's state.
- inputStream.restoreInternalState(streamMemento);
- }
-
- public MarkAndResetHandler getMarkAndResetHandler() {
- return this;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWrite.java b/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWrite.java
deleted file mode 100644
index a73f2cc..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWrite.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-/**
- * Defines the contract between the BufferManager and
- * CDR stream on the writing side. The CDR stream
- * calls back to the BufferManagerWrite when it needs
- * more room in the output buffer to continue. The
- * BufferManager can then grow the output buffer or
- * use some kind of fragmentation technique.
- */
-public abstract class BufferManagerWrite
-{
- protected ORB orb ;
- protected ORBUtilSystemException wrapper ;
-
- BufferManagerWrite( ORB orb )
- {
- this.orb = orb ;
- this.wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- }
-
- /**
- * Has the stream sent out any fragments so far?
- */
- public abstract boolean sentFragment();
-
- /**
- * Has the entire message been sent? (Has
- * sendMessage been called?)
- */
- public boolean sentFullMessage() {
- return sentFullMessage;
- }
-
- /**
- * Returns the correct buffer size for this type of
- * buffer manager as set in the ORB.
- */
- public abstract int getBufferSize();
-
- /*
- * Called from CDROutputStream.grow.
- *
- * bbwi.buf contains a byte array which needs to grow by bbwi.needed bytes.
- *
- * This can be handled in several ways:
- *
- * 1. Resize the bbwi.buf like the current implementation of
- * CDROutputStream.grow.
- *
- * 2. Collect the buffer for a later send:
- * this.bufQ.put(bbwi);
- * return new ByteBufferWithInfo(bbwi.length);
- *
- * 3. Send buffer as fragment:
- * Backpatch fragment size field in bbwi.buf.
- * Set more fragments bit in bbwi.buf.
- * this.connection.send(bbwi);
- * return reinitialized bbwi.buf with fragment header
- *
- * All cases should adjust the returned bbwi.* appropriately.
- *
- * Should set the bbwi.fragmented flag to true only in cases 2 and 3.
- */
-
- public abstract void overflow (ByteBufferWithInfo bbwi);
-
- /**
- * Called after Stub._invoke (i.e., before complete message has been sent).
- *
- * IIOPOutputStream.writeTo called from IIOPOutputStream.invoke
- *
- * Case: overflow was never called (bbwi.buf contains complete message).
- * Backpatch size field.
- * If growing or collecting:
- * this.bufQ.put(bbwi).
- * this.bufQ.iterate // However, see comment in getBufferQ
- * this.connection.send(fragment)
- * If streaming:
- * this.connection.send(bbwi).
- *
- * Case: overflow was called N times (bbwi.buf contains last buffer).
- * If growing or collecting:
- * this.bufQ.put(bbwi).
- * backpatch size field in first buffer.
- * this.bufQ.iterate // However, see comment in getBufferQ
- * this.connection.send(fragment)
- * If streaming:
- * backpatch fragment size field in bbwi.buf.
- * Set no more fragments bit.
- * this.connection.send(bbwi).
- */
-
- public abstract void sendMessage ();
-
- /**
- * A reference to the connection level stream will be required when
- * sending fragments.
- */
- public void setOutputObject(Object outputObject) {
- this.outputObject = outputObject;
- }
-
- /**
- * Close the BufferManagerWrite and do any outstanding cleanup.
- */
- abstract public void close();
-
-
- // XREVISIT - Currently a java.lang.Object during
- // the rip-int-generic transition. Should eventually
- // become a GIOPOutputObject.
- protected Object outputObject;
-
- protected boolean sentFullMessage = false;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteCollect.java b/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteCollect.java
deleted file mode 100644
index dc1de8d..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteCollect.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.ByteBuffer;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import java.util.LinkedList;
-
-import com.sun.corba.se.impl.encoding.BufferQueue;
-import com.sun.corba.se.impl.encoding.BufferManagerWrite;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.encoding.CDROutputObject;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.pept.transport.Connection;
-import com.sun.corba.se.pept.transport.ByteBufferPool;
-import com.sun.corba.se.pept.encoding.OutputObject;
-
-/**
- * Collect buffer manager.
- */
-public class BufferManagerWriteCollect extends BufferManagerWrite
-{
- private BufferQueue queue = new BufferQueue();
-
- private boolean sentFragment = false;
- private boolean debug = false;
-
-
- BufferManagerWriteCollect(ORB orb)
- {
- super(orb);
- if (orb != null)
- debug = orb.transportDebugFlag;
- }
-
- public boolean sentFragment() {
- return sentFragment;
- }
-
- /**
- * Returns the correct buffer size for this type of
- * buffer manager as set in the ORB.
- */
- public int getBufferSize() {
- return orb.getORBData().getGIOPFragmentSize();
- }
-
- // Set the fragment's "more fragments" bit to true, put it in the
- // queue, and allocate a new bbwi.
- public void overflow (ByteBufferWithInfo bbwi)
- {
- // Set the fragment's moreFragments field to true
- MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);
-
- // Enqueue the previous fragment
- queue.enqueue(bbwi);
-
- // Create a new bbwi
- ByteBufferWithInfo newBbwi = new ByteBufferWithInfo(orb, this);
- newBbwi.fragmented = true;
-
- // XREVISIT - Downcast
- ((CDROutputObject)outputObject).setByteBufferWithInfo(newBbwi);
-
- // Now we must marshal in the fragment header/GIOP header
-
- // REVISIT - we can optimize this by not creating the fragment message
- // each time.
-
- // XREVISIT - Downcast
- FragmentMessage header =
- ((CDROutputObject)outputObject).getMessageHeader()
- .createFragmentMessage();
-
- header.write((CDROutputObject)outputObject);
- }
-
- // Send all fragments
- public void sendMessage ()
- {
- // Enqueue the last fragment
- queue.enqueue(((CDROutputObject)outputObject).getByteBufferWithInfo());
-
- Iterator bufs = iterator();
-
- Connection conn =
- ((OutputObject)outputObject).getMessageMediator().
- getConnection();
-
- // With the collect strategy, we must lock the connection
- // while fragments are being sent. This is so that there are
- // no interleved fragments in GIOP 1.1.
- //
- // Note that this thread must not call writeLock again in any
- // of its send methods!
- conn.writeLock();
-
- try {
-
- // Get a reference to ByteBufferPool so that the ByteBufferWithInfo
- // ByteBuffer can be released to the ByteBufferPool
- ByteBufferPool byteBufferPool = orb.getByteBufferPool();
-
- while (bufs.hasNext()) {
-
- ByteBufferWithInfo bbwi = (ByteBufferWithInfo)bufs.next();
- ((CDROutputObject)outputObject).setByteBufferWithInfo(bbwi);
-
- conn.sendWithoutLock(((CDROutputObject)outputObject));
-
- sentFragment = true;
-
- // Release ByteBufferWithInfo's ByteBuffer back to the pool
- // of ByteBuffers.
- if (debug)
- {
- // print address of ByteBuffer being released
- int bbAddress = System.identityHashCode(bbwi.byteBuffer);
- StringBuffer sb = new StringBuffer(80);
- sb.append("sendMessage() - releasing ByteBuffer id (");
- sb.append(bbAddress).append(") to ByteBufferPool.");
- String msg = sb.toString();
- dprint(msg);
- }
- byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
- bbwi.byteBuffer = null;
- bbwi = null;
- }
-
- sentFullMessage = true;
-
- } finally {
-
- conn.writeUnlock();
- }
- }
-
- /**
- * Close the BufferManagerWrite - do any outstanding cleanup.
- *
- * For a BufferManagerWriteGrow any queued ByteBufferWithInfo must
- * have its ByteBuffer released to the ByteBufferPool.
- */
- public void close()
- {
- // iterate thru queue and release any ByteBufferWithInfo's
- // ByteBuffer that may be remaining on the queue to the
- // ByteBufferPool.
-
- Iterator bufs = iterator();
-
- ByteBufferPool byteBufferPool = orb.getByteBufferPool();
-
- while (bufs.hasNext())
- {
- ByteBufferWithInfo bbwi = (ByteBufferWithInfo)bufs.next();
- if (bbwi != null && bbwi.byteBuffer != null)
- {
- if (debug)
- {
- // print address of ByteBuffer being released
- int bbAddress = System.identityHashCode(bbwi.byteBuffer);
- StringBuffer sb = new StringBuffer(80);
- sb.append("close() - releasing ByteBuffer id (");
- sb.append(bbAddress).append(") to ByteBufferPool.");
- String msg = sb.toString();
- dprint(msg);
- }
- byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
- bbwi.byteBuffer = null;
- bbwi = null;
- }
- }
- }
-
- private void dprint(String msg)
- {
- ORBUtility.dprint("BufferManagerWriteCollect", msg);
- }
-
- private Iterator iterator ()
- {
- return new BufferManagerWriteCollectIterator();
- }
-
- private class BufferManagerWriteCollectIterator implements Iterator
- {
- public boolean hasNext ()
- {
- return queue.size() != 0;
- }
-
- public Object next ()
- {
- return queue.dequeue();
- }
-
- public void remove ()
- {
- throw new UnsupportedOperationException();
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteGrow.java b/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteGrow.java
deleted file mode 100644
index 1ede700..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteGrow.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
-import com.sun.corba.se.impl.encoding.BufferManagerWrite;
-import com.sun.corba.se.pept.encoding.OutputObject;
-import com.sun.corba.se.pept.transport.Connection;
-import com.sun.corba.se.spi.orb.ORB;
-
-public class BufferManagerWriteGrow extends BufferManagerWrite
-{
- BufferManagerWriteGrow( ORB orb )
- {
- super(orb) ;
- }
-
- public boolean sentFragment() {
- return false;
- }
-
- /**
- * Returns the correct buffer size for this type of
- * buffer manager as set in the ORB.
- */
- public int getBufferSize() {
- return orb.getORBData().getGIOPBufferSize();
- }
-
- public void overflow (ByteBufferWithInfo bbwi)
- {
- // The code that once lived directly in CDROutputStream.grow()
- // has been moved ByteBufferWithInfo.growBuffer().
-
- // Grow ByteBufferWithInfo to a larger size.
- bbwi.growBuffer(orb);
-
- // Must be false for the grow case
- bbwi.fragmented = false;
- }
-
- public void sendMessage ()
- {
- Connection conn =
- ((OutputObject)outputObject).getMessageMediator().getConnection();
-
- conn.writeLock();
-
- try {
-
- conn.sendWithoutLock((OutputObject)outputObject);
-
- sentFullMessage = true;
-
- } finally {
-
- conn.writeUnlock();
- }
- }
-
- /**
- * Close the BufferManagerWrite and do any outstanding cleanup.
- *
- * No work to do for a BufferManagerWriteGrow.
- */
- public void close() {}
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java
deleted file mode 100644
index e03c71c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.ByteBuffer;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
-import com.sun.corba.se.impl.encoding.BufferManagerWrite;
-import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
-import com.sun.corba.se.impl.encoding.CDROutputObject;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.pept.transport.Connection;
-import com.sun.corba.se.pept.encoding.OutputObject;
-import org.omg.CORBA.SystemException;
-
-/**
- * Streaming buffer manager.
- */
-public class BufferManagerWriteStream extends BufferManagerWrite
-{
- private int fragmentCount = 0;
-
- BufferManagerWriteStream( ORB orb )
- {
- super(orb) ;
- }
-
- public boolean sentFragment() {
- return fragmentCount > 0;
- }
-
- /**
- * Returns the correct buffer size for this type of
- * buffer manager as set in the ORB.
- */
- public int getBufferSize() {
- return orb.getORBData().getGIOPFragmentSize();
- }
-
- public void overflow (ByteBufferWithInfo bbwi)
- {
- // Set the fragment's moreFragments field to true
- MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);
-
- try {
- sendFragment(false);
- } catch(SystemException se){
- orb.getPIHandler().invokeClientPIEndingPoint(
- ReplyMessage.SYSTEM_EXCEPTION, se);
- throw se;
- }
-
- // Reuse the old buffer
-
- // REVISIT - need to account for case when needed > available
- // even after fragmenting. This is the large array case, so
- // the caller should retry when it runs out of space.
- bbwi.position(0);
- bbwi.buflen = bbwi.byteBuffer.limit();
- bbwi.fragmented = true;
-
- // Now we must marshal in the fragment header/GIOP header
-
- // REVISIT - we can optimize this by not creating the fragment message
- // each time.
-
- FragmentMessage header = ((CDROutputObject)outputObject).getMessageHeader().createFragmentMessage();
-
- header.write(((CDROutputObject)outputObject));
- }
-
- private void sendFragment(boolean isLastFragment)
- {
- Connection conn = ((OutputObject)outputObject).getMessageMediator().getConnection();
-
- // REVISIT: need an ORB
- //System.out.println("sendFragment: last?: " + isLastFragment);
- conn.writeLock();
-
- try {
- // Send the fragment
- conn.sendWithoutLock(((OutputObject)outputObject));
-
- fragmentCount++;
-
- } finally {
-
- conn.writeUnlock();
- }
-
- }
-
- // Sends the last fragment
- public void sendMessage ()
- {
- sendFragment(true);
-
- sentFullMessage = true;
- }
-
- /**
- * Close the BufferManagerWrite and do any outstanding cleanup.
- *
- * No work to do for a BufferManagerWriteStream
- */
- public void close(){};
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/BufferQueue.java b/src/share/classes/com/sun/corba/se/impl/encoding/BufferQueue.java
deleted file mode 100644
index 92618bc..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/BufferQueue.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.util.LinkedList;
-import java.util.NoSuchElementException;
-import java.util.LinkedList;
-
-/**
- * Simple unsynchronized queue implementation for ByteBufferWithInfos.
- */
-// XREVISIT - Should be in orbutil or package private
-public class BufferQueue
-{
- private LinkedList list = new LinkedList();
-
- public void enqueue(ByteBufferWithInfo item)
- {
- list.addLast(item);
- }
-
- public ByteBufferWithInfo dequeue() throws NoSuchElementException
- {
- return (ByteBufferWithInfo)list.removeFirst();
- }
-
- public int size()
- {
- return list.size();
- }
-
- // Adds the given ByteBufferWithInfo to the front
- // of the queue.
- public void push(ByteBufferWithInfo item)
- {
- list.addFirst(item);
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/ByteBufferWithInfo.java b/src/share/classes/com/sun/corba/se/impl/encoding/ByteBufferWithInfo.java
deleted file mode 100644
index 490fd60..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/ByteBufferWithInfo.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.ByteBuffer;
-
-
-import com.sun.corba.se.impl.encoding.BufferManagerWrite;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.pept.transport.ByteBufferPool;
-import com.sun.corba.se.spi.orb.ORB;
-
-
-// Notes about the class.
-// Assumptions, the ByteBuffer's position is set by the constructor's
-// index variable and the ByteBuffer's limit points to the end of the
-// data. Also, since the index variable tracks the current empty
-// position in the buffer, the ByteBuffer's position is updated
-// any time there's a call to this class's position().
-// Although, a ByteBuffer's length is it's capacity(), the context in
-// which length is used in this object, this.buflen is actually the
-// ByteBuffer limit().
-
-public class ByteBufferWithInfo
-{
- private ORB orb;
- private boolean debug;
- // REVISIT - index should eventually be replaced with byteBuffer.position()
- private int index; // Current empty position in buffer.
- // REVISIT - CHANGE THESE TO PRIVATE
- public ByteBuffer byteBuffer;// Marshal buffer.
- public int buflen; // Total length of buffer. // Unnecessary...
- public int needed; // How many more bytes are needed on overflow.
- public boolean fragmented; // Did the overflow operation fragment?
-
- public ByteBufferWithInfo(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int index)
- {
- this.orb = (com.sun.corba.se.spi.orb.ORB)orb;
- debug = this.orb.transportDebugFlag;
- this.byteBuffer = byteBuffer;
- if (byteBuffer != null)
- {
- this.buflen = byteBuffer.limit();
- }
- position(index);
- this.needed = 0;
- this.fragmented = false;
- }
-
- public ByteBufferWithInfo(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer)
- {
- this(orb, byteBuffer, 0);
- }
-
- public ByteBufferWithInfo(org.omg.CORBA.ORB orb,
- BufferManagerWrite bufferManager)
- {
- this(orb, bufferManager, true);
- }
-
- // Right now, EncapsOutputStream's do not use pooled byte buffers.
- // EncapsOutputStream's is the only one that does not use pooled
- // byte buffers. Hence, the reason for the boolean 'usePooledByteBuffers'.
- // See EncapsOutputStream for additional information.
-
- public ByteBufferWithInfo(org.omg.CORBA.ORB orb,
- BufferManagerWrite bufferManager,
- boolean usePooledByteBuffers)
- {
- this.orb = (com.sun.corba.se.spi.orb.ORB)orb;
- debug = this.orb.transportDebugFlag;
-
- int bufferSize = bufferManager.getBufferSize();
-
- if (usePooledByteBuffers)
- {
- ByteBufferPool byteBufferPool = this.orb.getByteBufferPool();
- this.byteBuffer = byteBufferPool.getByteBuffer(bufferSize);
-
- if (debug)
- {
- // print address of ByteBuffer gotten from pool
- int bbAddress = System.identityHashCode(byteBuffer);
- StringBuffer sb = new StringBuffer(80);
- sb.append("constructor (ORB, BufferManagerWrite) - got ")
- .append("ByteBuffer id (").append(bbAddress)
- .append(") from ByteBufferPool.");
- String msgStr = sb.toString();
- dprint(msgStr);
- }
- }
- else
- {
- // don't allocate from pool, allocate non-direct ByteBuffer
- this.byteBuffer = ByteBuffer.allocate(bufferSize);
- }
-
- position(0);
- this.buflen = bufferSize;
- this.byteBuffer.limit(this.buflen);
- this.needed = 0;
- this.fragmented = false;
- }
-
- // Shallow copy constructor
- public ByteBufferWithInfo (ByteBufferWithInfo bbwi)
- {
- this.orb = bbwi.orb;
- this.debug = bbwi.debug;
- this.byteBuffer = bbwi.byteBuffer;
- this.buflen = bbwi.buflen;
- this.byteBuffer.limit(this.buflen);
- position(bbwi.position());
- this.needed = bbwi.needed;
- this.fragmented = bbwi.fragmented;
- }
-
- // So IIOPOutputStream seems more intuitive
- public int getSize()
- {
- return position();
- }
-
- // accessor to buflen
- public int getLength()
- {
- return buflen;
- }
-
- // get position in this buffer
- public int position()
- {
- // REVISIT - This should be changed to return the
- // value of byteBuffer.position() rather
- // than this.index. But, byteBuffer.position
- // is manipulated via ByteBuffer writes, reads,
- // gets and puts. These locations need to be
- // investigated and updated before
- // byteBuffer.position() can be returned here.
- // return byteBuffer.position();
- return index;
- }
-
- // set position in this buffer
- public void position(int newPosition)
- {
- // REVISIT - This should be changed to set only the
- // value of byteBuffer.position rather
- // than this.index. This change should be made
- // in conjunction with the change to this.position().
- byteBuffer.position(newPosition);
- index = newPosition;
- }
-
- // mutator to buflen
- public void setLength(int theLength)
- {
- buflen = theLength;
- byteBuffer.limit(buflen);
- }
-
- // Grow byteBuffer to a size larger than position() + needed
- public void growBuffer(com.sun.corba.se.spi.orb.ORB orb)
- {
- // This code used to live directly in CDROutputStream.grow.
-
- // Recall that the byteBuffer size is 'really' the limit or
- // buflen.
-
- int newLength = byteBuffer.limit() * 2;
-
- while (position() + needed >= newLength)
- newLength = newLength * 2;
-
- ByteBufferPool byteBufferPool = orb.getByteBufferPool();
- ByteBuffer newBB = byteBufferPool.getByteBuffer(newLength);
-
- if (debug)
- {
- // print address of ByteBuffer just gotten
- int newbbAddress = System.identityHashCode(newBB);
- StringBuffer sb = new StringBuffer(80);
- sb.append("growBuffer() - got ByteBuffer id (");
- sb.append(newbbAddress).append(") from ByteBufferPool.");
- String msgStr = sb.toString();
- dprint(msgStr);
- }
-
- byteBuffer.position(0);
- newBB.put(byteBuffer);
-
- // return 'old' byteBuffer reference to the ByteBuffer pool
- if (debug)
- {
- // print address of ByteBuffer being released
- int bbAddress = System.identityHashCode(byteBuffer);
- StringBuffer sb = new StringBuffer(80);
- sb.append("growBuffer() - releasing ByteBuffer id (");
- sb.append(bbAddress).append(") to ByteBufferPool.");
- String msgStr2 = sb.toString();
- dprint(msgStr2);
- }
- byteBufferPool.releaseByteBuffer(byteBuffer);
-
- // update the byteBuffer with a larger ByteBuffer
- byteBuffer = newBB;
-
- // limit and buflen must be set to newLength.
- buflen = newLength;
- byteBuffer.limit(buflen);
- }
-
- public String toString()
- {
- StringBuffer str = new StringBuffer("ByteBufferWithInfo:");
-
- str.append(" buflen = " + buflen);
- str.append(" byteBuffer.limit = " + byteBuffer.limit());
- str.append(" index = " + index);
- str.append(" position = " + position());
- str.append(" needed = " + needed);
- str.append(" byteBuffer = " + (byteBuffer == null ? "null" : "not null"));
- str.append(" fragmented = " + fragmented);
-
- return str.toString();
- }
-
- protected void dprint(String msg)
- {
- ORBUtility.dprint("ByteBufferWithInfo", msg);
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputObject.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputObject.java
deleted file mode 100644
index 039484b..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputObject.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (c) 2001, 2004, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.ByteBuffer;
-
-import com.sun.org.omg.SendingContext.CodeBase;
-
-import com.sun.corba.se.pept.encoding.InputObject;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.spi.transport.CorbaConnection;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-
-import com.sun.corba.se.impl.encoding.BufferManagerFactory;
-import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-
-/**
- * @author Harold Carr
- */
-public class CDRInputObject extends CDRInputStream
- implements
- InputObject
-{
- private CorbaConnection corbaConnection;
- private Message header;
- private boolean unmarshaledHeader;
- private ORB orb ;
- private ORBUtilSystemException wrapper ;
- private OMGSystemException omgWrapper ;
-
- public CDRInputObject(ORB orb,
- CorbaConnection corbaConnection,
- ByteBuffer byteBuffer,
- Message header)
- {
- super(orb, byteBuffer, header.getSize(), header.isLittleEndian(),
- header.getGIOPVersion(), header.getEncodingVersion(),
- BufferManagerFactory.newBufferManagerRead(
- header.getGIOPVersion(),
- header.getEncodingVersion(),
- orb));
-
- this.corbaConnection = corbaConnection;
- this.orb = orb ;
- this.wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- this.omgWrapper = OMGSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
-
- if (orb.transportDebugFlag) {
- dprint(".CDRInputObject constructor:");
- }
-
- getBufferManager().init(header);
-
- this.header = header;
-
- unmarshaledHeader = false;
-
- setIndex(Message.GIOPMessageHeaderLength);
-
- setBufferLength(header.getSize());
- }
-
- // REVISIT - think about this some more.
- // This connection normally is accessed from the message mediator.
- // However, giop input needs to get code set info from the connetion
- // *before* the message mediator is available.
- public final CorbaConnection getConnection()
- {
- return corbaConnection;
- }
-
- // XREVISIT - Should the header be kept in the stream or the
- // message mediator? Or should we not have a header and
- // have the information stored in the message mediator
- // directly?
- public Message getMessageHeader()
- {
- return header;
- }
-
- /**
- * Unmarshal the extended GIOP header
- * NOTE: May be fragmented, so should not be called by the ReaderThread.
- * See CorbaResponseWaitingRoomImpl.waitForResponse. It is done
- * there in the client thread.
- */
- public void unmarshalHeader()
- {
- // Unmarshal the extended GIOP message from the buffer.
-
- if (!unmarshaledHeader) {
- try {
- if (((ORB)orb()).transportDebugFlag) {
- dprint(".unmarshalHeader->: " + getMessageHeader());
- }
- getMessageHeader().read(this);
- unmarshaledHeader= true;
- } catch (RuntimeException e) {
- if (((ORB)orb()).transportDebugFlag) {
- dprint(".unmarshalHeader: !!ERROR!!: "
- + getMessageHeader()
- + ": " + e);
- }
- throw e;
- } finally {
- if (((ORB)orb()).transportDebugFlag) {
- dprint(".unmarshalHeader<-: " + getMessageHeader());
- }
- }
- }
- }
-
- public final boolean unmarshaledHeader()
- {
- return unmarshaledHeader;
- }
-
- /**
- * Override the default CDR factory behavior to get the
- * negotiated code sets from the connection.
- *
- * These are only called once per message, the first time needed.
- *
- * In the local case, there is no Connection, so use the
- * local code sets.
- */
- protected CodeSetConversion.BTCConverter createCharBTCConverter() {
- CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();
-
- // If the connection doesn't have its negotiated
- // code sets by now, fall back on the defaults defined
- // in CDRInputStream.
- if (codesets == null)
- return super.createCharBTCConverter();
-
- OSFCodeSetRegistry.Entry charSet
- = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet());
-
- if (charSet == null)
- throw wrapper.unknownCodeset( charSet ) ;
-
- return CodeSetConversion.impl().getBTCConverter(charSet, isLittleEndian());
- }
-
- protected CodeSetConversion.BTCConverter createWCharBTCConverter() {
-
- CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();
-
- // If the connection doesn't have its negotiated
- // code sets by now, we have to throw an exception.
- // See CORBA formal 00-11-03 13.9.2.6.
- if (codesets == null) {
- if (getConnection().isServer())
- throw omgWrapper.noClientWcharCodesetCtx() ;
- else
- throw omgWrapper.noServerWcharCodesetCmp() ;
- }
-
- OSFCodeSetRegistry.Entry wcharSet
- = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet());
-
- if (wcharSet == null)
- throw wrapper.unknownCodeset( wcharSet ) ;
-
- // For GIOP 1.2 and UTF-16, use big endian if there is no byte
- // order marker. (See issue 3405b)
- //
- // For GIOP 1.1 and UTF-16, use the byte order the stream if
- // there isn't (and there shouldn't be) a byte order marker.
- //
- // GIOP 1.0 doesn't have wchars. If we're talking to a legacy ORB,
- // we do what our old ORBs did.
- if (wcharSet == OSFCodeSetRegistry.UTF_16) {
- if (getGIOPVersion().equals(GIOPVersion.V1_2))
- return CodeSetConversion.impl().getBTCConverter(wcharSet, false);
- }
-
- return CodeSetConversion.impl().getBTCConverter(wcharSet, isLittleEndian());
- }
-
- // If we're local and don't have a Connection, use the
- // local code sets, otherwise get them from the connection.
- // If the connection doesn't have negotiated code sets
- // yet, then we use ISO8859-1 for char/string and wchar/wstring
- // are illegal.
- private CodeSetComponentInfo.CodeSetContext getCodeSets() {
- if (getConnection() == null)
- return CodeSetComponentInfo.LOCAL_CODE_SETS;
- else
- return getConnection().getCodeSetContext();
- }
-
- public final CodeBase getCodeBase() {
- if (getConnection() == null)
- return null;
- else
- return getConnection().getCodeBase();
- }
-
- // -----------------------------------------------------------
- // Below this point are commented out methods with features
- // from the old stream. We must find ways to address
- // these issues in the future.
- // -----------------------------------------------------------
-
- // XREVISIT
-// private XIIOPInputStream(XIIOPInputStream stream) {
-// super(stream);
-
-// this.conn = stream.conn;
-// this.msg = stream.msg;
-// this.unmarshaledHeader = stream.unmarshaledHeader;
-// }
-
- public CDRInputStream dup() {
- // XREVISIT
- return null;
- // return new XIIOPInputStream(this);
- }
-
- protected void dprint(String msg)
- {
- ORBUtility.dprint("CDRInputObject", msg);
- }
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream.java
deleted file mode 100644
index 2202014..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream.java
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-import com.sun.org.omg.SendingContext.CodeBase;
-
-import com.sun.corba.se.pept.protocol.MessageMediator;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-/**
- * This is delegates to the real implementation.
- *
- * NOTE:
- *
- * Before using the stream for valuetype unmarshaling, one must call
- * performORBVersionSpecificInit().
- */
-public abstract class CDRInputStream
- extends org.omg.CORBA_2_3.portable.InputStream
- implements com.sun.corba.se.impl.encoding.MarshalInputStream,
- org.omg.CORBA.DataInputStream, org.omg.CORBA.portable.ValueInputStream
-{
- protected CorbaMessageMediator messageMediator;
- private CDRInputStreamBase impl;
-
- // We can move this out somewhere later. For now, it serves its purpose
- // to create a concrete CDR delegate based on the GIOP version.
- private static class InputStreamFactory {
-
- public static CDRInputStreamBase newInputStream(
- ORB orb, GIOPVersion version, byte encodingVersion) {
- switch(version.intValue()) {
- case GIOPVersion.VERSION_1_0:
- return new CDRInputStream_1_0();
- case GIOPVersion.VERSION_1_1:
- return new CDRInputStream_1_1();
- case GIOPVersion.VERSION_1_2:
- if (encodingVersion != Message.CDR_ENC_VERSION) {
- return
- new IDLJavaSerializationInputStream(encodingVersion);
- }
- return new CDRInputStream_1_2();
- // else fall through and report exception.
- default:
- ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- throw wrapper.unsupportedGiopVersion( version ) ;
- }
- }
- }
-
- // Required for the case when a ClientResponseImpl is
- // created with a SystemException due to a dead server/closed
- // connection with no warning. Note that the stream will
- // not be initialized in this case.
- //
- // Probably also required by ServerRequestImpl.
- //
- // REVISIT.
- public CDRInputStream() {
- }
-
- public CDRInputStream(CDRInputStream is) {
- impl = is.impl.dup();
- impl.setParent(this);
- }
-
- public CDRInputStream(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int size,
- boolean littleEndian,
- GIOPVersion version,
- byte encodingVersion,
- BufferManagerRead bufMgr)
- {
- impl = InputStreamFactory.newInputStream((ORB)orb, version,
- encodingVersion);
-
- impl.init(orb, byteBuffer, size, littleEndian, bufMgr);
-
- impl.setParent(this);
- }
-
- // org.omg.CORBA.portable.InputStream
- public final boolean read_boolean() {
- return impl.read_boolean();
- }
-
- public final char read_char() {
- return impl.read_char();
- }
-
- public final char read_wchar() {
- return impl.read_wchar();
- }
-
- public final byte read_octet() {
- return impl.read_octet();
- }
-
- public final short read_short() {
- return impl.read_short();
- }
-
- public final short read_ushort() {
- return impl.read_ushort();
- }
-
- public final int read_long() {
- return impl.read_long();
- }
-
- public final int read_ulong() {
- return impl.read_ulong();
- }
-
- public final long read_longlong() {
- return impl.read_longlong();
- }
-
- public final long read_ulonglong() {
- return impl.read_ulonglong();
- }
-
- public final float read_float() {
- return impl.read_float();
- }
-
- public final double read_double() {
- return impl.read_double();
- }
-
- public final String read_string() {
- return impl.read_string();
- }
-
- public final String read_wstring() {
- return impl.read_wstring();
- }
-
- public final void read_boolean_array(boolean[] value, int offset, int length) {
- impl.read_boolean_array(value, offset, length);
- }
-
- public final void read_char_array(char[] value, int offset, int length) {
- impl.read_char_array(value, offset, length);
- }
-
- public final void read_wchar_array(char[] value, int offset, int length) {
- impl.read_wchar_array(value, offset, length);
- }
-
- public final void read_octet_array(byte[] value, int offset, int length) {
- impl.read_octet_array(value, offset, length);
- }
-
- public final void read_short_array(short[] value, int offset, int length) {
- impl.read_short_array(value, offset, length);
- }
-
- public final void read_ushort_array(short[] value, int offset, int length) {
- impl.read_ushort_array(value, offset, length);
- }
-
- public final void read_long_array(int[] value, int offset, int length) {
- impl.read_long_array(value, offset, length);
- }
-
- public final void read_ulong_array(int[] value, int offset, int length) {
- impl.read_ulong_array(value, offset, length);
- }
-
- public final void read_longlong_array(long[] value, int offset, int length) {
- impl.read_longlong_array(value, offset, length);
- }
-
- public final void read_ulonglong_array(long[] value, int offset, int length) {
- impl.read_ulonglong_array(value, offset, length);
- }
-
- public final void read_float_array(float[] value, int offset, int length) {
- impl.read_float_array(value, offset, length);
- }
-
- public final void read_double_array(double[] value, int offset, int length) {
- impl.read_double_array(value, offset, length);
- }
-
- public final org.omg.CORBA.Object read_Object() {
- return impl.read_Object();
- }
-
- public final TypeCode read_TypeCode() {
- return impl.read_TypeCode();
- }
- public final Any read_any() {
- return impl.read_any();
- }
-
- public final Principal read_Principal() {
- return impl.read_Principal();
- }
-
- public final int read() throws java.io.IOException {
- return impl.read();
- }
-
- public final java.math.BigDecimal read_fixed() {
- return impl.read_fixed();
- }
-
- public final org.omg.CORBA.Context read_Context() {
- return impl.read_Context();
- }
-
- public final org.omg.CORBA.Object read_Object(java.lang.Class clz) {
- return impl.read_Object(clz);
- }
-
- public final org.omg.CORBA.ORB orb() {
- return impl.orb();
- }
-
- // org.omg.CORBA_2_3.portable.InputStream
- public final java.io.Serializable read_value() {
- return impl.read_value();
- }
-
- public final java.io.Serializable read_value(java.lang.Class clz) {
- return impl.read_value(clz);
- }
-
- public final java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) {
- return impl.read_value(factory);
- }
-
- public final java.io.Serializable read_value(java.lang.String rep_id) {
- return impl.read_value(rep_id);
- }
-
- public final java.io.Serializable read_value(java.io.Serializable value) {
- return impl.read_value(value);
- }
-
- public final java.lang.Object read_abstract_interface() {
- return impl.read_abstract_interface();
- }
-
- public final java.lang.Object read_abstract_interface(java.lang.Class clz) {
- return impl.read_abstract_interface(clz);
- }
- // com.sun.corba.se.impl.encoding.MarshalInputStream
-
- public final void consumeEndian() {
- impl.consumeEndian();
- }
-
- public final int getPosition() {
- return impl.getPosition();
- }
-
- // org.omg.CORBA.DataInputStream
-
- public final java.lang.Object read_Abstract () {
- return impl.read_Abstract();
- }
-
- public final java.io.Serializable read_Value () {
- return impl.read_Value();
- }
-
- public final void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) {
- impl.read_any_array(seq, offset, length);
- }
-
- public final void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) {
- impl.read_boolean_array(seq, offset, length);
- }
-
- public final void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) {
- impl.read_char_array(seq, offset, length);
- }
-
- public final void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) {
- impl.read_wchar_array(seq, offset, length);
- }
-
- public final void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) {
- impl.read_octet_array(seq, offset, length);
- }
-
- public final void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) {
- impl.read_short_array(seq, offset, length);
- }
-
- public final void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) {
- impl.read_ushort_array(seq, offset, length);
- }
-
- public final void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) {
- impl.read_long_array(seq, offset, length);
- }
-
- public final void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) {
- impl.read_ulong_array(seq, offset, length);
- }
-
- public final void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) {
- impl.read_ulonglong_array(seq, offset, length);
- }
-
- public final void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) {
- impl.read_longlong_array(seq, offset, length);
- }
-
- public final void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) {
- impl.read_float_array(seq, offset, length);
- }
-
- public final void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) {
- impl.read_double_array(seq, offset, length);
- }
-
- // org.omg.CORBA.portable.ValueBase
- public final String[] _truncatable_ids() {
- return impl._truncatable_ids();
- }
-
- // java.io.InputStream
- public final int read(byte b[]) throws IOException {
- return impl.read(b);
- }
-
- public final int read(byte b[], int off, int len) throws IOException {
- return impl.read(b, off, len);
- }
-
- public final long skip(long n) throws IOException {
- return impl.skip(n);
- }
-
- public final int available() throws IOException {
- return impl.available();
- }
-
- public final void close() throws IOException {
- impl.close();
- }
-
- public final void mark(int readlimit) {
- impl.mark(readlimit);
- }
-
- public final void reset() {
- impl.reset();
- }
-
- public final boolean markSupported() {
- return impl.markSupported();
- }
-
- public abstract CDRInputStream dup();
-
- // Needed by TCUtility
- public final java.math.BigDecimal read_fixed(short digits, short scale) {
- return impl.read_fixed(digits, scale);
- }
-
- public final boolean isLittleEndian() {
- return impl.isLittleEndian();
- }
-
- protected final ByteBuffer getByteBuffer() {
- return impl.getByteBuffer();
- }
-
- protected final void setByteBuffer(ByteBuffer byteBuffer) {
- impl.setByteBuffer(byteBuffer);
- }
-
- protected final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- impl.setByteBufferWithInfo(bbwi);
- }
-
- /**
- * return true if our ByteBuffer is sharing/equal to bb
- */
- protected final boolean isSharing(ByteBuffer bb) {
- return (getByteBuffer() == bb);
- }
-
- public final int getBufferLength() {
- return impl.getBufferLength();
- }
-
- protected final void setBufferLength(int value) {
- impl.setBufferLength(value);
- }
-
- protected final int getIndex() {
- return impl.getIndex();
- }
-
- protected final void setIndex(int value) {
- impl.setIndex(value);
- }
-
- public final void orb(org.omg.CORBA.ORB orb) {
- impl.orb(orb);
- }
-
- public final GIOPVersion getGIOPVersion() {
- return impl.getGIOPVersion();
- }
-
- public final BufferManagerRead getBufferManager() {
- return impl.getBufferManager();
- }
-
- // This should be overridden by any stream (ex: IIOPInputStream)
- // which wants to read values. Thus, TypeCodeInputStream doesn't
- // have to do this.
- public CodeBase getCodeBase() {
- return null;
- }
-
- // Use Latin-1 for GIOP 1.0 or when code set negotiation was not
- // performed.
- protected CodeSetConversion.BTCConverter createCharBTCConverter() {
- return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1,
- impl.isLittleEndian());
- }
-
- // Subclasses must decide what to do here. It's inconvenient to
- // make the class and this method abstract because of dup().
- protected abstract CodeSetConversion.BTCConverter createWCharBTCConverter();
-
- // Prints the current buffer in a human readable form
- void printBuffer() {
- impl.printBuffer();
- }
-
- /**
- * Aligns the current position on the given octet boundary
- * if there are enough bytes available to do so. Otherwise,
- * it just returns. This is used for some (but not all)
- * GIOP 1.2 message headers.
- */
- public void alignOnBoundary(int octetBoundary) {
- impl.alignOnBoundary(octetBoundary);
- }
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- public void setHeaderPadding(boolean headerPadding) {
- impl.setHeaderPadding(headerPadding);
- }
-
- /**
- * This must be called after determining the proper ORB version,
- * and setting it on the stream's ORB instance. It can be called
- * after reading the service contexts, since that is the only place
- * we can get the ORB version info.
- *
- * Trying to unmarshal things requiring repository IDs before calling
- * this will result in NullPtrExceptions.
- */
- public void performORBVersionSpecificInit() {
- // In the case of SystemExceptions, a stream is created
- // with its default constructor (and thus no impl is set).
- if (impl != null)
- impl.performORBVersionSpecificInit();
- }
-
- /**
- * Resets any internal references to code set converters.
- * This is useful for forcing the CDR stream to reacquire
- * converters (probably from its subclasses) when state
- * has changed.
- */
- public void resetCodeSetConverters() {
- impl.resetCodeSetConverters();
- }
-
- public void setMessageMediator(MessageMediator messageMediator)
- {
- this.messageMediator = (CorbaMessageMediator) messageMediator;
- }
-
- public MessageMediator getMessageMediator()
- {
- return messageMediator;
- }
-
- // ValueInputStream -----------------------------
-
- public void start_value() {
- impl.start_value();
- }
-
- public void end_value() {
- impl.end_value();
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStreamBase.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStreamBase.java
deleted file mode 100644
index 1f0eedb..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStreamBase.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.org.omg.SendingContext.CodeBase;
-
-/**
- * Describes CDRInputStream delegates and provides some
- * implementation. Non-default constructors are avoided in
- * the delegation to separate instantiation from initialization,
- * so we use init methods.
- */
-abstract class CDRInputStreamBase extends java.io.InputStream
-{
- protected CDRInputStream parent;
-
- public void setParent(CDRInputStream parent) {
- this.parent = parent;
- }
-
- public abstract void init(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int size,
- boolean littleEndian,
- BufferManagerRead bufferManager);
-
- // org.omg.CORBA.portable.InputStream
- public abstract boolean read_boolean();
- public abstract char read_char();
- public abstract char read_wchar();
- public abstract byte read_octet();
- public abstract short read_short();
- public abstract short read_ushort();
- public abstract int read_long();
- public abstract int read_ulong();
- public abstract long read_longlong();
- public abstract long read_ulonglong();
- public abstract float read_float();
- public abstract double read_double();
- public abstract String read_string();
- public abstract String read_wstring();
- public abstract void read_boolean_array(boolean[] value, int offset, int length);
- public abstract void read_char_array(char[] value, int offset, int length);
- public abstract void read_wchar_array(char[] value, int offset, int length);
- public abstract void read_octet_array(byte[] value, int offset, int length);
- public abstract void read_short_array(short[] value, int offset, int length);
- public abstract void read_ushort_array(short[] value, int offset, int length);
- public abstract void read_long_array(int[] value, int offset, int length);
- public abstract void read_ulong_array(int[] value, int offset, int length);
- public abstract void read_longlong_array(long[] value, int offset, int length);
- public abstract void read_ulonglong_array(long[] value, int offset, int length);
- public abstract void read_float_array(float[] value, int offset, int length);
- public abstract void read_double_array(double[] value, int offset, int length);
- public abstract org.omg.CORBA.Object read_Object();
- public abstract TypeCode read_TypeCode();
- public abstract Any read_any();
- public abstract Principal read_Principal();
- public int read() throws java.io.IOException {
- throw new org.omg.CORBA.NO_IMPLEMENT();
- }
- public abstract java.math.BigDecimal read_fixed();
- public org.omg.CORBA.Context read_Context() {
- throw new org.omg.CORBA.NO_IMPLEMENT();
- }
- public abstract org.omg.CORBA.Object read_Object(java.lang.Class clz);
- public abstract org.omg.CORBA.ORB orb();
-
- // org.omg.CORBA_2_3.portable.InputStream
- public abstract java.io.Serializable read_value();
- public abstract java.io.Serializable read_value(java.lang.Class clz);
- public abstract java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory);
- public abstract java.io.Serializable read_value(java.lang.String rep_id);
- public abstract java.io.Serializable read_value(java.io.Serializable value);
- public abstract java.lang.Object read_abstract_interface();
- public abstract java.lang.Object read_abstract_interface(java.lang.Class clz);
-
- // com.sun.corba.se.impl.encoding.MarshalInputStream
- public abstract void consumeEndian();
- public abstract int getPosition();
-
- // org.omg.CORBA.DataInputStream
- public abstract java.lang.Object read_Abstract ();
- public abstract java.io.Serializable read_Value ();
- public abstract void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length);
- public abstract void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length);
- public abstract void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length);
- public abstract void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length);
- public abstract void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length);
- public abstract void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length);
- public abstract void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length);
- public abstract void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length);
- public abstract void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length);
- public abstract void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length);
- public abstract void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length);
- public abstract void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length);
- public abstract void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length);
-
- // org.omg.CORBA.portable.ValueBase
- public abstract String[] _truncatable_ids();
-
- // java.io.InputStream
- // REVISIT - should we make these throw UnsupportedOperationExceptions?
- // Right now, they'll go up to the java.io versions!
-
-// public abstract int read(byte b[]) throws IOException;
-// public abstract int read(byte b[], int off, int len) throws IOException
-// public abstract long skip(long n) throws IOException;
-// public abstract int available() throws IOException;
-// public abstract void close() throws IOException;
- public abstract void mark(int readlimit);
- public abstract void reset();
-
- // This should return false so that outside users (people using the JDK)
- // don't have any guarantees that mark/reset will work in their
- // custom marshaling code. This is necessary since they could do things
- // like expect obj1a == obj1b in the following code:
- //
- // is.mark(10000);
- // Object obj1a = is.readObject();
- // is.reset();
- // Object obj1b = is.readObject();
- //
- public boolean markSupported() { return false; }
-
- // Needed by AnyImpl and ServiceContexts
- public abstract CDRInputStreamBase dup();
-
- // Needed by TCUtility
- public abstract java.math.BigDecimal read_fixed(short digits, short scale);
-
- // Needed by TypeCodeImpl
- public abstract boolean isLittleEndian();
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- abstract void setHeaderPadding(boolean headerPadding);
-
- // Needed by IIOPInputStream and other subclasses
-
- public abstract ByteBuffer getByteBuffer();
- public abstract void setByteBuffer(ByteBuffer byteBuffer);
-
- public abstract void setByteBufferWithInfo(ByteBufferWithInfo bbwi);
-
- public abstract int getBufferLength();
- public abstract void setBufferLength(int value);
-
- public abstract int getIndex();
- public abstract void setIndex(int value);
-
- public abstract void orb(org.omg.CORBA.ORB orb);
-
- public abstract BufferManagerRead getBufferManager();
- public abstract GIOPVersion getGIOPVersion();
-
- abstract CodeBase getCodeBase();
-
- abstract void printBuffer();
-
- abstract void alignOnBoundary(int octetBoundary);
-
- abstract void performORBVersionSpecificInit();
-
- public abstract void resetCodeSetConverters();
-
- // ValueInputStream -------------------------
- public abstract void start_value();
- public abstract void end_value();
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java
deleted file mode 100644
index a00d66c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java
+++ /dev/null
@@ -1,2398 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.io.ByteArrayInputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
-import java.io.StreamCorruptedException;
-import java.io.OptionalDataException;
-import java.io.IOException;
-
-import java.util.Stack;
-
-import java.net.URL;
-import java.net.MalformedURLException;
-
-import java.nio.ByteBuffer;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import java.math.BigDecimal;
-
-import java.rmi.Remote;
-import java.rmi.StubNotFoundException;
-
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.portable.Delegate;
-import org.omg.CORBA.portable.ValueBase;
-import org.omg.CORBA.portable.IndirectionException;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.CustomMarshal;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.portable.BoxedValueHelper;
-import org.omg.CORBA.portable.ValueFactory;
-import org.omg.CORBA.portable.CustomValue;
-import org.omg.CORBA.portable.StreamableValue;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.portable.IDLEntity;
-
-import javax.rmi.PortableRemoteObject;
-import javax.rmi.CORBA.Tie;
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandler;
-
-import com.sun.corba.se.pept.protocol.MessageMediator;
-import com.sun.corba.se.pept.transport.ByteBufferPool;
-
-import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
-import com.sun.corba.se.spi.protocol.CorbaClientDelegate;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactories;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orb.ORBVersionFactory;
-import com.sun.corba.se.spi.orb.ORBVersion;
-
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-
-import com.sun.corba.se.impl.corba.PrincipalImpl;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.impl.corba.CORBAObjectImpl;
-
-import com.sun.corba.se.impl.encoding.CDROutputObject;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.util.RepositoryId;
-
-import com.sun.corba.se.impl.orbutil.RepositoryIdStrings;
-import com.sun.corba.se.impl.orbutil.RepositoryIdInterface;
-import com.sun.corba.se.impl.orbutil.RepositoryIdUtility;
-import com.sun.corba.se.impl.orbutil.RepositoryIdFactory;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.orbutil.CacheTable;
-
-
-import com.sun.org.omg.CORBA.portable.ValueHelper;
-
-import com.sun.org.omg.SendingContext.CodeBase;
-
-public class CDRInputStream_1_0 extends CDRInputStreamBase
- implements RestorableInputStream
-{
- private static final String kReadMethod = "read";
- private static final int maxBlockLength = 0x7fffff00;
-
- protected BufferManagerRead bufferManagerRead;
- protected ByteBufferWithInfo bbwi;
-
- // Set to the ORB's transportDebugFlag value. This value is
- // used if the ORB is null.
- private boolean debug = false;
-
- protected boolean littleEndian;
- protected ORB orb;
- protected ORBUtilSystemException wrapper ;
- protected OMGSystemException omgWrapper ;
- protected ValueHandler valueHandler = null;
-
- // Value cache
- private CacheTable valueCache = null;
-
- // Repository ID cache
- private CacheTable repositoryIdCache = null;
-
- // codebase cache
- private CacheTable codebaseCache = null;
-
- // Current Class Stack (repository Ids of current class being read)
- // private Stack currentStack = null;
-
- // Length of current chunk, or a large positive number if not in a chunk
- protected int blockLength = maxBlockLength;
-
- // Read end flag (value nesting depth)
- protected int end_flag = 0;
-
- // Beginning with the resolution to interop issue 3526 (4328?),
- // only enclosing chunked valuetypes are taken into account
- // when computing the nesting level. However, we still need
- // the old computation around for interoperability with our
- // older ORBs.
- private int chunkedValueNestingLevel = 0;
-
- // Flag used to determine whether blocksize was zero
- // private int checkForNullBlock = -1;
-
- // In block flag
- // private boolean inBlock = false;
-
- // Indicates whether we are inside a value
- // private boolean outerValueDone = true;
-
- // Int used by read_value(Serializable) that is set by this class
- // before calling ValueFactory.read_value
- protected int valueIndirection = 0;
-
- // Int set by readStringOrIndirection to communicate the actual
- // offset of the string length field back to the caller
- protected int stringIndirection = 0;
-
- // Flag indicating whether we are unmarshalling a chunked value
- protected boolean isChunked = false;
-
- // Repository ID handlers
- private RepositoryIdUtility repIdUtil;
- private RepositoryIdStrings repIdStrs;
-
- // Code set converters (created when first needed)
- private CodeSetConversion.BTCConverter charConverter;
- private CodeSetConversion.BTCConverter wcharConverter;
-
- // RMI-IIOP stream format version 2 case in which we know
- // that there is no more optional data available. If the
- // Serializable's readObject method tries to read anything,
- // we must throw a MARSHAL with the special minor code
- // so that the ValueHandler can give the correct exception
- // to readObject. The state is cleared when the ValueHandler
- // calls end_value after the readObject method exits.
- private boolean specialNoOptionalDataState = false;
-
- // Template method
- public CDRInputStreamBase dup()
- {
- CDRInputStreamBase result = null ;
-
- try {
- result = (CDRInputStreamBase)this.getClass().newInstance();
- } catch (Exception e) {
- throw wrapper.couldNotDuplicateCdrInputStream( e ) ;
- }
- result.init(this.orb,
- this.bbwi.byteBuffer,
- this.bbwi.buflen,
- this.littleEndian,
- this.bufferManagerRead);
-
- ((CDRInputStream_1_0)result).bbwi.position(this.bbwi.position());
- // To ensure we keep bbwi.byteBuffer.limit in sync with bbwi.buflen.
- ((CDRInputStream_1_0)result).bbwi.byteBuffer.limit(this.bbwi.buflen);
-
- return result;
- }
-
- /**
- * NOTE: size passed to init means buffer size
- */
- public void init(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int size,
- boolean littleEndian,
- BufferManagerRead bufferManager)
- {
- this.orb = (ORB)orb;
- this.wrapper = ORBUtilSystemException.get( (ORB)orb,
- CORBALogDomains.RPC_ENCODING ) ;
- this.omgWrapper = OMGSystemException.get( (ORB)orb,
- CORBALogDomains.RPC_ENCODING ) ;
- this.littleEndian = littleEndian;
- this.bufferManagerRead = bufferManager;
- this.bbwi = new ByteBufferWithInfo(orb,byteBuffer,0);
- this.bbwi.buflen = size;
- this.bbwi.byteBuffer.limit(bbwi.buflen);
- this.markAndResetHandler = bufferManagerRead.getMarkAndResetHandler();
-
- debug = ((ORB)orb).transportDebugFlag;
- }
-
- // See description in CDRInputStream
- void performORBVersionSpecificInit() {
- createRepositoryIdHandlers();
- }
-
- private final void createRepositoryIdHandlers()
- {
- repIdUtil = RepositoryIdFactory.getRepIdUtility();
- repIdStrs = RepositoryIdFactory.getRepIdStringsFactory();
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_0;
- }
-
- // Called by Request and Reply message. Valid for GIOP versions >= 1.2 only.
- // Illegal for GIOP versions < 1.2.
- void setHeaderPadding(boolean headerPadding) {
- throw wrapper.giopVersionError();
- }
-
- protected final int computeAlignment(int index, int align) {
- if (align > 1) {
- int incr = index & (align - 1);
- if (incr != 0)
- return align - incr;
- }
-
- return 0;
- }
-
- public int getSize()
- {
- return bbwi.position();
- }
-
- protected void checkBlockLength(int align, int dataSize) {
- // Since chunks can end at arbitrary points (though not within
- // primitive CDR types, arrays of primitives, strings, wstrings,
- // or indirections),
- // we must check here for termination of the current chunk.
- if (!isChunked)
- return;
-
- // RMI-IIOP stream format version 2 case in which we know
- // that there is no more optional data available. If the
- // Serializable's readObject method tries to read anything,
- // we must throw a MARSHAL exception with the special minor code
- // so that the ValueHandler can give the correct exception
- // to readObject. The state is cleared when the ValueHandler
- // calls end_value after the readObject method exits.
- if (specialNoOptionalDataState) {
- throw omgWrapper.rmiiiopOptionalDataIncompatible1() ;
- }
-
- boolean checkForEndTag = false;
-
- // Are we at the end of the current chunk? If so,
- // try to interpret the next long as a chunk length.
- // (It has to be either a chunk length, end tag,
- // or valuetag.)
- //
- // If it isn't a chunk length, blockLength will
- // remain set to maxBlockLength.
- if (blockLength == get_offset()) {
-
- blockLength = maxBlockLength;
- start_block();
-
- // What's next is either a valuetag or
- // an end tag. If it's a valuetag, we're
- // probably being called as part of the process
- // to read the valuetag. If it's an end tag,
- // then there isn't enough data left in
- // this valuetype to read!
- if (blockLength == maxBlockLength)
- checkForEndTag = true;
-
- } else
- if (blockLength < get_offset()) {
- // Are we already past the end of the current chunk?
- // This is always an error.
- throw wrapper.chunkOverflow() ;
- }
-
- // If what's next on the wire isn't a chunk length or
- // what we want to read (which can't be split across chunks)
- // won't fit in the current chunk, throw this exception.
- // This probably means that we're in an RMI-IIOP
- // Serializable's readObject method or a custom marshaled
- // IDL type is reading too much/in an incorrect order
- int requiredNumBytes =
- computeAlignment(bbwi.position(), align) + dataSize;
-
- if (blockLength != maxBlockLength &&
- blockLength < get_offset() + requiredNumBytes) {
- throw omgWrapper.rmiiiopOptionalDataIncompatible2() ;
- }
-
- // REVISIT - We should look at using the built in advancement
- // of using ByteBuffer.get() rather than explicitly
- // advancing the ByteBuffer's position.
- // This is true for anywhere we are incrementing
- // the ByteBuffer's position.
- if (checkForEndTag) {
- int nextLong = read_long();
- bbwi.position(bbwi.position() - 4);
-
- // It was an end tag, so there wasn't enough data
- // left in the valuetype's encoding on the wire
- // to read what we wanted
- if (nextLong < 0)
- throw omgWrapper.rmiiiopOptionalDataIncompatible3() ;
- }
- }
-
- protected void alignAndCheck(int align, int n) {
-
- checkBlockLength(align, n);
-
- // WARNING: Must compute real alignment after calling
- // checkBlockLength since it may move the position
- int alignResult = computeAlignment(bbwi.position(), align);
- bbwi.position(bbwi.position() + alignResult);
-
- if (bbwi.position() + n > bbwi.buflen)
- grow(align, n);
- }
-
- //
- // This can be overridden....
- //
- protected void grow(int align, int n) {
-
- bbwi.needed = n;
-
- bbwi = bufferManagerRead.underflow(bbwi);
-
- }
-
- //
- // Marshal primitives.
- //
-
- public final void consumeEndian() {
- littleEndian = read_boolean();
- }
-
- // No such type in java
- public final double read_longdouble() {
- throw wrapper.longDoubleNotImplemented( CompletionStatus.COMPLETED_MAYBE);
- }
-
- public final boolean read_boolean() {
- return (read_octet() != 0);
- }
-
- public final char read_char() {
- alignAndCheck(1, 1);
-
- return getConvertedChars(1, getCharConverter())[0];
- }
-
- public char read_wchar() {
-
- // Don't allow transmission of wchar/wstring data with
- // foreign ORBs since it's against the spec.
- if (ORBUtility.isForeignORB((ORB)orb)) {
- throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE);
- }
-
- // If we're talking to one of our legacy ORBs, do what
- // they did:
- int b1, b2;
-
- alignAndCheck(2, 2);
-
- if (littleEndian) {
- b2 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
- bbwi.position(bbwi.position() + 1);
- b1 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
- bbwi.position(bbwi.position() + 1);
- } else {
- b1 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
- bbwi.position(bbwi.position() + 1);
- b2 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
- bbwi.position(bbwi.position() + 1);
- }
-
- return (char)((b1 << 8) + (b2 << 0));
- }
-
- public final byte read_octet() {
-
- alignAndCheck(1, 1);
-
- byte b = bbwi.byteBuffer.get(bbwi.position());
- bbwi.position(bbwi.position() + 1);
-
- return b;
- }
-
- public final short read_short() {
- int b1, b2;
-
- alignAndCheck(2, 2);
-
- if (littleEndian) {
- b2 = (bbwi.byteBuffer.get(bbwi.position()) << 0) & 0x000000FF;
- bbwi.position(bbwi.position() + 1);
- b1 = (bbwi.byteBuffer.get(bbwi.position()) << 8) & 0x0000FF00;
- bbwi.position(bbwi.position() + 1);
- } else {
- b1 = (bbwi.byteBuffer.get(bbwi.position()) << 8) & 0x0000FF00;
- bbwi.position(bbwi.position() + 1);
- b2 = (bbwi.byteBuffer.get(bbwi.position()) << 0) & 0x000000FF;
- bbwi.position(bbwi.position() + 1);
- }
-
- return (short)(b1 | b2);
- }
-
- public final short read_ushort() {
- return read_short();
- }
-
- public final int read_long() {
- int b1, b2, b3, b4;
-
- alignAndCheck(4, 4);
-
- int bufPos = bbwi.position();
- if (littleEndian) {
- b4 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- b3 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- b2 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- b1 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- } else {
- b1 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- b2 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- b3 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- b4 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- }
- bbwi.position(bufPos);
-
- return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
- }
-
- public final int read_ulong() {
- return read_long();
- }
-
- public final long read_longlong() {
- long i1, i2;
-
- alignAndCheck(8, 8);
-
- if (littleEndian) {
- i2 = read_long() & 0xFFFFFFFFL;
- i1 = (long)read_long() << 32;
- } else {
- i1 = (long)read_long() << 32;
- i2 = read_long() & 0xFFFFFFFFL;
- }
-
- return (i1 | i2);
- }
-
- public final long read_ulonglong() {
- return read_longlong();
- }
-
- public final float read_float() {
- return Float.intBitsToFloat(read_long());
- }
-
- public final double read_double() {
- return Double.longBitsToDouble(read_longlong());
- }
-
- protected final void checkForNegativeLength(int length) {
- if (length < 0)
- throw wrapper.negativeStringLength( CompletionStatus.COMPLETED_MAYBE,
- new Integer(length) ) ;
- }
-
- protected final String readStringOrIndirection(boolean allowIndirection) {
-
- int len = read_long();
-
- //
- // Check for indirection
- //
- if (allowIndirection) {
- if (len == 0xffffffff)
- return null;
- else
- stringIndirection = get_offset() - 4;
- }
-
- checkForNegativeLength(len);
-
- return internalReadString(len);
- }
-
- private final String internalReadString(int len) {
- // Workaround for ORBs which send string lengths of
- // zero to mean empty string.
- //
- // IMPORTANT: Do not replace 'new String("")' with "", it may result
- // in a Serialization bug (See serialization.zerolengthstring) and
- // bug id: 4728756 for details
- if (len == 0)
- return new String("");
-
- char[] result = getConvertedChars(len - 1, getCharConverter());
-
- // Skip over the 1 byte null
- read_octet();
-
- return new String(result, 0, getCharConverter().getNumChars());
- }
-
- public final String read_string() {
- return readStringOrIndirection(false);
- }
-
- public String read_wstring() {
- // Don't allow transmission of wchar/wstring data with
- // foreign ORBs since it's against the spec.
- if (ORBUtility.isForeignORB((ORB)orb)) {
- throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE);
- }
-
- int len = read_long();
-
- //
- // Workaround for ORBs which send string lengths of
- // zero to mean empty string.
- //
- //
- // IMPORTANT: Do not replace 'new String("")' with "", it may result
- // in a Serialization bug (See serialization.zerolengthstring) and
- // bug id: 4728756 for details
- if (len == 0)
- return new String("");
-
- checkForNegativeLength(len);
-
- len--;
- char[] c = new char[len];
-
- for (int i = 0; i < len; i++)
- c[i] = read_wchar();
-
- // skip the two null terminator bytes
- read_wchar();
- // bbwi.position(bbwi.position() + 2);
-
- return new String(c);
- }
-
- public final void read_octet_array(byte[] b, int offset, int length) {
- if ( b == null )
- throw wrapper.nullParam() ;
-
- // Must call alignAndCheck at least once to ensure
- // we aren't at the end of a chunk. Of course, we
- // should only call it if we actually need to read
- // something, otherwise we might end up with an
- // exception at the end of the stream.
- if (length == 0)
- return;
-
- alignAndCheck(1, 1);
-
- int n = offset;
- while (n < length+offset) {
- int avail;
- int bytes;
- int wanted;
-
- avail = bbwi.buflen - bbwi.position();
- if (avail <= 0) {
- grow(1, 1);
- avail = bbwi.buflen - bbwi.position();
- }
- wanted = (length + offset) - n;
- bytes = (wanted < avail) ? wanted : avail;
- // Microbenchmarks are showing a loop of ByteBuffer.get(int) being
- // faster than ByteBuffer.get(byte[], int, int).
- for (int i = 0; i < bytes; i++) {
- b[n+i] = bbwi.byteBuffer.get(bbwi.position() + i);
- }
-
- bbwi.position(bbwi.position() + bytes);
-
- n += bytes;
- }
- }
-
- public Principal read_Principal() {
- int len = read_long();
- byte[] pvalue = new byte[len];
- read_octet_array(pvalue,0,len);
-
- Principal p = new PrincipalImpl();
- p.name(pvalue);
- return p;
- }
-
- public TypeCode read_TypeCode() {
- TypeCodeImpl tc = new TypeCodeImpl(orb);
- tc.read_value(parent);
- return tc;
- }
-
- public Any read_any() {
- Any any = orb.create_any();
- TypeCodeImpl tc = new TypeCodeImpl(orb);
-
- // read off the typecode
-
- // REVISIT We could avoid this try-catch if we could peek the typecode
- // kind off this stream and see if it is a tk_value. Looking at the
- // code we know that for tk_value the Any.read_value() below
- // ignores the tc argument anyway (except for the kind field).
- // But still we would need to make sure that the whole typecode,
- // including encapsulations, is read off.
- try {
- tc.read_value(parent);
- } catch (MARSHAL ex) {
- if (tc.kind().value() != TCKind._tk_value)
- throw ex;
- // We can be sure that the whole typecode encapsulation has been
- // read off.
- dprintThrowable(ex);
- }
- // read off the value of the any
- any.read_value(parent, tc);
-
- return any;
- }
-
- public org.omg.CORBA.Object read_Object() {
- return read_Object(null);
- }
-
- // ------------ RMI related methods --------------------------
-
- // IDL to Java ptc-00-01-08 1.21.4.1
- //
- // The clz argument to read_Object can be either a stub
- // Class or the "Class object for the RMI/IDL interface type
- // that is statically expected."
- // This functions as follows:
- // 1. If clz==null, just use the repository ID from the stub
- // 2. If clz is a stub class, just use it as a static factory.
- // clz is a stub class iff StubAdapter.isStubClass( clz ).
- // In addition, clz is a IDL stub class iff
- // IDLEntity.class.isAssignableFrom( clz ).
- // 3. If clz is an interface, use it to create the appropriate
- // stub factory.
- public org.omg.CORBA.Object read_Object(Class clz)
- {
- // In any case, we must first read the IOR.
- IOR ior = IORFactories.makeIOR(parent) ;
- if (ior.isNil())
- return null ;
-
- PresentationManager.StubFactoryFactory sff = ORB.getStubFactoryFactory() ;
- String codeBase = ior.getProfile().getCodebase() ;
- PresentationManager.StubFactory stubFactory = null ;
-
- if (clz == null) {
- RepositoryId rid = RepositoryId.cache.getId( ior.getTypeId() ) ;
- String className = rid.getClassName() ;
- boolean isIDLInterface = rid.isIDLType() ;
-
- if (className == null || className.equals( "" ))
- stubFactory = null ;
- else
- try {
- stubFactory = sff.createStubFactory( className,
- isIDLInterface, codeBase, (Class)null,
- (ClassLoader)null );
- } catch (Exception exc) {
- // Could not create stubFactory, so use null.
- // XXX stubFactory handling is still too complex:
- // Can we resolve the stubFactory question once in
- // a single place?
- stubFactory = null ;
- }
- } else if (StubAdapter.isStubClass( clz )) {
- stubFactory = PresentationDefaults.makeStaticStubFactory(
- clz ) ;
- } else {
- // clz is an interface class
- boolean isIDL = IDLEntity.class.isAssignableFrom( clz ) ;
-
- stubFactory = sff.createStubFactory( clz.getName(),
- isIDL, codeBase, clz, clz.getClassLoader() ) ;
- }
-
- return internalIORToObject( ior, stubFactory, orb ) ;
- }
-
- /*
- * This is used as a general utility (e.g., the PortableInterceptor
- * implementation uses it. If stubFactory is null, the ior's
- * IIOPProfile must support getServant.
- */
- public static org.omg.CORBA.Object internalIORToObject(
- IOR ior, PresentationManager.StubFactory stubFactory, ORB orb)
- {
- ORBUtilSystemException wrapper = ORBUtilSystemException.get(
- (ORB)orb, CORBALogDomains.RPC_ENCODING ) ;
-
- java.lang.Object servant = ior.getProfile().getServant() ;
- if (servant != null ) {
- if (servant instanceof Tie) {
- String codebase = ior.getProfile().getCodebase();
- org.omg.CORBA.Object objref = (org.omg.CORBA.Object)
- Utility.loadStub( (Tie)servant, stubFactory, codebase,
- false);
-
- // If we managed to load a stub, return it, otherwise we
- // must fail...
- if (objref != null) {
- return objref;
- } else {
- throw wrapper.readObjectException() ;
- }
- } else if (servant instanceof org.omg.CORBA.Object) {
- if (!(servant instanceof
- org.omg.CORBA.portable.InvokeHandler)) {
- return (org.omg.CORBA.Object) servant;
- }
- } else
- throw wrapper.badServantReadObject() ;
- }
-
- CorbaClientDelegate del = ORBUtility.makeClientDelegate( ior ) ;
- org.omg.CORBA.Object objref = null ;
- try {
- objref = stubFactory.makeStub() ;
- } catch (Throwable e) {
- wrapper.stubCreateError( e ) ;
-
- if (e instanceof ThreadDeath) {
- throw (ThreadDeath) e;
- }
-
- // Return the "default" stub...
- objref = new CORBAObjectImpl() ;
- }
-
- StubAdapter.setDelegate( objref, del ) ;
- return objref;
- }
-
- public java.lang.Object read_abstract_interface()
- {
- return read_abstract_interface(null);
- }
-
- public java.lang.Object read_abstract_interface(java.lang.Class clz)
- {
- boolean object = read_boolean();
-
- if (object) {
- return read_Object(clz);
- } else {
- return read_value();
- }
- }
-
- public Serializable read_value()
- {
- return read_value((Class)null);
- }
-
- private Serializable handleIndirection() {
- int indirection = read_long() + get_offset() - 4;
- if (valueCache != null && valueCache.containsVal(indirection)) {
-
- java.io.Serializable cachedValue
- = (java.io.Serializable)valueCache.getKey(indirection);
- return cachedValue;
- } else {
- // In RMI-IIOP the ValueHandler will recognize this
- // exception and use the provided indirection value
- // to lookup a possible indirection to an object
- // currently on the deserialization stack.
- throw new IndirectionException(indirection);
- }
- }
-
- private String readRepositoryIds(int valueTag,
- Class expectedType,
- String expectedTypeRepId) {
- return readRepositoryIds(valueTag, expectedType,
- expectedTypeRepId, null);
- }
-
- /**
- * Examines the valuetag to see how many (if any) repository IDs
- * are present on the wire. If no repository ID information
- * is on the wire but the expectedType or expectedTypeRepId
- * is known, it will return one of those (favoring the
- * expectedType's repId). Failing that, it uses the supplied
- * BoxedValueHelper to obtain the repository ID, as a last resort.
- */
- private String readRepositoryIds(int valueTag,
- Class expectedType,
- String expectedTypeRepId,
- BoxedValueHelper factory) {
- switch(repIdUtil.getTypeInfo(valueTag)) {
- case RepositoryIdUtility.NO_TYPE_INFO :
- // Throw an exception if we have no repository ID info and
- // no expectedType to work with. Otherwise, how would we
- // know what to unmarshal?
- if (expectedType == null) {
- if (expectedTypeRepId != null) {
- return expectedTypeRepId;
- } else if (factory != null) {
- return factory.get_id();
- } else {
- throw wrapper.expectedTypeNullAndNoRepId(
- CompletionStatus.COMPLETED_MAYBE);
- }
- }
- return repIdStrs.createForAnyType(expectedType);
- case RepositoryIdUtility.SINGLE_REP_TYPE_INFO :
- return read_repositoryId();
- case RepositoryIdUtility.PARTIAL_LIST_TYPE_INFO :
- return read_repositoryIds();
- default:
- throw wrapper.badValueTag( CompletionStatus.COMPLETED_MAYBE,
- Integer.toHexString(valueTag) ) ;
- }
- }
-
- public Serializable read_value(Class expectedType) {
-
- // Read value tag
- int vType = readValueTag();
-
- // Is value null?
- if (vType == 0)
- return null;
-
- // Is this an indirection to a previously
- // read valuetype?
- if (vType == 0xffffffff)
- return handleIndirection();
-
- // Save where this valuetype started so we
- // can put it in the indirection valueCache
- // later
- int indirection = get_offset() - 4;
-
- // Need to save this special marker variable
- // to restore its value during recursion
- boolean saveIsChunked = isChunked;
-
- isChunked = repIdUtil.isChunkedEncoding(vType);
-
- java.lang.Object value = null;
-
- String codebase_URL = null;
- if (repIdUtil.isCodeBasePresent(vType)) {
- codebase_URL = read_codebase_URL();
- }
-
- // Read repository id(s)
- String repositoryIDString
- = readRepositoryIds(vType, expectedType, null);
-
- // If isChunked was determined to be true based
- // on the valuetag, this will read a chunk length
- start_block();
-
- // Remember that end_flag keeps track of all nested
- // valuetypes and is used for older ORBs
- end_flag--;
- if (isChunked)
- chunkedValueNestingLevel--;
-
- if (repositoryIDString.equals(repIdStrs.getWStringValueRepId())) {
- value = read_wstring();
- } else
- if (repositoryIDString.equals(repIdStrs.getClassDescValueRepId())) {
- // read in the class whether with the old ClassDesc or the
- // new one
- value = readClass();
- } else {
-
- Class valueClass = expectedType;
-
- // By this point, either the expectedType or repositoryIDString
- // is guaranteed to be non-null.
- if (expectedType == null ||
- !repositoryIDString.equals(repIdStrs.createForAnyType(expectedType))) {
-
- valueClass = getClassFromString(repositoryIDString,
- codebase_URL,
- expectedType);
- }
-
- if (valueClass == null) {
- // No point attempting to use value handler below, since the
- // class information is not available.
- throw wrapper.couldNotFindClass(
- CompletionStatus.COMPLETED_MAYBE,
- new ClassNotFoundException());
- }
-
- if (valueClass != null &&
- org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(valueClass)) {
-
- value = readIDLValue(indirection,
- repositoryIDString,
- valueClass,
- codebase_URL);
-
- } else {
-
- // Must be some form of RMI-IIOP valuetype
-
- try {
- if (valueHandler == null)
- valueHandler = ORBUtility.createValueHandler();
-
- value = valueHandler.readValue(parent,
- indirection,
- valueClass,
- repositoryIDString,
- getCodeBase());
-
- } catch(SystemException sysEx) {
- // Just rethrow any CORBA system exceptions
- // that come out of the ValueHandler
- throw sysEx;
- } catch(Exception ex) {
- throw wrapper.valuehandlerReadException(
- CompletionStatus.COMPLETED_MAYBE, ex ) ;
- } catch(Error e) {
- throw wrapper.valuehandlerReadError(
- CompletionStatus.COMPLETED_MAYBE, e ) ;
- }
- }
- }
-
- // Skip any remaining chunks until we get to
- // an end tag or a valuetag. If we see a valuetag,
- // that means there was another valuetype in the sender's
- // version of this class that we need to skip over.
- handleEndOfValue();
-
- // Read and process the end tag if we're chunking.
- // Assumes that we're at the position of the end tag
- // (handleEndOfValue should assure this)
- readEndTag();
-
- // Cache the valuetype that we read
- if (valueCache == null)
- valueCache = new CacheTable(orb,false);
- valueCache.put(value, indirection);
-
- // Allow for possible continuation chunk.
- // If we're a nested valuetype inside of a chunked
- // valuetype, and that enclosing valuetype has
- // more data to write, it will need to have this
- // new chunk begin after we wrote our end tag.
- isChunked = saveIsChunked;
- start_block();
-
- return (java.io.Serializable)value;
- }
-
- public Serializable read_value(BoxedValueHelper factory) {
-
- // Read value tag
- int vType = readValueTag();
-
- if (vType == 0)
- return null; // value is null
- else if (vType == 0xffffffff) { // Indirection tag
- int indirection = read_long() + get_offset() - 4;
- if (valueCache != null && valueCache.containsVal(indirection))
- {
- java.io.Serializable cachedValue =
- (java.io.Serializable)valueCache.getKey(indirection);
- return cachedValue;
- }
- else {
- throw new IndirectionException(indirection);
- }
- }
- else {
- int indirection = get_offset() - 4;
-
- // end_block();
-
- boolean saveIsChunked = isChunked;
- isChunked = repIdUtil.isChunkedEncoding(vType);
-
- java.lang.Object value = null;
-
- String codebase_URL = null;
- if (repIdUtil.isCodeBasePresent(vType)){
- codebase_URL = read_codebase_URL();
- }
-
- // Read repository id
- String repositoryIDString
- = readRepositoryIds(vType, null, null, factory);
-
- // Compare rep. ids to see if we should use passed helper
- if (!repositoryIDString.equals(factory.get_id()))
- factory = Utility.getHelper(null, codebase_URL, repositoryIDString);
-
- start_block();
- end_flag--;
- if (isChunked)
- chunkedValueNestingLevel--;
-
- if (factory instanceof ValueHelper) {
- value = readIDLValueWithHelper((ValueHelper)factory, indirection);
- } else {
- valueIndirection = indirection; // for callback
- value = factory.read_value(parent);
- }
-
- handleEndOfValue();
- readEndTag();
-
- // Put into valueCache
- if (valueCache == null)
- valueCache = new CacheTable(orb,false);
- valueCache.put(value, indirection);
-
- // allow for possible continuation chunk
- isChunked = saveIsChunked;
- start_block();
-
- return (java.io.Serializable)value;
- }
- }
-
- private boolean isCustomType(ValueHelper helper) {
- try{
- TypeCode tc = helper.get_type();
- int kind = tc.kind().value();
- if (kind == TCKind._tk_value) {
- return (tc.type_modifier() == org.omg.CORBA.VM_CUSTOM.value);
- }
- } catch(BadKind ex) {
- throw wrapper.badKind(ex) ;
- }
-
- return false;
- }
-
- // This method is actually called indirectly by
- // read_value(String repositoryId).
- // Therefore, it is not a truly independent read call that handles
- // header information itself.
- public java.io.Serializable read_value(java.io.Serializable value) {
-
- // Put into valueCache using valueIndirection
- if (valueCache == null)
- valueCache = new CacheTable(orb,false);
- valueCache.put(value, valueIndirection);
-
- if (value instanceof StreamableValue)
- ((StreamableValue)value)._read(parent);
- else if (value instanceof CustomValue)
- ((CustomValue)value).unmarshal(parent);
-
- return value;
- }
-
- public java.io.Serializable read_value(java.lang.String repositoryId) {
-
- // if (inBlock)
- // end_block();
-
- // Read value tag
- int vType = readValueTag();
-
- if (vType == 0)
- return null; // value is null
- else if (vType == 0xffffffff) { // Indirection tag
- int indirection = read_long() + get_offset() - 4;
- if (valueCache != null && valueCache.containsVal(indirection))
- {
- java.io.Serializable cachedValue =
- (java.io.Serializable)valueCache.getKey(indirection);
- return cachedValue;
- }
- else {
- throw new IndirectionException(indirection);
- }
- }
- else {
- int indirection = get_offset() - 4;
-
- // end_block();
-
- boolean saveIsChunked = isChunked;
- isChunked = repIdUtil.isChunkedEncoding(vType);
-
- java.lang.Object value = null;
-
- String codebase_URL = null;
- if (repIdUtil.isCodeBasePresent(vType)){
- codebase_URL = read_codebase_URL();
- }
-
- // Read repository id
- String repositoryIDString
- = readRepositoryIds(vType, null, repositoryId);
-
- ValueFactory factory =
- Utility.getFactory(null, codebase_URL, orb, repositoryIDString);
-
- start_block();
- end_flag--;
- if (isChunked)
- chunkedValueNestingLevel--;
-
- valueIndirection = indirection; // for callback
- value = factory.read_value(parent);
-
- handleEndOfValue();
- readEndTag();
-
- // Put into valueCache
- if (valueCache == null)
- valueCache = new CacheTable(orb,false);
- valueCache.put(value, indirection);
-
- // allow for possible continuation chunk
- isChunked = saveIsChunked;
- start_block();
-
- return (java.io.Serializable)value;
- }
- }
-
- private Class readClass() {
-
- String codebases = null, classRepId = null;
-
- if (orb == null ||
- ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
- ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {
-
- codebases = (String)read_value(java.lang.String.class);
- classRepId = (String)read_value(java.lang.String.class);
- } else {
- // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
- // and codebase strings in the wrong order.
- classRepId = (String)read_value(java.lang.String.class);
- codebases = (String)read_value(java.lang.String.class);
- }
-
- if (debug) {
- dprint("readClass codebases: "
- + codebases
- + " rep Id: "
- + classRepId);
- }
-
- Class cl = null;
-
- RepositoryIdInterface repositoryID
- = repIdStrs.getFromString(classRepId);
-
- try {
- cl = repositoryID.getClassFromType(codebases);
- } catch(ClassNotFoundException cnfe) {
- throw wrapper.cnfeReadClass( CompletionStatus.COMPLETED_MAYBE,
- cnfe, repositoryID.getClassName() ) ;
- } catch(MalformedURLException me) {
- throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
- me, repositoryID.getClassName(), codebases ) ;
- }
-
- return cl;
- }
-
- private java.lang.Object readIDLValueWithHelper(ValueHelper helper, int indirection)
- {
- // look for two-argument static read method
- Method readMethod;
- try {
- Class argTypes[] = {org.omg.CORBA.portable.InputStream.class, helper.get_class()};
- readMethod = helper.getClass().getDeclaredMethod(kReadMethod, argTypes);
- }
- catch(NoSuchMethodException nsme) { // must be boxed value helper
- java.lang.Object result = helper.read_value(parent);
- return result;
- }
-
- // found two-argument read method, so must be non-boxed value...
- // ...create a blank instance
- java.lang.Object val = null;
- try {
- val = helper.get_class().newInstance();
- } catch(java.lang.InstantiationException ie) {
- throw wrapper.couldNotInstantiateHelper( ie,
- helper.get_class() ) ;
- } catch(IllegalAccessException iae){
- // Value's constructor is protected or private
- //
- // So, use the helper to read the value.
- //
- // NOTE : This means that in this particular case a recursive ref.
- // would fail.
- return helper.read_value(parent);
- }
-
- // add blank instance to cache table
- if (valueCache == null)
- valueCache = new CacheTable(orb,false);
- valueCache.put(val, indirection);
-
- // if custom type, call unmarshal method
- if (val instanceof CustomMarshal && isCustomType(helper)) {
- ((CustomMarshal)val).unmarshal(parent);
- return val;
- }
-
- // call two-argument read method using reflection
- try {
- java.lang.Object args[] = {parent, val};
- readMethod.invoke(helper, args);
- return val;
- } catch(IllegalAccessException iae2) {
- throw wrapper.couldNotInvokeHelperReadMethod( iae2, helper.get_class() ) ;
- } catch(InvocationTargetException ite){
- throw wrapper.couldNotInvokeHelperReadMethod( ite, helper.get_class() ) ;
- }
- }
-
- private java.lang.Object readBoxedIDLEntity(Class clazz, String codebase)
- {
- Class cls = null ;
-
- try {
- ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader());
-
- cls = Utility.loadClassForClass(clazz.getName()+"Helper", codebase,
- clazzLoader, clazz, clazzLoader);
- final Class helperClass = cls ;
-
- final Class argTypes[] = {org.omg.CORBA.portable.InputStream.class};
-
- // getDeclaredMethod requires RuntimePermission accessDeclaredMembers
- // if a different class loader is used (even though the javadoc says otherwise)
- Method readMethod = null;
- try {
- readMethod = (Method)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public java.lang.Object run() throws NoSuchMethodException {
- return helperClass.getDeclaredMethod(kReadMethod, argTypes);
- }
- }
- );
- } catch (PrivilegedActionException pae) {
- // this gets caught below
- throw (NoSuchMethodException)pae.getException();
- }
-
- java.lang.Object args[] = {parent};
- return readMethod.invoke(null, args);
-
- } catch (ClassNotFoundException cnfe) {
- throw wrapper.couldNotInvokeHelperReadMethod( cnfe, cls ) ;
- } catch(NoSuchMethodException nsme) {
- throw wrapper.couldNotInvokeHelperReadMethod( nsme, cls ) ;
- } catch(IllegalAccessException iae) {
- throw wrapper.couldNotInvokeHelperReadMethod( iae, cls ) ;
- } catch(InvocationTargetException ite) {
- throw wrapper.couldNotInvokeHelperReadMethod( ite, cls ) ;
- }
- }
-
- private java.lang.Object readIDLValue(int indirection, String repId,
- Class clazz, String codebase)
- {
- ValueFactory factory ;
-
- // Always try to find a ValueFactory first, as required by the spec.
- // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
- // but basically we must always be able to override the DefaultFactory
- // or Helper mappings that are also used. This appears to be the case
- // even in the boxed value cases. The original code only did the lookup
- // in the case of class implementing either StreamableValue or CustomValue,
- // but abstract valuetypes only implement ValueBase, and really require
- // the use of the repId to find a factory (including the DefaultFactory).
- try {
- // use new-style OBV support (factory object)
- factory = Utility.getFactory(clazz, codebase, orb, repId);
- } catch (MARSHAL marshal) {
- // XXX log marshal at one of the INFO levels
-
- // Could not get a factory, so try alternatives
- if (!StreamableValue.class.isAssignableFrom(clazz) &&
- !CustomValue.class.isAssignableFrom(clazz) &&
- ValueBase.class.isAssignableFrom(clazz)) {
- // use old-style OBV support (helper object)
- BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
- if (helper instanceof ValueHelper)
- return readIDLValueWithHelper((ValueHelper)helper, indirection);
- else
- return helper.read_value(parent);
- } else {
- // must be a boxed IDLEntity, so make a reflective call to the
- // helper's static read method...
- return readBoxedIDLEntity(clazz, codebase);
- }
- }
-
- // If there was no error in getting the factory, use it.
- valueIndirection = indirection; // for callback
- return factory.read_value(parent);
- }
-
- /**
- * End tags are only written for chunked valuetypes.
- *
- * Before Merlin, our ORBs wrote end tags which took into account
- * all enclosing valuetypes. This was changed by an interop resolution
- * (see details around chunkedValueNestingLevel) to only include
- * enclosing chunked types.
- *
- * ORB versioning and end tag compaction are handled here.
- */
- private void readEndTag() {
- if (isChunked) {
-
- // Read the end tag
- int anEndTag = read_long();
-
- // End tags should always be negative, and the outermost
- // enclosing chunked valuetype should have a -1 end tag.
- //
- // handleEndOfValue should have assured that we were
- // at the end tag position!
- if (anEndTag >= 0) {
- throw wrapper.positiveEndTag( CompletionStatus.COMPLETED_MAYBE,
- new Integer(anEndTag), new Integer( get_offset() - 4 ) ) ;
- }
-
- // If the ORB is null, or if we're sure we're talking to
- // a foreign ORB, Merlin, or something more recent, we
- // use the updated end tag computation, and are more strenuous
- // about the values.
- if (orb == null ||
- ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
- ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {
-
- // If the end tag we read was less than what we were expecting,
- // then the sender must think it's sent more enclosing
- // chunked valuetypes than we have. Throw an exception.
- if (anEndTag < chunkedValueNestingLevel)
- throw wrapper.unexpectedEnclosingValuetype(
- CompletionStatus.COMPLETED_MAYBE, new Integer( anEndTag ),
- new Integer( chunkedValueNestingLevel ) ) ;
-
- // If the end tag is bigger than what we expected, but
- // still negative, then the sender has done some end tag
- // compaction. We back up the stream 4 bytes so that the
- // next time readEndTag is called, it will get down here
- // again. Even with fragmentation, we'll always be able
- // to do this.
- if (anEndTag != chunkedValueNestingLevel) {
- bbwi.position(bbwi.position() - 4);
- }
-
- } else {
-
- // When talking to Kestrel or Ladybird, we use our old
- // end tag rules and are less strict. If the end tag
- // isn't what we expected, we back up, assuming
- // compaction.
- if (anEndTag != end_flag) {
- bbwi.position(bbwi.position() - 4);
- }
- }
-
- // This only keeps track of the enclosing chunked
- // valuetypes
- chunkedValueNestingLevel++;
- }
-
- // This keeps track of all enclosing valuetypes
- end_flag++;
- }
-
- protected int get_offset() {
- return bbwi.position();
- }
-
- private void start_block() {
-
- // if (outerValueDone)
- if (!isChunked)
- return;
-
- // if called from alignAndCheck, need to reset blockLength
- // to avoid an infinite recursion loop on read_long() call
- blockLength = maxBlockLength;
-
- blockLength = read_long();
-
- // Must remember where we began the chunk to calculate how far
- // along we are. See notes above about chunkBeginPos.
-
- if (blockLength > 0 && blockLength < maxBlockLength) {
- blockLength += get_offset(); // _REVISIT_ unsafe, should use a Java long
-
- // inBlock = true;
- } else {
-
- // System.out.println("start_block snooped a " + Integer.toHexString(blockLength));
-
- // not a chunk length field
- blockLength = maxBlockLength;
-
- bbwi.position(bbwi.position() - 4);
- }
- }
-
- // Makes sure that if we were reading a chunked value, we end up
- // at the right place in the stream, no matter how little the
- // unmarshalling code read.
- //
- // After calling this method, if we are chunking, we should be
- // in position to read the end tag.
- private void handleEndOfValue() {
-
- // If we're not chunking, we don't have to worry about
- // skipping remaining chunks or finding end tags
- if (!isChunked)
- return;
-
- // Skip any remaining chunks
- while (blockLength != maxBlockLength) {
- end_block();
- start_block();
- }
-
- // Now look for the end tag
-
- // This is a little wasteful since we're reading
- // this long up to 3 times in the worst cases (once
- // in start_block, once here, and once in readEndTag
- //
- // Peek next long
- int nextLong = read_long();
- bbwi.position(bbwi.position() - 4);
-
- // We did find an end tag, so we're done. readEndTag
- // should take care of making sure it's the correct
- // end tag, etc. Remember that since end tags,
- // chunk lengths, and valuetags have non overlapping
- // ranges, we can tell by the value what the longs are.
- if (nextLong < 0)
- return;
-
- if (nextLong == 0 || nextLong >= maxBlockLength) {
-
- // A custom marshaled valuetype left extra data
- // on the wire, and that data had another
- // nested value inside of it. We've just
- // read the value tag or null of that nested value.
- //
- // In an attempt to get by it, we'll try to call
- // read_value() to get the nested value off of
- // the wire. Afterwards, we must call handleEndOfValue
- // recursively to read any further chunks that the containing
- // valuetype might still have after the nested
- // value.
- read_value();
- handleEndOfValue();
- } else {
- // This probably means that the code to skip chunks has
- // an error, and ended up setting blockLength to something
- // other than maxBlockLength even though we weren't
- // starting a new chunk.
- throw wrapper.couldNotSkipBytes( CompletionStatus.COMPLETED_MAYBE,
- new Integer( nextLong ), new Integer( get_offset() ) ) ;
- }
- }
-
- private void end_block() {
-
- // if in a chunk, check for underflow or overflow
- if (blockLength != maxBlockLength) {
- if (blockLength == get_offset()) {
- // Chunk ended correctly
- blockLength = maxBlockLength;
- } else {
- // Skip over anything left by bad unmarshaling code (ex:
- // a buggy custom unmarshaler). See handleEndOfValue.
- if (blockLength > get_offset()) {
- skipToOffset(blockLength);
- } else {
- throw wrapper.badChunkLength( new Integer( blockLength ),
- new Integer( get_offset() ) ) ;
- }
- }
- }
- }
-
- private int readValueTag(){
- // outerValueDone = false;
- return read_long();
- }
-
- public org.omg.CORBA.ORB orb() {
- return orb;
- }
-
- // ------------ End RMI related methods --------------------------
-
- public final void read_boolean_array(boolean[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_boolean();
- }
- }
-
- public final void read_char_array(char[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_char();
- }
- }
-
- public final void read_wchar_array(char[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_wchar();
- }
- }
-
- public final void read_short_array(short[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_short();
- }
- }
-
- public final void read_ushort_array(short[] value, int offset, int length) {
- read_short_array(value, offset, length);
- }
-
- public final void read_long_array(int[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_long();
- }
- }
-
- public final void read_ulong_array(int[] value, int offset, int length) {
- read_long_array(value, offset, length);
- }
-
- public final void read_longlong_array(long[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_longlong();
- }
- }
-
- public final void read_ulonglong_array(long[] value, int offset, int length) {
- read_longlong_array(value, offset, length);
- }
-
- public final void read_float_array(float[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_float();
- }
- }
-
- public final void read_double_array(double[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_double();
- }
- }
-
- public final void read_any_array(org.omg.CORBA.Any[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_any();
- }
- }
-
- //--------------------------------------------------------------------//
- // CDRInputStream state management.
- //
-
- /**
- * Are we at the end of the input stream?
- */
-// public final boolean isAtEnd() {
-// return bbwi.position() == bbwi.buflen;
-// }
-
-// public int available() throws IOException {
-// return bbwi.buflen - bbwi.position();
-// }
-
- private String read_repositoryIds() {
-
- // Read # of repository ids
- int numRepIds = read_long();
- if (numRepIds == 0xffffffff) {
- int indirection = read_long() + get_offset() - 4;
- if (repositoryIdCache != null && repositoryIdCache.containsOrderedVal(indirection))
- return (String)repositoryIdCache.getKey(indirection);
- else
- throw wrapper.unableToLocateRepIdArray( new Integer( indirection ) ) ;
- } else {
-
- // read first array element and store it as an indirection to the whole array
- int indirection = get_offset();
- String repID = read_repositoryId();
- if (repositoryIdCache == null)
- repositoryIdCache = new CacheTable(orb,false);
- repositoryIdCache.put(repID, indirection);
-
- // read and ignore the subsequent array elements, but put them in the
- // indirection table in case there are later indirections back to them
- for (int i = 1; i < numRepIds; i++) {
- read_repositoryId();
- }
-
- return repID;
- }
- }
-
- private final String read_repositoryId()
- {
- String result = readStringOrIndirection(true);
-
- if (result == null) { // Indirection
- int indirection = read_long() + get_offset() - 4;
-
- if (repositoryIdCache != null && repositoryIdCache.containsOrderedVal(indirection))
- return (String)repositoryIdCache.getKey(indirection);
- else
- throw wrapper.badRepIdIndirection( CompletionStatus.COMPLETED_MAYBE,
- new Integer(bbwi.position()) ) ;
- } else {
- if (repositoryIdCache == null)
- repositoryIdCache = new CacheTable(orb,false);
- repositoryIdCache.put(result, stringIndirection);
- }
-
- return result ;
- }
-
- private final String read_codebase_URL()
- {
- String result = readStringOrIndirection(true);
-
- if (result == null) { // Indirection
- int indirection = read_long() + get_offset() - 4;
-
- if (codebaseCache != null && codebaseCache.containsVal(indirection))
- return (String)codebaseCache.getKey(indirection);
- else
- throw wrapper.badCodebaseIndirection(
- CompletionStatus.COMPLETED_MAYBE,
- new Integer(bbwi.position()) ) ;
- } else {
- if (codebaseCache == null)
- codebaseCache = new CacheTable(orb,false);
- codebaseCache.put(result, stringIndirection);
- }
-
- return result;
- }
-
- /* DataInputStream methods */
-
- public java.lang.Object read_Abstract () {
- return read_abstract_interface();
- }
-
- public java.io.Serializable read_Value () {
- return read_value();
- }
-
- public void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) {
- read_any_array(seq.value, offset, length);
- }
-
- public void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) {
- read_boolean_array(seq.value, offset, length);
- }
-
- public void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) {
- read_char_array(seq.value, offset, length);
- }
-
- public void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) {
- read_wchar_array(seq.value, offset, length);
- }
-
- public void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) {
- read_octet_array(seq.value, offset, length);
- }
-
- public void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) {
- read_short_array(seq.value, offset, length);
- }
-
- public void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) {
- read_ushort_array(seq.value, offset, length);
- }
-
- public void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) {
- read_long_array(seq.value, offset, length);
- }
-
- public void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) {
- read_ulong_array(seq.value, offset, length);
- }
-
- public void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) {
- read_ulonglong_array(seq.value, offset, length);
- }
-
- public void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) {
- read_longlong_array(seq.value, offset, length);
- }
-
- public void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) {
- read_float_array(seq.value, offset, length);
- }
-
- public void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) {
- read_double_array(seq.value, offset, length);
- }
-
- public java.math.BigDecimal read_fixed(short digits, short scale) {
- // digits isn't really needed here
- StringBuffer buffer = read_fixed_buffer();
- if (digits != buffer.length())
- throw wrapper.badFixed( new Integer(digits),
- new Integer(buffer.length()) ) ;
- buffer.insert(digits - scale, '.');
- return new BigDecimal(buffer.toString());
- }
-
- // This method is unable to yield the correct scale.
- public java.math.BigDecimal read_fixed() {
- return new BigDecimal(read_fixed_buffer().toString());
- }
-
- // Each octet contains (up to) two decimal digits.
- // If the fixed type has an odd number of decimal digits, then the representation
- // begins with the first (most significant) digit.
- // Otherwise, this first half-octet is all zero, and the first digit
- // is in the second half-octet.
- // The sign configuration, in the last half-octet of the representation,
- // is 0xD for negative numbers and 0xC for positive and zero values.
- private StringBuffer read_fixed_buffer() {
- StringBuffer buffer = new StringBuffer(64);
- byte doubleDigit;
- int firstDigit;
- int secondDigit;
- boolean wroteFirstDigit = false;
- boolean more = true;
- while (more) {
- doubleDigit = this.read_octet();
- firstDigit = (int)((doubleDigit & 0xf0) >> 4);
- secondDigit = (int)(doubleDigit & 0x0f);
- if (wroteFirstDigit || firstDigit != 0) {
- buffer.append(Character.forDigit(firstDigit, 10));
- wroteFirstDigit = true;
- }
- if (secondDigit == 12) {
- // positive number or zero
- if ( ! wroteFirstDigit) {
- // zero
- return new StringBuffer("0.0");
- } else {
- // positive number
- // done
- }
- more = false;
- } else if (secondDigit == 13) {
- // negative number
- buffer.insert(0, '-');
- more = false;
- } else {
- buffer.append(Character.forDigit(secondDigit, 10));
- wroteFirstDigit = true;
- }
- }
- return buffer;
- }
-
- private final static String _id = "IDL:omg.org/CORBA/DataInputStream:1.0";
- private final static String[] _ids = { _id };
-
- public String[] _truncatable_ids() {
- if (_ids == null)
- return null;
-
- return (String[])_ids.clone();
- }
-
- /* for debugging */
-
- public void printBuffer() {
- CDRInputStream_1_0.printBuffer(this.bbwi);
- }
-
- public static void printBuffer(ByteBufferWithInfo bbwi) {
-
- System.out.println("----- Input Buffer -----");
- System.out.println();
- System.out.println("Current position: " + bbwi.position());
- System.out.println("Total length : " + bbwi.buflen);
- System.out.println();
-
- try {
-
- char[] charBuf = new char[16];
-
- for (int i = 0; i < bbwi.buflen; i += 16) {
-
- int j = 0;
-
- // For every 16 bytes, there is one line
- // of output. First, the hex output of
- // the 16 bytes with each byte separated
- // by a space.
- while (j < 16 && j + i < bbwi.buflen) {
- int k = bbwi.byteBuffer.get(i + j);
- if (k < 0)
- k = 256 + k;
- String hex = Integer.toHexString(k);
- if (hex.length() == 1)
- hex = "0" + hex;
- System.out.print(hex + " ");
- j++;
- }
-
- // Add any extra spaces to align the
- // text column in case we didn't end
- // at 16
- while (j < 16) {
- System.out.print(" ");
- j++;
- }
-
- // Now output the ASCII equivalents. Non-ASCII
- // characters are shown as periods.
- int x = 0;
- while (x < 16 && x + i < bbwi.buflen) {
- if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x)))
- charBuf[x] = (char)bbwi.byteBuffer.get(i + x);
- else
- charBuf[x] = '.';
- x++;
- }
- System.out.println(new String(charBuf, 0, x));
- }
-
- } catch (Throwable t) {
- t.printStackTrace();
- }
-
- System.out.println("------------------------");
- }
-
- public ByteBuffer getByteBuffer() {
- ByteBuffer result = null;
- if (bbwi != null) {
- result = bbwi.byteBuffer;
- }
- return result;
- }
-
- public int getBufferLength() {
- return bbwi.buflen;
- }
-
- public void setBufferLength(int value) {
- bbwi.buflen = value;
- bbwi.byteBuffer.limit(bbwi.buflen);
- }
-
- public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- this.bbwi = bbwi;
- }
-
- public void setByteBuffer(ByteBuffer byteBuffer) {
- bbwi.byteBuffer = byteBuffer;
- }
-
- public int getIndex() {
- return bbwi.position();
- }
-
- public void setIndex(int value) {
- bbwi.position(value);
- }
-
- public boolean isLittleEndian() {
- return littleEndian;
- }
-
- public void orb(org.omg.CORBA.ORB orb) {
- this.orb = (ORB)orb;
- }
-
- public BufferManagerRead getBufferManager() {
- return bufferManagerRead;
- }
-
- private void skipToOffset(int offset) {
-
- // Number of bytes to skip
- int len = offset - get_offset();
-
- int n = 0;
-
- while (n < len) {
- int avail;
- int bytes;
- int wanted;
-
- avail = bbwi.buflen - bbwi.position();
- if (avail <= 0) {
- grow(1, 1);
- avail = bbwi.buflen - bbwi.position();
- }
-
- wanted = len - n;
- bytes = (wanted < avail) ? wanted : avail;
- bbwi.position(bbwi.position() + bytes);
- n += bytes;
- }
- }
-
-
- // Mark and reset -------------------------------------------------
-
- protected MarkAndResetHandler markAndResetHandler = null;
-
- protected class StreamMemento
- {
- // These are the fields that may change after marking
- // the stream position, so we need to save them.
- private int blockLength_;
- private int end_flag_;
- private int chunkedValueNestingLevel_;
- private int valueIndirection_;
- private int stringIndirection_;
- private boolean isChunked_;
- private javax.rmi.CORBA.ValueHandler valueHandler_;
- private ByteBufferWithInfo bbwi_;
- private boolean specialNoOptionalDataState_;
-
- public StreamMemento()
- {
- blockLength_ = blockLength;
- end_flag_ = end_flag;
- chunkedValueNestingLevel_ = chunkedValueNestingLevel;
- valueIndirection_ = valueIndirection;
- stringIndirection_ = stringIndirection;
- isChunked_ = isChunked;
- valueHandler_ = valueHandler;
- specialNoOptionalDataState_ = specialNoOptionalDataState;
- bbwi_ = new ByteBufferWithInfo(bbwi);
- }
- }
-
- public java.lang.Object createStreamMemento() {
- return new StreamMemento();
- }
-
- public void restoreInternalState(java.lang.Object streamMemento) {
-
- StreamMemento mem = (StreamMemento)streamMemento;
-
- blockLength = mem.blockLength_;
- end_flag = mem.end_flag_;
- chunkedValueNestingLevel = mem.chunkedValueNestingLevel_;
- valueIndirection = mem.valueIndirection_;
- stringIndirection = mem.stringIndirection_;
- isChunked = mem.isChunked_;
- valueHandler = mem.valueHandler_;
- specialNoOptionalDataState = mem.specialNoOptionalDataState_;
- bbwi = mem.bbwi_;
- }
-
- public int getPosition() {
- return get_offset();
- }
-
- public void mark(int readlimit) {
- markAndResetHandler.mark(this);
- }
-
- public void reset() {
- markAndResetHandler.reset();
- }
-
- // ---------------------------------- end Mark and Reset
-
- // Provides a hook so subclasses of CDRInputStream can provide
- // a CodeBase. This ultimately allows us to grab a Connection
- // instance in IIOPInputStream, the only subclass where this
- // is actually used.
- CodeBase getCodeBase() {
- return parent.getCodeBase();
- }
-
- /**
- * Attempts to find the class described by the given
- * repository ID string and expected type. The first
- * attempt is to find the class locally, falling back
- * on the URL that came with the value. The second
- * attempt is to use a URL from the remote CodeBase.
- */
- private Class getClassFromString(String repositoryIDString,
- String codebaseURL,
- Class expectedType)
- {
- RepositoryIdInterface repositoryID
- = repIdStrs.getFromString(repositoryIDString);
-
- try {
- try {
- // First try to load the class locally, then use
- // the provided URL (if it isn't null)
- return repositoryID.getClassFromType(expectedType,
- codebaseURL);
- } catch (ClassNotFoundException cnfeOuter) {
-
- try {
-
- if (getCodeBase() == null) {
- return null; // class cannot be loaded remotely.
- }
-
- // Get a URL from the remote CodeBase and retry
- codebaseURL = getCodeBase().implementation(repositoryIDString);
-
- // Don't bother trying to find it locally again if
- // we got a null URL
- if (codebaseURL == null)
- return null;
-
- return repositoryID.getClassFromType(expectedType,
- codebaseURL);
- } catch (ClassNotFoundException cnfeInner) {
- dprintThrowable(cnfeInner);
- // Failed to load the class
- return null;
- }
- }
- } catch (MalformedURLException mue) {
- // Always report a bad URL
- throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
- mue, repositoryIDString, codebaseURL ) ;
- }
- }
-
- /**
- * Attempts to find the class described by the given
- * repository ID string. At most, three attempts are made:
- * Try to find it locally, through the provided URL, and
- * finally, via a URL from the remote CodeBase.
- */
- private Class getClassFromString(String repositoryIDString,
- String codebaseURL)
- {
- RepositoryIdInterface repositoryID
- = repIdStrs.getFromString(repositoryIDString);
-
- for (int i = 0; i < 3; i++) {
-
- try {
-
- switch (i)
- {
- case 0:
- // First try to load the class locally
- return repositoryID.getClassFromType();
- case 1:
- // Try to load the class using the provided
- // codebase URL (falls out below)
- break;
- case 2:
- // Try to load the class using a URL from the
- // remote CodeBase
- codebaseURL = getCodeBase().implementation(repositoryIDString);
- break;
- }
-
- // Don't bother if the codebaseURL is null
- if (codebaseURL == null)
- continue;
-
- return repositoryID.getClassFromType(codebaseURL);
-
- } catch(ClassNotFoundException cnfe) {
- // Will ultimately return null if all three
- // attempts fail, but don't do anything here.
- } catch (MalformedURLException mue) {
- throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
- mue, repositoryIDString, codebaseURL ) ;
- }
- }
-
- // If we get here, we have failed to load the class
- dprint("getClassFromString failed with rep id "
- + repositoryIDString
- + " and codebase "
- + codebaseURL);
-
- return null;
- }
-
- // Utility method used to get chars from bytes
- char[] getConvertedChars(int numBytes,
- CodeSetConversion.BTCConverter converter) {
-
- // REVISIT - Look at CodeSetConversion.BTCConverter to see
- // if it can work with an NIO ByteBuffer. We should
- // avoid getting the bytes into an array if possible.
-
- // To be honest, I doubt this saves much real time
- if (bbwi.buflen - bbwi.position() >= numBytes) {
- // If the entire string is in this buffer,
- // just convert directly from the bbwi rather than
- // allocating and copying.
- byte[] tmpBuf;
- if (bbwi.byteBuffer.hasArray())
- {
- tmpBuf = bbwi.byteBuffer.array();
- }
- else
- {
- tmpBuf = new byte[bbwi.buflen];
- // Microbenchmarks are showing a loop of ByteBuffer.get(int)
- // being faster than ByteBuffer.get(byte[], int, int).
- for (int i = 0; i < bbwi.buflen; i++)
- tmpBuf[i] = bbwi.byteBuffer.get(i);
- }
- char[] result = converter.getChars(tmpBuf,bbwi.position(),numBytes);
-
- bbwi.position(bbwi.position() + numBytes);
- return result;
- } else {
- // Stretches across buffers. Unless we provide an
- // incremental conversion interface, allocate and
- // copy the bytes.
- byte[] bytes = new byte[numBytes];
- read_octet_array(bytes, 0, bytes.length);
-
- return converter.getChars(bytes, 0, numBytes);
- }
- }
-
- protected CodeSetConversion.BTCConverter getCharConverter() {
- if (charConverter == null)
- charConverter = parent.createCharBTCConverter();
-
- return charConverter;
- }
-
- protected CodeSetConversion.BTCConverter getWCharConverter() {
- if (wcharConverter == null)
- wcharConverter = parent.createWCharBTCConverter();
-
- return wcharConverter;
- }
-
- protected void dprintThrowable(Throwable t) {
- if (debug && t != null)
- t.printStackTrace();
- }
-
- protected void dprint(String msg) {
- if (debug) {
- ORBUtility.dprint(this, msg);
- }
- }
-
- /**
- * Aligns the current position on the given octet boundary
- * if there are enough bytes available to do so. Otherwise,
- * it just returns. This is used for some (but not all)
- * GIOP 1.2 message headers.
- */
-
- void alignOnBoundary(int octetBoundary) {
- int needed = computeAlignment(bbwi.position(), octetBoundary);
-
- if (bbwi.position() + needed <= bbwi.buflen)
- {
- bbwi.position(bbwi.position() + needed);
- }
- }
-
- public void resetCodeSetConverters() {
- charConverter = null;
- wcharConverter = null;
- }
-
- public void start_value() {
- // Read value tag
- int vType = readValueTag();
-
- if (vType == 0) {
- // Stream needs to go into a state where it
- // throws standard exception until end_value
- // is called. This means the sender didn't
- // send any custom data. If the reader here
- // tries to read more, we need to throw an
- // exception before reading beyond where
- // we're supposed to
- specialNoOptionalDataState = true;
-
- return;
- }
-
- if (vType == 0xffffffff) {
- // One should never indirect to a custom wrapper
- throw wrapper.customWrapperIndirection(
- CompletionStatus.COMPLETED_MAYBE);
- }
-
- if (repIdUtil.isCodeBasePresent(vType)) {
- throw wrapper.customWrapperWithCodebase(
- CompletionStatus.COMPLETED_MAYBE);
- }
-
- if (repIdUtil.getTypeInfo(vType)
- != RepositoryIdUtility.SINGLE_REP_TYPE_INFO) {
- throw wrapper.customWrapperNotSingleRepid(
- CompletionStatus.COMPLETED_MAYBE);
- }
-
-
- // REVISIT - Could verify repository ID even though
- // it isn't used elsewhere
- read_repositoryId();
-
- // Note: isChunked should be true here. Should have
- // been set to true in the containing value's read_value
- // method.
-
- start_block();
- end_flag--;
- chunkedValueNestingLevel--;
- }
-
- public void end_value() {
-
- if (specialNoOptionalDataState) {
- specialNoOptionalDataState = false;
- return;
- }
-
- handleEndOfValue();
- readEndTag();
-
- // Note that isChunked should still be true here.
- // If the containing valuetype is the highest
- // chunked value, it will get set to false
- // at the end of read_value.
-
- // allow for possible continuation chunk
- start_block();
- }
-
- public void close() throws IOException
- {
-
- // tell BufferManagerRead to release any ByteBuffers
- getBufferManager().close(bbwi);
-
- // It's possible bbwi.byteBuffer is shared between
- // this InputStream and an OutputStream. Thus, we check
- // if the Input/Output streams are using the same ByteBuffer.
- // If they sharing the same ByteBuffer we need to ensure only
- // one of those ByteBuffers are released to the ByteBufferPool.
-
- if (bbwi != null && getByteBuffer() != null)
- {
- MessageMediator messageMediator = parent.getMessageMediator();
- if (messageMediator != null)
- {
- CDROutputObject outputObj =
- (CDROutputObject)messageMediator.getOutputObject();
- if (outputObj != null)
- {
- if (outputObj.isSharing(getByteBuffer()))
- {
- // Set OutputStream's ByteBuffer and bbwi to null
- // so its ByteBuffer cannot be released to the pool
- outputObj.setByteBuffer(null);
- outputObj.setByteBufferWithInfo(null);
- }
- }
- }
-
- // release this stream's ByteBuffer to the pool
- ByteBufferPool byteBufferPool = orb.getByteBufferPool();
- if (debug)
- {
- // print address of ByteBuffer being released
- int bbAddress = System.identityHashCode(bbwi.byteBuffer);
- StringBuffer sb = new StringBuffer(80);
- sb.append(".close - releasing ByteBuffer id (");
- sb.append(bbAddress).append(") to ByteBufferPool.");
- String msg = sb.toString();
- dprint(msg);
- }
- byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
- bbwi.byteBuffer = null;
- bbwi = null;
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_1.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_1.java
deleted file mode 100644
index 76bc297..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_1.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-
-public class CDRInputStream_1_1 extends CDRInputStream_1_0
-{
- // See notes in CDROutputStream
- protected int fragmentOffset = 0;
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_1;
- }
-
- // Template method
- public CDRInputStreamBase dup() {
- CDRInputStreamBase result = super.dup();
-
- ((CDRInputStream_1_1)result).fragmentOffset = this.fragmentOffset;
-
- return result;
- }
-
- protected int get_offset() {
- return bbwi.position() + fragmentOffset;
- }
-
- protected void alignAndCheck(int align, int n) {
-
-
- checkBlockLength(align, n);
-
- // WARNING: Must compute real alignment after calling
- // checkBlockLength since it may move the position
- int alignment = computeAlignment(bbwi.position(), align);
-
- if (bbwi.position() + n + alignment > bbwi.buflen) {
-
- // Some other ORBs may have found a way to send 1.1
- // fragments which put alignment bytes at the end
- // of a fragment
- if (bbwi.position() + alignment == bbwi.buflen)
- {
- bbwi.position(bbwi.position() + alignment);
- }
-
- grow(align, n);
-
- // We must recalculate the alignment after a possible
- // fragmentation since the new bbwi.position() (after the header)
- // may require a different alignment.
-
- alignment = computeAlignment(bbwi.position(), align);
- }
-
- bbwi.position(bbwi.position() + alignment);
- }
-
- //
- // This can be overridden....
- //
- protected void grow(int align, int n) {
-
- bbwi.needed = n;
-
- // Save the size of the current buffer for
- // possible fragmentOffset calculation
- int oldSize = bbwi.position();
-
- bbwi = bufferManagerRead.underflow(bbwi);
-
- if (bbwi.fragmented) {
-
- // By this point we should be guaranteed to have
- // a new fragment whose header has already been
- // unmarshalled. bbwi.position() should point to the
- // end of the header.
- fragmentOffset += (oldSize - bbwi.position());
-
- markAndResetHandler.fragmentationOccured(bbwi);
-
- // Clear the flag
- bbwi.fragmented = false;
- }
- }
-
- // Mark/reset ---------------------------------------
-
- private class FragmentableStreamMemento extends StreamMemento
- {
- private int fragmentOffset_;
-
- public FragmentableStreamMemento()
- {
- super();
-
- fragmentOffset_ = fragmentOffset;
- }
- }
-
- public java.lang.Object createStreamMemento() {
- return new FragmentableStreamMemento();
- }
-
- public void restoreInternalState(java.lang.Object streamMemento)
- {
- super.restoreInternalState(streamMemento);
-
- fragmentOffset
- = ((FragmentableStreamMemento)streamMemento).fragmentOffset_;
- }
-
- // --------------------------------------------------
-
- public char read_wchar() {
- // In GIOP 1.1, interoperability with wchar is limited
- // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6.
- // WARNING: For UTF-16, this means that there can be no
- // byte order marker, so it must default to big endian!
- alignAndCheck(2, 2);
-
- // Because of the alignAndCheck, we should be guaranteed
- // 2 bytes of real data.
- char[] result = getConvertedChars(2, getWCharConverter());
-
- // Did the provided bytes convert to more than one
- // character? This may come up as more unicode values are
- // assigned, and a single 16 bit Java char isn't enough.
- // Better to use strings for i18n purposes.
- if (getWCharConverter().getNumChars() > 1)
- throw wrapper.btcResultMoreThanOneChar() ;
-
- return result[0];
- }
-
- public String read_wstring() {
- // In GIOP 1.1, interoperability with wchar is limited
- // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6.
- int len = read_long();
-
- // Workaround for ORBs which send string lengths of
- // zero to mean empty string.
- //
- // IMPORTANT: Do not replace 'new String("")' with "", it may result
- // in a Serialization bug (See serialization.zerolengthstring) and
- // bug id: 4728756 for details
- if (len == 0)
- return new String("");
-
- checkForNegativeLength(len);
-
- // Don't include the two byte null for the
- // following computations. Remember that since we're limited
- // to a 2 byte fixed width code set, the "length" was the
- // number of such 2 byte code points plus a 2 byte null.
- len = len - 1;
-
- char[] result = getConvertedChars(len * 2, getWCharConverter());
-
- // Skip over the 2 byte null
- read_short();
-
- return new String(result, 0, getWCharConverter().getNumChars());
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_2.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_2.java
deleted file mode 100644
index 6b2ef38..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_2.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-public class CDRInputStream_1_2 extends CDRInputStream_1_1
-{
- // Indicates whether the header is padded. In GIOP 1.2 and above,
- // the body must be aligned on an 8-octet boundary, and so the header is
- // padded appropriately. However, if there is no body to a request or reply
- // message, there is no header padding, in the unfragmented case.
- protected boolean headerPadding;
-
- // used to remember headerPadding flag when mark() and restore() are used.
- protected boolean restoreHeaderPadding;
-
- // Called by RequestMessage_1_2 or ReplyMessage_1_2 classes only.
- void setHeaderPadding(boolean headerPadding) {
- this.headerPadding = headerPadding;
- }
-
- // the mark and reset methods have been overridden to remember the
- // headerPadding flag.
-
- public void mark(int readlimit) {
- super.mark(readlimit);
- restoreHeaderPadding = headerPadding;
- }
-
- public void reset() {
- super.reset();
- headerPadding = restoreHeaderPadding;
- restoreHeaderPadding = false;
- }
-
- // Template method
- // This method has been overriden to ensure that the duplicated stream
- // inherits the headerPadding flag, in case of GIOP 1.2 and above, streams.
- public CDRInputStreamBase dup() {
- CDRInputStreamBase result = super.dup();
- ((CDRInputStream_1_2)result).headerPadding = this.headerPadding;
- return result;
- }
-
- protected void alignAndCheck(int align, int n) {
-
- // headerPadding bit is set by read method of the RequestMessage_1_2
- // or ReplyMessage_1_2 classes. When set, the very first body read
- // operation (from the stub code) would trigger an alignAndCheck
- // method call, that would in turn skip the header padding that was
- // inserted during the earlier write operation by the sender. The
- // padding ensures that the body is aligned on an 8-octet boundary,
- // for GIOP versions 1.2 and beyond.
- if (headerPadding == true) {
- headerPadding = false;
- alignOnBoundary(ORBConstants.GIOP_12_MSG_BODY_ALIGNMENT);
- }
-
- checkBlockLength(align, n);
-
- // WARNING: Must compute real alignment after calling
- // checkBlockLength since it may move the position
-
- // In GIOP 1.2, a fragment may end with some alignment
- // padding (which leads to all fragments ending perfectly
- // on evenly divisible 8 byte boundaries). A new fragment
- // never requires alignment with the header since it ends
- // on an 8 byte boundary.
-
- int alignIncr = computeAlignment(bbwi.position(),align);
- bbwi.position(bbwi.position() + alignIncr);
-
- if (bbwi.position() + n > bbwi.buflen) {
- grow(1, n);
- }
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_2;
- }
-
- public char read_wchar() {
- // In GIOP 1.2, a wchar is encoded as an unsigned octet length
- // followed by the octets of the converted wchar.
- int numBytes = read_octet();
-
- char[] result = getConvertedChars(numBytes, getWCharConverter());
-
- // Did the provided bytes convert to more than one
- // character? This may come up as more unicode values are
- // assigned, and a single 16 bit Java char isn't enough.
- // Better to use strings for i18n purposes.
- if (getWCharConverter().getNumChars() > 1)
- throw wrapper.btcResultMoreThanOneChar() ;
-
- return result[0];
- }
-
- public String read_wstring() {
- // In GIOP 1.2, wstrings are not terminated by a null. The
- // length is the number of octets in the converted format.
- // A zero length string is represented with the 4 byte length
- // value of 0.
-
- int len = read_long();
-
- //
- // IMPORTANT: Do not replace 'new String("")' with "", it may result
- // in a Serialization bug (See serialization.zerolengthstring) and
- // bug id: 4728756 for details
- if (len == 0)
- return new String("");
-
- checkForNegativeLength(len);
-
- return new String(getConvertedChars(len, getWCharConverter()),
- 0,
- getWCharConverter().getNumChars());
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputObject.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputObject.java
deleted file mode 100644
index b476902..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputObject.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Copyright (c) 2001, 2004, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.portable.InputStream;
-
-import com.sun.corba.se.pept.encoding.OutputObject;
-import com.sun.corba.se.pept.protocol.MessageMediator;
-
-import com.sun.corba.se.spi.encoding.CorbaOutputObject ;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-import com.sun.corba.se.pept.transport.ByteBufferPool;
-import com.sun.corba.se.spi.transport.CorbaConnection;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.spi.servicecontext.ServiceContexts;
-import com.sun.corba.se.impl.encoding.BufferManagerFactory;
-import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream_1_0;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-
-/**
- * @author Harold Carr
- */
-public class CDROutputObject extends CorbaOutputObject
-{
- private Message header;
- private ORB orb;
- private ORBUtilSystemException wrapper;
- private OMGSystemException omgWrapper;
-
- // REVISIT - only used on sendCancelRequest.
- private CorbaConnection connection;
-
- private CDROutputObject(
- ORB orb, GIOPVersion giopVersion, Message header,
- BufferManagerWrite manager, byte streamFormatVersion,
- CorbaMessageMediator mediator)
- {
- super(orb, giopVersion, header.getEncodingVersion(),
- false, manager, streamFormatVersion,
- ((mediator != null && mediator.getConnection() != null) ?
- ((CorbaConnection)mediator.getConnection()).
- shouldUseDirectByteBuffers() : false));
-
- this.header = header;
- this.orb = orb;
- this.wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.RPC_ENCODING ) ;
- this.omgWrapper = OMGSystemException.get( orb, CORBALogDomains.RPC_ENCODING ) ;
-
- getBufferManager().setOutputObject(this);
- this.corbaMessageMediator = mediator;
- }
-
- public CDROutputObject(ORB orb,
- MessageMediator messageMediator,
- Message header,
- byte streamFormatVersion)
- {
- this(
- orb,
- ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
- header,
- BufferManagerFactory.newBufferManagerWrite(
- ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
- header.getEncodingVersion(),
- orb),
- streamFormatVersion,
- (CorbaMessageMediator)messageMediator);
- }
-
- // NOTE:
- // Used in SharedCDR (i.e., must be grow).
- // Used in msgtypes test.
- public CDROutputObject(ORB orb,
- MessageMediator messageMediator,
- Message header,
- byte streamFormatVersion,
- int strategy)
- {
- this(
- orb,
- ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
- header,
- BufferManagerFactory.
- newBufferManagerWrite(strategy,
- header.getEncodingVersion(),
- orb),
- streamFormatVersion,
- (CorbaMessageMediator)messageMediator);
- }
-
- // REVISIT
- // Used on sendCancelRequest.
- // Used for needs addressing mode.
- public CDROutputObject(ORB orb, CorbaMessageMediator mediator,
- GIOPVersion giopVersion,
- CorbaConnection connection, Message header,
- byte streamFormatVersion)
- {
- this(
- orb,
- giopVersion,
- header,
- BufferManagerFactory.
- newBufferManagerWrite(giopVersion,
- header.getEncodingVersion(),
- orb),
- streamFormatVersion,
- mediator);
- this.connection = connection ;
- }
-
- // XREVISIT
- // Header should only be in message mediator.
- // Another possibility: merge header and message mediator.
- // REVISIT - make protected once all encoding together
- public Message getMessageHeader() {
- return header;
- }
-
- public final void finishSendingMessage() {
- getBufferManager().sendMessage();
- }
-
- /**
- * Write the contents of the CDROutputStream to the specified
- * output stream. Has the side-effect of pushing any current
- * Message onto the Message list.
- * @param s The output stream to write to.
- */
- public void writeTo(CorbaConnection connection)
- throws java.io.IOException
- {
-
- //
- // Update the GIOP MessageHeader size field.
- //
-
- ByteBufferWithInfo bbwi = getByteBufferWithInfo();
-
- getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());
-
- if (orb() != null) {
- if (((ORB)orb()).transportDebugFlag) {
- dprint(".writeTo: " + connection);
- }
- if (((ORB)orb()).giopDebugFlag) {
- CDROutputStream_1_0.printBuffer(bbwi);
- }
- }
- bbwi.byteBuffer.position(0).limit(bbwi.getSize());
- connection.write(bbwi.byteBuffer);
- }
-
- /** overrides create_input_stream from CDROutputStream */
- public org.omg.CORBA.portable.InputStream create_input_stream()
- {
- // XREVISIT
- return null;
- //return new XIIOPInputStream(orb(), getByteBuffer(), getIndex(),
- //isLittleEndian(), getMessageHeader(), conn);
- }
-
- public CorbaConnection getConnection()
- {
- // REVISIT - only set when doing sendCancelRequest.
- if (connection != null) {
- return connection;
- }
- return (CorbaConnection) corbaMessageMediator.getConnection();
- }
-
- // XREVISIT - If CDROutputObject doesn't live in the iiop
- // package, it will need this, here, to give package access
- // to xgiop.
- // REVISIT - make protected once all encoding together
- public final ByteBufferWithInfo getByteBufferWithInfo() {
- return super.getByteBufferWithInfo();
- }
-
- // REVISIT - make protected once all encoding together
- public final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- super.setByteBufferWithInfo(bbwi);
- }
-
- /**
- * Override the default CDR factory behavior to get the
- * negotiated code sets from the connection.
- *
- * These are only called once per message, the first time needed.
- *
- * In the local case, there is no Connection, so use the
- * local code sets.
- */
- protected CodeSetConversion.CTBConverter createCharCTBConverter() {
- CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();
-
- // If the connection doesn't have its negotiated
- // code sets by now, fall back on the defaults defined
- // in CDRInputStream.
- if (codesets == null)
- return super.createCharCTBConverter();
-
- OSFCodeSetRegistry.Entry charSet
- = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet());
-
- if (charSet == null)
- throw wrapper.unknownCodeset( charSet ) ;
-
- return CodeSetConversion.impl().getCTBConverter(charSet,
- isLittleEndian(),
- false);
- }
-
- protected CodeSetConversion.CTBConverter createWCharCTBConverter() {
-
- CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();
-
- // If the connection doesn't have its negotiated
- // code sets by now, we have to throw an exception.
- // See CORBA formal 00-11-03 13.9.2.6.
- if (codesets == null) {
- if (getConnection().isServer())
- throw omgWrapper.noClientWcharCodesetCtx() ;
- else
- throw omgWrapper.noServerWcharCodesetCmp() ;
- }
-
- OSFCodeSetRegistry.Entry wcharSet
- = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet());
-
- if (wcharSet == null)
- throw wrapper.unknownCodeset( wcharSet ) ;
-
- boolean useByteOrderMarkers
- = ((ORB)orb()).getORBData().useByteOrderMarkers();
-
- // With UTF-16:
- //
- // For GIOP 1.2, we can put byte order markers if we want to, and
- // use the default of big endian otherwise. (See issue 3405b)
- //
- // For GIOP 1.1, we don't use BOMs and use the endianness of
- // the stream.
- if (wcharSet == OSFCodeSetRegistry.UTF_16) {
- if (getGIOPVersion().equals(GIOPVersion.V1_2)) {
- return CodeSetConversion.impl().getCTBConverter(wcharSet,
- false,
- useByteOrderMarkers);
- }
-
- if (getGIOPVersion().equals(GIOPVersion.V1_1)) {
- return CodeSetConversion.impl().getCTBConverter(wcharSet,
- isLittleEndian(),
- false);
- }
- }
-
- // In the normal case, let the converter system handle it
- return CodeSetConversion.impl().getCTBConverter(wcharSet,
- isLittleEndian(),
- useByteOrderMarkers);
- }
-
- // If we're local and don't have a Connection, use the
- // local code sets, otherwise get them from the connection.
- // If the connection doesn't have negotiated code sets
- // yet, then we use ISO8859-1 for char/string and wchar/wstring
- // are illegal.
- private CodeSetComponentInfo.CodeSetContext getCodeSets() {
- if (getConnection() == null)
- return CodeSetComponentInfo.LOCAL_CODE_SETS;
- else
- return getConnection().getCodeSetContext();
- }
-
- protected void dprint(String msg)
- {
- ORBUtility.dprint("CDROutputObject", msg);
- }
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream.java
deleted file mode 100644
index 2275dc5..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream.java
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-import com.sun.corba.se.pept.protocol.MessageMediator;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-/**
- * This is delegates to the real implementation.
- */
-public abstract class CDROutputStream
- extends org.omg.CORBA_2_3.portable.OutputStream
- implements com.sun.corba.se.impl.encoding.MarshalOutputStream,
- org.omg.CORBA.DataOutputStream, org.omg.CORBA.portable.ValueOutputStream
-{
- private CDROutputStreamBase impl;
- protected ORB orb ;
- protected ORBUtilSystemException wrapper ;
- protected CorbaMessageMediator corbaMessageMediator;
-
-
- // We can move this out somewhere later. For now, it serves its purpose
- // to create a concrete CDR delegate based on the GIOP version.
- private static class OutputStreamFactory {
-
- public static CDROutputStreamBase newOutputStream(
- ORB orb, GIOPVersion version, byte encodingVersion) {
- switch(version.intValue()) {
- case GIOPVersion.VERSION_1_0:
- return new CDROutputStream_1_0();
- case GIOPVersion.VERSION_1_1:
- return new CDROutputStream_1_1();
- case GIOPVersion.VERSION_1_2:
- if (encodingVersion != Message.CDR_ENC_VERSION) {
- return
- new IDLJavaSerializationOutputStream(encodingVersion);
- }
- return new CDROutputStream_1_2();
- default:
- ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- // REVISIT - what is appropriate? INTERNAL exceptions
- // are really hard to track later.
- throw wrapper.unsupportedGiopVersion( version ) ;
- }
- }
- }
-
- // REVISIT - These two constructors should be re-factored to better hide
- // the fact that someone extending this class 'can' construct a CDROutputStream
- // that does not use pooled ByteBuffers. Right now, only EncapsOutputStream
- // does _not_ use pooled ByteBuffers, see EncapsOutputStream.
-
- // NOTE: When a stream is constructed for non-channel-backed sockets
- // it notifies the constructor not to use pooled (i.e, direct)
- // ByteBuffers.
-
- public CDROutputStream(ORB orb,
- GIOPVersion version,
- byte encodingVersion,
- boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion,
- boolean usePooledByteBuffers)
- {
- impl = OutputStreamFactory.newOutputStream(orb, version,
- encodingVersion);
- impl.init(orb, littleEndian, bufferManager,
- streamFormatVersion, usePooledByteBuffers);
-
- impl.setParent(this);
- this.orb = orb ;
- this.wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- }
-
- public CDROutputStream(ORB orb,
- GIOPVersion version,
- byte encodingVersion,
- boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion)
- {
- this(orb, version, encodingVersion, littleEndian,
- bufferManager, streamFormatVersion, true);
- }
-
- // org.omg.CORBA.portable.OutputStream
-
- // Provided by IIOPOutputStream and EncapsOutputStream
- public abstract org.omg.CORBA.portable.InputStream create_input_stream();
-
- public final void write_boolean(boolean value) {
- impl.write_boolean(value);
- }
- public final void write_char(char value) {
- impl.write_char(value);
- }
- public final void write_wchar(char value) {
- impl.write_wchar(value);
- }
- public final void write_octet(byte value) {
- impl.write_octet(value);
- }
- public final void write_short(short value) {
- impl.write_short(value);
- }
- public final void write_ushort(short value) {
- impl.write_ushort(value);
- }
- public final void write_long(int value) {
- impl.write_long(value);
- }
- public final void write_ulong(int value) {
- impl.write_ulong(value);
- }
- public final void write_longlong(long value) {
- impl.write_longlong(value);
- }
- public final void write_ulonglong(long value) {
- impl.write_ulonglong(value);
- }
- public final void write_float(float value) {
- impl.write_float(value);
- }
- public final void write_double(double value) {
- impl.write_double(value);
- }
- public final void write_string(String value) {
- impl.write_string(value);
- }
- public final void write_wstring(String value) {
- impl.write_wstring(value);
- }
-
- public final void write_boolean_array(boolean[] value, int offset, int length) {
- impl.write_boolean_array(value, offset, length);
- }
- public final void write_char_array(char[] value, int offset, int length) {
- impl.write_char_array(value, offset, length);
- }
- public final void write_wchar_array(char[] value, int offset, int length) {
- impl.write_wchar_array(value, offset, length);
- }
- public final void write_octet_array(byte[] value, int offset, int length) {
- impl.write_octet_array(value, offset, length);
- }
- public final void write_short_array(short[] value, int offset, int length) {
- impl.write_short_array(value, offset, length);
- }
- public final void write_ushort_array(short[] value, int offset, int length){
- impl.write_ushort_array(value, offset, length);
- }
- public final void write_long_array(int[] value, int offset, int length) {
- impl.write_long_array(value, offset, length);
- }
- public final void write_ulong_array(int[] value, int offset, int length) {
- impl.write_ulong_array(value, offset, length);
- }
- public final void write_longlong_array(long[] value, int offset, int length) {
- impl.write_longlong_array(value, offset, length);
- }
- public final void write_ulonglong_array(long[] value, int offset,int length) {
- impl.write_ulonglong_array(value, offset, length);
- }
- public final void write_float_array(float[] value, int offset, int length) {
- impl.write_float_array(value, offset, length);
- }
- public final void write_double_array(double[] value, int offset, int length) {
- impl.write_double_array(value, offset, length);
- }
- public final void write_Object(org.omg.CORBA.Object value) {
- impl.write_Object(value);
- }
- public final void write_TypeCode(TypeCode value) {
- impl.write_TypeCode(value);
- }
- public final void write_any(Any value) {
- impl.write_any(value);
- }
-
- public final void write_Principal(Principal value) {
- impl.write_Principal(value);
- }
-
- public final void write(int b) throws java.io.IOException {
- impl.write(b);
- }
-
- public final void write_fixed(java.math.BigDecimal value) {
- impl.write_fixed(value);
- }
-
- public final void write_Context(org.omg.CORBA.Context ctx,
- org.omg.CORBA.ContextList contexts) {
- impl.write_Context(ctx, contexts);
- }
-
- public final org.omg.CORBA.ORB orb() {
- return impl.orb();
- }
-
- // org.omg.CORBA_2_3.portable.OutputStream
- public final void write_value(java.io.Serializable value) {
- impl.write_value(value);
- }
-
- public final void write_value(java.io.Serializable value, java.lang.Class clz) {
- impl.write_value(value, clz);
- }
-
- public final void write_value(java.io.Serializable value, String repository_id) {
- impl.write_value(value, repository_id);
- }
-
- public final void write_value(java.io.Serializable value,
- org.omg.CORBA.portable.BoxedValueHelper factory) {
- impl.write_value(value, factory);
- }
-
- public final void write_abstract_interface(java.lang.Object obj) {
- impl.write_abstract_interface(obj);
- }
-
- // java.io.OutputStream
- public final void write(byte b[]) throws IOException {
- impl.write(b);
- }
-
- public final void write(byte b[], int off, int len) throws IOException {
- impl.write(b, off, len);
- }
-
- public final void flush() throws IOException {
- impl.flush();
- }
-
- public final void close() throws IOException {
- impl.close();
- }
-
- // com.sun.corba.se.impl.encoding.MarshalOutputStream
- public final void start_block() {
- impl.start_block();
- }
-
- public final void end_block() {
- impl.end_block();
- }
-
- public final void putEndian() {
- impl.putEndian();
- }
-
- public void writeTo(java.io.OutputStream s)
- throws IOException
- {
- impl.writeTo(s);
- }
-
- public final byte[] toByteArray() {
- return impl.toByteArray();
- }
-
- // org.omg.CORBA.DataOutputStream
- public final void write_Abstract (java.lang.Object value) {
- impl.write_Abstract(value);
- }
-
- public final void write_Value (java.io.Serializable value) {
- impl.write_Value(value);
- }
-
- public final void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length) {
- impl.write_any_array(seq, offset, length);
- }
-
- public void setMessageMediator(MessageMediator messageMediator)
- {
- this.corbaMessageMediator = (CorbaMessageMediator) messageMediator;
- }
-
- public MessageMediator getMessageMediator()
- {
- return corbaMessageMediator;
- }
-
- // org.omg.CORBA.portable.ValueBase
- public final String[] _truncatable_ids() {
- return impl._truncatable_ids();
- }
-
- // Other
- protected final int getSize() {
- return impl.getSize();
- }
-
- protected final int getIndex() {
- return impl.getIndex();
- }
-
- protected int getRealIndex(int index) {
- // Used in indirections. Overridden by TypeCodeOutputStream.
- return index;
- }
-
- protected final void setIndex(int value) {
- impl.setIndex(value);
- }
-
- protected final ByteBuffer getByteBuffer() {
- return impl.getByteBuffer();
- }
-
- protected final void setByteBuffer(ByteBuffer byteBuffer) {
- impl.setByteBuffer(byteBuffer);
- }
-
- /**
- * return true if our ByteBuffer is sharing/equal to bb
- */
- protected final boolean isSharing(ByteBuffer bb) {
- return (getByteBuffer() == bb);
- }
-
- public final boolean isLittleEndian() {
- return impl.isLittleEndian();
- }
-
- // XREVISIT - return to final if possible
- // REVISIT - was protected - need access from msgtypes test.
- public ByteBufferWithInfo getByteBufferWithInfo() {
- return impl.getByteBufferWithInfo();
- }
-
- protected void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- impl.setByteBufferWithInfo(bbwi);
- }
-
- // REVISIT: was protected - but need to access from xgiop.
- public final BufferManagerWrite getBufferManager() {
- return impl.getBufferManager();
- }
-
- public final void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale) {
- impl.write_fixed(bigDecimal, digits, scale);
- }
-
- public final void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) {
- impl.writeOctetSequenceTo(s);
- }
-
- public final GIOPVersion getGIOPVersion() {
- return impl.getGIOPVersion();
- }
-
- public final void writeIndirection(int tag, int posIndirectedTo) {
- impl.writeIndirection(tag, posIndirectedTo);
- }
-
- // Use Latin-1 for GIOP 1.0 or when code set negotiation was not
- // performed.
- protected CodeSetConversion.CTBConverter createCharCTBConverter() {
- return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1);
- }
-
- // Subclasses must decide what to do here. It's inconvenient to
- // make the class and this method abstract because of dup().
- protected abstract CodeSetConversion.CTBConverter createWCharCTBConverter();
-
- protected final void freeInternalCaches() {
- impl.freeInternalCaches();
- }
-
- void printBuffer() {
- impl.printBuffer();
- }
-
- public void alignOnBoundary(int octetBoundary) {
- impl.alignOnBoundary(octetBoundary);
- }
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- public void setHeaderPadding(boolean headerPadding) {
- impl.setHeaderPadding(headerPadding);
- }
-
- // ValueOutputStream -----------------------------
-
- public void start_value(String rep_id) {
- impl.start_value(rep_id);
- }
-
- public void end_value() {
- impl.end_value();
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStreamBase.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStreamBase.java
deleted file mode 100644
index b4b1c68..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStreamBase.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.orb.ORB;
-
-/**
- * Describes CDROutputStream delegates and provides some
- * implementation. Non-default constructors are avoided in
- * the delegation to separate instantiation from initialization,
- * so we use init methods.
- */
-abstract class CDROutputStreamBase extends java.io.OutputStream
-{
- protected CDROutputStream parent;
-
- // Required by parent CDROutputStream
- public void setParent(CDROutputStream parent) {
- this.parent = parent;
- }
-
- public void init(org.omg.CORBA.ORB orb,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion) {
- init(orb, false, bufferManager, streamFormatVersion, true);
- }
-
- // See EncapsOutputStream, the only one that uses the
- // non-pooled ByteBuffers, for additional info.
- protected abstract void init(org.omg.CORBA.ORB orb,
- boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion,
- boolean usePooledByteBuffers);
-
- public abstract void write_boolean(boolean value);
- public abstract void write_char(char value);
- public abstract void write_wchar(char value);
- public abstract void write_octet(byte value);
- public abstract void write_short(short value);
- public abstract void write_ushort(short value);
- public abstract void write_long(int value);
- public abstract void write_ulong(int value);
- public abstract void write_longlong(long value);
- public abstract void write_ulonglong(long value);
- public abstract void write_float(float value);
- public abstract void write_double(double value);
- public abstract void write_string(String value);
- public abstract void write_wstring(String value);
- public abstract void write_boolean_array(boolean[] value, int offset, int length);
- public abstract void write_char_array(char[] value, int offset, int length);
- public abstract void write_wchar_array(char[] value, int offset, int length);
- public abstract void write_octet_array(byte[] value, int offset, int length);
- public abstract void write_short_array(short[] value, int offset, int length);
- public abstract void write_ushort_array(short[] value, int offset, int length);
- public abstract void write_long_array(int[] value, int offset, int length);
- public abstract void write_ulong_array(int[] value, int offset, int length);
- public abstract void write_longlong_array(long[] value, int offset, int length);
- public abstract void write_ulonglong_array(long[] value, int offset, int length);
- public abstract void write_float_array(float[] value, int offset, int length);
- public abstract void write_double_array(double[] value, int offset, int length);
- public abstract void write_Object(org.omg.CORBA.Object value);
- public abstract void write_TypeCode(TypeCode value);
- public abstract void write_any(Any value);
- public abstract void write_Principal(Principal value);
- public void write(int b) throws java.io.IOException {
- throw new org.omg.CORBA.NO_IMPLEMENT();
- }
- public abstract void write_fixed(java.math.BigDecimal value);
- public void write_Context(org.omg.CORBA.Context ctx,
- org.omg.CORBA.ContextList contexts) {
- throw new org.omg.CORBA.NO_IMPLEMENT();
- }
-
- public abstract org.omg.CORBA.ORB orb();
-
- // org.omg.CORBA_2_3.portable.OutputStream
- public abstract void write_value(java.io.Serializable value);
- public abstract void write_value(java.io.Serializable value, java.lang.Class clz);
- public abstract void write_value(java.io.Serializable value, String repository_id);
- public abstract void write_value(java.io.Serializable value,
- org.omg.CORBA.portable.BoxedValueHelper factory);
- public abstract void write_abstract_interface(java.lang.Object obj);
-
- // java.io.OutputStream
-// public abstract void write(byte b[]) throws IOException;
-// public abstract void write(byte b[], int off, int len) throws IOException;
-// public abstract void flush() throws IOException;
-// public abstract void close() throws IOException;
-
- // com.sun.corba.se.impl.encoding.MarshalOutputStream
- public abstract void start_block();
- public abstract void end_block();
- public abstract void putEndian();
- public abstract void writeTo(java.io.OutputStream s)
- throws IOException;
- public abstract byte[] toByteArray();
-
- // org.omg.CORBA.DataOutputStream
- public abstract void write_Abstract (java.lang.Object value);
- public abstract void write_Value (java.io.Serializable value);
- public abstract void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length);
-
- // org.omg.CORBA.portable.ValueBase
- public abstract String[] _truncatable_ids();
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- abstract void setHeaderPadding(boolean headerPadding);
-
- // Required by IIOPOutputStream and other subclasses
- public abstract int getSize();
-
- public abstract int getIndex();
- public abstract void setIndex(int value);
-
- public abstract ByteBuffer getByteBuffer();
- public abstract void setByteBuffer(ByteBuffer byteBuffer);
-
- public abstract boolean isLittleEndian();
-
- public abstract ByteBufferWithInfo getByteBufferWithInfo();
- public abstract void setByteBufferWithInfo(ByteBufferWithInfo bbwi);
-
- public abstract BufferManagerWrite getBufferManager();
-
- public abstract void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale);
- public abstract void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s);
-
- public abstract GIOPVersion getGIOPVersion();
-
- public abstract void writeIndirection(int tag, int posIndirectedTo);
-
- abstract void freeInternalCaches();
-
- abstract void printBuffer();
-
- abstract void alignOnBoundary(int octetBoundary);
-
- // org.omg.CORBA.portable.ValueOutputStream
-
- public abstract void start_value(String rep_id);
-
- public abstract void end_value();
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java
deleted file mode 100644
index 3e60c48..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java
+++ /dev/null
@@ -1,1929 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.Serializable;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-import java.rmi.Remote;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-import java.util.Hashtable;
-import java.util.Stack;
-
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandler;
-import javax.rmi.CORBA.ValueHandlerMultiFormat;
-
-import org.omg.CORBA.CustomMarshal;
-import org.omg.CORBA.DataOutputStream;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.VM_CUSTOM;
-import org.omg.CORBA.VM_TRUNCATABLE;
-import org.omg.CORBA.VM_NONE;
-import org.omg.CORBA.portable.IDLEntity;
-import org.omg.CORBA.portable.CustomValue;
-import org.omg.CORBA.portable.StreamableValue;
-import org.omg.CORBA.portable.BoxedValueHelper;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.CORBA.portable.ValueBase;
-
-import com.sun.org.omg.CORBA.portable.ValueHelper;
-
-import com.sun.corba.se.pept.protocol.MessageMediator;
-import com.sun.corba.se.pept.transport.ByteBufferPool;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactories;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orb.ORBVersionFactory;
-import com.sun.corba.se.spi.orb.ORBVersion;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
-import com.sun.corba.se.impl.encoding.MarshalOutputStream;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.impl.orbutil.CacheTable;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.orbutil.RepositoryIdStrings;
-import com.sun.corba.se.impl.orbutil.RepositoryIdUtility;
-import com.sun.corba.se.impl.orbutil.RepositoryIdFactory;
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-public class CDROutputStream_1_0 extends CDROutputStreamBase
-{
- private static final int INDIRECTION_TAG = 0xffffffff;
-
- protected boolean littleEndian;
- protected BufferManagerWrite bufferManagerWrite;
- ByteBufferWithInfo bbwi;
-
- protected ORB orb;
- protected ORBUtilSystemException wrapper ;
-
- protected boolean debug = false;
-
- protected int blockSizeIndex = -1;
- protected int blockSizePosition = 0;
-
- protected byte streamFormatVersion;
-
- private static final int DEFAULT_BUFFER_SIZE = 1024;
- private static final String kWriteMethod = "write";
-
- // Codebase cache
- private CacheTable codebaseCache = null;
-
- // Value cache
- private CacheTable valueCache = null;
-
- // Repository ID cache
- private CacheTable repositoryIdCache = null;
-
- // Write end flag
- private int end_flag = 0;
-
- // Beginning with the resolution to interop issue 3526,
- // only enclosing chunked valuetypes are taken into account
- // when computing the nesting level. However, we still need
- // the old computation around for interoperability with our
- // older ORBs.
- private int chunkedValueNestingLevel = 0;
-
- private boolean mustChunk = false;
-
- // In block marker
- protected boolean inBlock = false;
-
- // Last end tag position
- private int end_flag_position = 0;
- private int end_flag_index = 0;
-
- // ValueHandler
- private ValueHandler valueHandler = null;
-
- // Repository ID handlers
- private RepositoryIdUtility repIdUtil;
- private RepositoryIdStrings repIdStrs;
-
- // Code set converters (created when first needed)
- private CodeSetConversion.CTBConverter charConverter;
- private CodeSetConversion.CTBConverter wcharConverter;
-
- // REVISIT - This should be re-factored so that including whether
- // to use pool byte buffers or not doesn't need to be known.
- public void init(org.omg.CORBA.ORB orb,
- boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion,
- boolean usePooledByteBuffers)
- {
- // ORB must not be null. See CDROutputStream constructor.
- this.orb = (ORB)orb;
- this.wrapper = ORBUtilSystemException.get( this.orb,
- CORBALogDomains.RPC_ENCODING ) ;
- debug = this.orb.transportDebugFlag;
-
- this.littleEndian = littleEndian;
- this.bufferManagerWrite = bufferManager;
- this.bbwi = new ByteBufferWithInfo(orb, bufferManager, usePooledByteBuffers);
- this.streamFormatVersion = streamFormatVersion;
-
- createRepositoryIdHandlers();
- }
-
- public void init(org.omg.CORBA.ORB orb,
- boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion)
- {
- init(orb, littleEndian, bufferManager, streamFormatVersion, true);
- }
-
- private final void createRepositoryIdHandlers()
- {
- repIdUtil = RepositoryIdFactory.getRepIdUtility();
- repIdStrs = RepositoryIdFactory.getRepIdStringsFactory();
- }
-
- public BufferManagerWrite getBufferManager()
- {
- return bufferManagerWrite;
- }
-
- public byte[] toByteArray() {
- byte[] it;
-
- it = new byte[bbwi.position()];
-
- // Micro-benchmarks show ByteBuffer.get(int) out perform the bulk
- // ByteBuffer.get(byte[], offset, length).
- for (int i = 0; i < bbwi.position(); i++)
- it[i] = bbwi.byteBuffer.get(i);
-
- return it;
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_0;
- }
-
- // Called by Request and Reply message. Valid for GIOP versions >= 1.2 only.
- // Illegal for GIOP versions < 1.2.
- void setHeaderPadding(boolean headerPadding) {
- throw wrapper.giopVersionError();
- }
-
- protected void handleSpecialChunkBegin(int requiredSize)
- {
- // No-op for GIOP 1.0
- }
-
- protected void handleSpecialChunkEnd()
- {
- // No-op for GIOP 1.0
- }
-
- protected final int computeAlignment(int align) {
- if (align > 1) {
- int incr = bbwi.position() & (align - 1);
- if (incr != 0)
- return align - incr;
- }
-
- return 0;
- }
-
- protected void alignAndReserve(int align, int n) {
-
- bbwi.position(bbwi.position() + computeAlignment(align));
-
- if (bbwi.position() + n > bbwi.buflen)
- grow(align, n);
- }
-
- //
- // Default implementation of grow. Subclassers may override this.
- // Always grow the single buffer. This needs to delegate
- // fragmentation policy for IIOP 1.1.
- //
- protected void grow(int align, int n)
- {
- bbwi.needed = n;
-
- bufferManagerWrite.overflow(bbwi);
- }
-
- public final void putEndian() throws SystemException {
- write_boolean(littleEndian);
- }
-
- public final boolean littleEndian() {
- return littleEndian;
- }
-
- void freeInternalCaches() {
- if (codebaseCache != null)
- codebaseCache.done();
-
- if (valueCache != null)
- valueCache.done();
-
- if (repositoryIdCache != null)
- repositoryIdCache.done();
- }
-
- // No such type in java
- public final void write_longdouble(double x)
- {
- throw wrapper.longDoubleNotImplemented(
- CompletionStatus.COMPLETED_MAYBE ) ;
- }
-
- public void write_octet(byte x)
- {
- // The 'if' stmt is commented out since we need the alignAndReserve to
- // be called, particularly when the first body byte is written,
- // to induce header padding to align the body on a 8-octet boundary,
- // for GIOP versions 1.2 and above. Refer to internalWriteOctetArray()
- // method that also has a similar change.
- //if (bbwi.position() + 1 > bbwi.buflen)
- alignAndReserve(1, 1);
-
-// REVISIT - Should just use ByteBuffer.put(byte) and let it
-// increment the ByteBuffer position. This is true
-// for all write operations in this file.
-
- bbwi.byteBuffer.put(bbwi.position(), x);
- bbwi.position(bbwi.position() + 1);
-
- }
-
- public final void write_boolean(boolean x)
- {
- write_octet(x? (byte)1:(byte)0);
- }
-
- public void write_char(char x)
- {
- CodeSetConversion.CTBConverter converter = getCharConverter();
-
- converter.convert(x);
-
- // CORBA formal 99-10-07 15.3.1.6: "In the case of multi-byte encodings
- // of characters, a single instance of the char type may only
- // hold one octet of any multi-byte character encoding."
- if (converter.getNumBytes() > 1)
- throw wrapper.invalidSingleCharCtb(CompletionStatus.COMPLETED_MAYBE);
-
- write_octet(converter.getBytes()[0]);
- }
-
- // These wchar methods are only used when talking to
- // legacy ORBs, now.
- private final void writeLittleEndianWchar(char x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF));
- bbwi.position(bbwi.position() + 2);
- }
-
- private final void writeBigEndianWchar(char x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 8) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)(x & 0xFF));
- bbwi.position(bbwi.position() + 2);
- }
-
- private final void writeLittleEndianShort(short x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF));
- bbwi.position(bbwi.position() + 2);
- }
-
- private final void writeBigEndianShort(short x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 8) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)(x & 0xFF));
- bbwi.position(bbwi.position() + 2);
- }
-
- private final void writeLittleEndianLong(int x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 16) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 3, (byte)((x >>> 24) & 0xFF));
- bbwi.position(bbwi.position() + 4);
- }
-
- private final void writeBigEndianLong(int x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 24) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 16) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 8) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 3, (byte)(x & 0xFF));
- bbwi.position(bbwi.position() + 4);
- }
-
- private final void writeLittleEndianLongLong(long x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 16) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 3, (byte)((x >>> 24) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 4, (byte)((x >>> 32) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 5, (byte)((x >>> 40) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 6, (byte)((x >>> 48) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 7, (byte)((x >>> 56) & 0xFF));
- bbwi.position(bbwi.position() + 8);
- }
-
- private final void writeBigEndianLongLong(long x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 56) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 48) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 40) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 3, (byte)((x >>> 32) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 4, (byte)((x >>> 24) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 5, (byte)((x >>> 16) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 6, (byte)((x >>> 8) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 7, (byte)(x & 0xFF));
- bbwi.position(bbwi.position() + 8);
- }
-
- public void write_wchar(char x)
- {
- // Don't allow transmission of wchar/wstring data with
- // foreign ORBs since it's against the spec.
- if (ORBUtility.isForeignORB(orb)) {
- throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE);
- }
-
- // If it's one of our legacy ORBs, do what they did:
- alignAndReserve(2, 2);
-
- if (littleEndian) {
- writeLittleEndianWchar(x);
- } else {
- writeBigEndianWchar(x);
- }
- }
-
- public void write_short(short x)
- {
- alignAndReserve(2, 2);
-
- if (littleEndian) {
- writeLittleEndianShort(x);
- } else {
- writeBigEndianShort(x);
- }
- }
-
- public final void write_ushort(short x)
- {
- write_short(x);
- }
-
- public void write_long(int x)
- {
- alignAndReserve(4, 4);
-
- if (littleEndian) {
- writeLittleEndianLong(x);
- } else {
- writeBigEndianLong(x);
- }
- }
-
- public final void write_ulong(int x)
- {
- write_long(x);
- }
-
- public void write_longlong(long x)
- {
- alignAndReserve(8, 8);
-
- if (littleEndian) {
- writeLittleEndianLongLong(x);
- } else {
- writeBigEndianLongLong(x);
- }
- }
-
- public final void write_ulonglong(long x)
- {
- write_longlong(x);
- }
-
- public final void write_float(float x)
- {
- write_long(Float.floatToIntBits(x));
- }
-
- public final void write_double(double x)
- {
- write_longlong(Double.doubleToLongBits(x));
- }
-
- public void write_string(String value)
- {
- writeString(value);
- }
-
- protected int writeString(String value)
- {
- if (value == null) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
-
- CodeSetConversion.CTBConverter converter = getCharConverter();
-
- converter.convert(value);
-
- // A string is encoded as an unsigned CORBA long for the
- // number of bytes to follow (including a terminating null).
- // There is only one octet per character in the string.
- int len = converter.getNumBytes() + 1;
-
- handleSpecialChunkBegin(computeAlignment(4) + 4 + len);
-
- write_long(len);
- int indirection = get_offset() - 4;
-
- internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes());
-
- // Write the null ending
- write_octet((byte)0);
-
- handleSpecialChunkEnd();
- return indirection;
- }
-
- public void write_wstring(String value)
- {
- if (value == null)
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // Don't allow transmission of wchar/wstring data with
- // foreign ORBs since it's against the spec.
- if (ORBUtility.isForeignORB(orb)) {
- throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE);
- }
-
- // When talking to our legacy ORBs, do what they did:
- int len = value.length() + 1;
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(4 + (len * 2) + computeAlignment(4));
-
- write_long(len);
-
- for (int i = 0; i < len - 1; i++)
- write_wchar(value.charAt(i));
-
- // Write the null ending
- write_short((short)0);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- // Performs no checks and doesn't tamper with chunking
- void internalWriteOctetArray(byte[] value, int offset, int length)
- {
- int n = offset;
-
- // This flag forces the alignAndReserve method to be called the
- // first time an octet is written. This is necessary to ensure
- // that the body is aligned on an 8-octet boundary. Note the 'if'
- // condition inside the 'while' loop below. Also, refer to the
- // write_octet() method that has a similar change.
- boolean align = true;
-
- while (n < length+offset) {
- int avail;
- int bytes;
- int wanted;
-
- if ((bbwi.position() + 1 > bbwi.buflen) || align) {
- align = false;
- alignAndReserve(1, 1);
- }
- avail = bbwi.buflen - bbwi.position();
- wanted = (length + offset) - n;
- bytes = (wanted < avail) ? wanted : avail;
- for (int i = 0; i < bytes; i++)
- bbwi.byteBuffer.put(bbwi.position() + i, value[n+i]);
- bbwi.position(bbwi.position() + bytes);
- n += bytes;
- }
- }
-
- public final void write_octet_array(byte b[], int offset, int length)
- {
- if ( b == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(length);
-
- internalWriteOctetArray(b, offset, length);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public void write_Principal(Principal p)
- {
- write_long(p.name().length);
- write_octet_array(p.name(), 0, p.name().length);
- }
-
- public void write_any(Any any)
- {
- if ( any == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- write_TypeCode(any.type());
- any.write_value(parent);
- }
-
- public void write_TypeCode(TypeCode tc)
- {
- if ( tc == null ) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
- TypeCodeImpl tci;
- if (tc instanceof TypeCodeImpl) {
- tci = (TypeCodeImpl)tc;
- }
- else {
- tci = new TypeCodeImpl(orb, tc);
- }
-
- tci.write_value((org.omg.CORBA_2_3.portable.OutputStream)parent);
- }
-
- public void write_Object(org.omg.CORBA.Object ref)
- {
- if (ref == null) {
- IOR nullIOR = IORFactories.makeIOR( orb ) ;
- nullIOR.write(parent);
- return;
- }
-
- // IDL to Java formal 01-06-06 1.21.4.2
- if (ref instanceof org.omg.CORBA.LocalObject)
- throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE);
-
- IOR ior = ORBUtility.connectAndGetIOR( orb, ref ) ;
- ior.write(parent);
- return;
- }
-
- // ------------ RMI related methods --------------------------
-
- public void write_abstract_interface(java.lang.Object obj) {
- boolean corbaObject = false; // Assume value type.
- org.omg.CORBA.Object theObject = null;
-
- // Is it a CORBA.Object?
-
- if (obj != null && obj instanceof org.omg.CORBA.Object) {
-
- // Yes.
-
- theObject = (org.omg.CORBA.Object)obj;
- corbaObject = true;
- }
-
- // Write our flag...
-
- write_boolean(corbaObject);
-
- // Now write out the object...
-
- if (corbaObject) {
- write_Object(theObject);
- } else {
- try {
- write_value((java.io.Serializable)obj);
- } catch(ClassCastException cce) {
- if (obj instanceof java.io.Serializable)
- throw cce;
- else
- ORBUtility.throwNotSerializableForCorba(obj.getClass().getName());
- }
- }
- }
-
- public void write_value(Serializable object, Class clz) {
-
- write_value(object);
- }
-
- private void writeWStringValue(String string) {
-
- int indirection = writeValueTag(mustChunk, true, null);
-
- // Write WStringValue's repository ID
- write_repositoryId(repIdStrs.getWStringValueRepId());
-
- // Add indirection for object to indirection table
- updateIndirectionTable(indirection, string, string);
-
- // Write Value chunk
- if (mustChunk) {
- start_block();
- end_flag--;
- chunkedValueNestingLevel--;
- } else
- end_flag--;
-
- write_wstring(string);
-
- if (mustChunk)
- end_block();
-
- // Write end tag
- writeEndTag(mustChunk);
- }
-
- private void writeArray(Serializable array, Class clazz) {
-
- if (valueHandler == null)
- valueHandler = ORBUtility.createValueHandler(); //d11638
-
- // Write value_tag
- int indirection = writeValueTag(mustChunk, true,
- Util.getCodebase(clazz));
-
- // Write repository ID
- write_repositoryId(repIdStrs.createSequenceRepID(clazz));
-
- // Add indirection for object to indirection table
- updateIndirectionTable(indirection, array, array);
-
- // Write Value chunk
- if (mustChunk) {
- start_block();
- end_flag--;
- chunkedValueNestingLevel--;
- } else
- end_flag--;
-
- if (valueHandler instanceof ValueHandlerMultiFormat) {
- ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
- vh.writeValue(parent, array, streamFormatVersion);
- } else
- valueHandler.writeValue(parent, array);
-
- if (mustChunk)
- end_block();
-
- // Write end tag
- writeEndTag(mustChunk);
- }
-
- private void writeValueBase(org.omg.CORBA.portable.ValueBase object,
- Class clazz) {
- // _REVISIT_ could check to see whether chunking really needed
- mustChunk = true;
-
- // Write value_tag
- int indirection = writeValueTag(true, true, Util.getCodebase(clazz));
-
- // Get rep id
- String repId = ((ValueBase)object)._truncatable_ids()[0];
-
- // Write rep id
- write_repositoryId(repId);
-
- // Add indirection for object to indirection table
- updateIndirectionTable(indirection, object, object);
-
- // Write Value chunk
- start_block();
- end_flag--;
- chunkedValueNestingLevel--;
- writeIDLValue(object, repId);
- end_block();
-
- // Write end tag
- writeEndTag(true);
- }
-
- private void writeRMIIIOPValueType(Serializable object, Class clazz) {
- if (valueHandler == null)
- valueHandler = ORBUtility.createValueHandler(); //d11638
-
- Serializable key = object;
-
- // Allow the ValueHandler to call writeReplace on
- // the Serializable (if the method is present)
- object = valueHandler.writeReplace(key);
-
- if (object == null) {
- // Write null tag and return
- write_long(0);
- return;
- }
-
- if (object != key) {
- if (valueCache != null && valueCache.containsKey(object)) {
- writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
- return;
- }
-
- clazz = object.getClass();
- }
-
- if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
- mustChunk = true;
- }
-
- // Write value_tag
- int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));
-
- // Write rep. id
- write_repositoryId(repIdStrs.createForJavaType(clazz));
-
- // Add indirection for object to indirection table
- updateIndirectionTable(indirection, object, key);
-
- if (mustChunk) {
- // Write Value chunk
- end_flag--;
- chunkedValueNestingLevel--;
- start_block();
- } else
- end_flag--;
-
- if (valueHandler instanceof ValueHandlerMultiFormat) {
- ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
- vh.writeValue(parent, object, streamFormatVersion);
- } else
- valueHandler.writeValue(parent, object);
-
- if (mustChunk)
- end_block();
-
- // Write end tag
- writeEndTag(mustChunk);
- }
-
- public void write_value(Serializable object, String repository_id) {
-
- // Handle null references
- if (object == null) {
- // Write null tag and return
- write_long(0);
- return;
- }
-
- // Handle shared references
- if (valueCache != null && valueCache.containsKey(object)) {
- writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
- return;
- }
-
- Class clazz = object.getClass();
- boolean oldMustChunk = mustChunk;
-
- if (mustChunk)
- mustChunk = true;
-
- if (inBlock)
- end_block();
-
- if (clazz.isArray()) {
- // Handle arrays
- writeArray(object, clazz);
- } else if (object instanceof org.omg.CORBA.portable.ValueBase) {
- // Handle IDL Value types
- writeValueBase((org.omg.CORBA.portable.ValueBase)object, clazz);
- } else if (shouldWriteAsIDLEntity(object)) {
- writeIDLEntity((IDLEntity)object);
- } else if (object instanceof java.lang.String) {
- writeWStringValue((String)object);
- } else if (object instanceof java.lang.Class) {
- writeClass(repository_id, (Class)object);
- } else {
- // RMI-IIOP value type
- writeRMIIIOPValueType(object, clazz);
- }
-
- mustChunk = oldMustChunk;
-
- // Check to see if we need to start another block for a
- // possible outer value
- if (mustChunk)
- start_block();
-
- }
-
- public void write_value(Serializable object)
- {
- write_value(object, (String)null);
- }
-
- public void write_value(Serializable object, org.omg.CORBA.portable.BoxedValueHelper factory)
- {
- // Handle null references
- if (object == null) {
- // Write null tag and return
- write_long(0);
- return;
- }
-
- // Handle shared references
- if ((valueCache != null) && valueCache.containsKey(object)) {
- writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
- return;
- }
-
- boolean oldMustChunk = mustChunk;
-
- boolean isCustom = false;
- if (factory instanceof ValueHelper) {
- short modifier;
- try {
- modifier = ((ValueHelper)factory).get_type().type_modifier();
- } catch(BadKind ex) { // tk_value_box
- modifier = VM_NONE.value;
- }
- if (object instanceof CustomMarshal &&
- modifier == VM_CUSTOM.value) {
- isCustom = true;
- mustChunk = true;
- }
- if (modifier == VM_TRUNCATABLE.value)
- mustChunk = true;
- }
-
- if (mustChunk) {
-
- if (inBlock)
- end_block();
-
- // Write value_tag
- int indirection = writeValueTag(true,
- orb.getORBData().useRepId(),
- Util.getCodebase(object.getClass())
- );
-
- if (orb.getORBData().useRepId()) {
- write_repositoryId(factory.get_id());
- }
-
- // Add indirection for object to indirection table
- updateIndirectionTable(indirection, object, object);
-
- // Write Value chunk
- start_block();
- end_flag--;
- chunkedValueNestingLevel--;
- if (isCustom)
- ((CustomMarshal)object).marshal(parent);
- else
- factory.write_value(parent, object);
- end_block();
-
- // Write end tag
- writeEndTag(true);
- }
- else {
- // Write value_tag
- int indirection = writeValueTag(false,
- orb.getORBData().useRepId(),
- Util.getCodebase(object.getClass())
- );
-
- if (orb.getORBData().useRepId()) {
- write_repositoryId(factory.get_id());
- }
-
- // Add indirection for object to indirection table
- updateIndirectionTable(indirection, object, object);
-
- // Write Value chunk
- end_flag--;
- // no need to test for custom on the non-chunked path
- factory.write_value(parent, object);
-
- // Write end tag
- writeEndTag(false);
- }
-
- mustChunk = oldMustChunk;
-
- // Check to see if we need to start another block for a
- // possible outer value
- if (mustChunk)
- start_block();
-
- }
-
- public int get_offset() {
- return bbwi.position();
- }
-
- public void start_block() {
- if (debug) {
- dprint("CDROutputStream_1_0 start_block, position" + bbwi.position());
- }
-
- //Move inBlock=true to after write_long since write_long might
- //trigger grow which will lead to erroneous behavior with a
- //missing blockSizeIndex.
- //inBlock = true;
-
- // Save space in the buffer for block size
- write_long(0);
-
- //Has to happen after write_long since write_long could
- //trigger grow which is overridden by supper classes to
- //depend on inBlock.
- inBlock = true;
-
- blockSizePosition = get_offset();
-
- // Remember where to put the size of the endblock less 4
- blockSizeIndex = bbwi.position();
-
- if (debug) {
- dprint("CDROutputStream_1_0 start_block, blockSizeIndex "
- + blockSizeIndex);
- }
-
- }
-
- // Utility method which will hopefully decrease chunking complexity
- // by allowing us to end_block and update chunk lengths without
- // calling alignAndReserve. Otherwise, it's possible to get into
- // recursive scenarios which lose the chunking state.
- protected void writeLongWithoutAlign(int x) {
- if (littleEndian) {
- writeLittleEndianLong(x);
- } else {
- writeBigEndianLong(x);
- }
- }
-
- public void end_block() {
- if (debug) {
- dprint("CDROutputStream_1_0.java end_block");
- }
-
- if (!inBlock)
- return;
-
- if (debug) {
- dprint("CDROutputStream_1_0.java end_block, in a block");
- }
-
- inBlock = false;
-
- // Test to see if the block was of zero length
- // If so, remove the block instead of ending it
- // (This can happen if the last field written
- // in a value was another value)
- if (get_offset() == blockSizePosition) {
- // Need to assert that blockSizeIndex == bbwi.position()? REVISIT
-
- bbwi.position(bbwi.position() - 4);
- blockSizeIndex = -1;
- blockSizePosition = -1;
- return;
- }
-
- int oldSize = bbwi.position();
- bbwi.position(blockSizeIndex - 4);
-
- writeLongWithoutAlign(oldSize - blockSizeIndex);
-
- bbwi.position(oldSize);
- blockSizeIndex = -1;
- blockSizePosition = -1;
-
- // System.out.println(" post end_block: " + get_offset() + " " + bbwi.position());
- }
-
- public org.omg.CORBA.ORB orb()
- {
- return orb;
- }
-
- // ------------ End RMI related methods --------------------------
-
- public final void write_boolean_array(boolean[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(length);
-
- for (int i = 0; i < length; i++)
- write_boolean(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public final void write_char_array(char[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(length);
-
- for (int i = 0; i < length; i++)
- write_char(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public void write_wchar_array(char[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(computeAlignment(2) + (length * 2));
-
- for (int i = 0; i < length; i++)
- write_wchar(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public final void write_short_array(short[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(computeAlignment(2) + (length * 2));
-
- for (int i = 0; i < length; i++)
- write_short(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public final void write_ushort_array(short[]value, int offset, int length) {
- write_short_array(value, offset, length);
- }
-
- public final void write_long_array(int[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(computeAlignment(4) + (length * 4));
-
- for (int i = 0; i < length; i++)
- write_long(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public final void write_ulong_array(int[]value, int offset, int length) {
- write_long_array(value, offset, length);
- }
-
- public final void write_longlong_array(long[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(computeAlignment(8) + (length * 8));
-
- for (int i = 0; i < length; i++)
- write_longlong(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public final void write_ulonglong_array(long[]value, int offset, int length) {
- write_longlong_array(value, offset, length);
- }
-
- public final void write_float_array(float[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(computeAlignment(4) + (length * 4));
-
- for (int i = 0; i < length; i++)
- write_float(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public final void write_double_array(double[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(computeAlignment(8) + (length * 8));
-
- for (int i = 0; i < length; i++)
- write_double(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public void write_string_array(String[] value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- for(int i = 0; i < length; i++)
- write_string(value[offset + i]);
- }
-
- public void write_wstring_array(String[] value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- for(int i = 0; i < length; i++)
- write_wstring(value[offset + i]);
- }
-
- public final void write_any_array(org.omg.CORBA.Any value[], int offset, int length)
- {
- for(int i = 0; i < length; i++)
- write_any(value[offset + i]);
- }
-
- //--------------------------------------------------------------------//
- // CDROutputStream state management.
- //
-
- public void writeTo(java.io.OutputStream s)
- throws java.io.IOException
- {
- byte[] tmpBuf = null;
-
- if (bbwi.byteBuffer.hasArray())
- {
- tmpBuf = bbwi.byteBuffer.array();
- }
- else
- {
- int size = bbwi.position();
- tmpBuf = new byte[size];
- // Micro-benchmarks are showing a loop of ByteBuffer.get(int) is
- // faster than ByteBuffer.get(byte[], offset, length)
- for (int i = 0; i < size; i++)
- tmpBuf[i] = bbwi.byteBuffer.get(i);
- }
-
- s.write(tmpBuf, 0, bbwi.position());
- }
-
- public void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) {
-
- byte[] buf = null;
-
- if (bbwi.byteBuffer.hasArray())
- {
- buf = bbwi.byteBuffer.array();
- }
- else
- {
- int size = bbwi.position();
- buf = new byte[size];
- // Micro-benchmarks are showing a loop of ByteBuffer.get(int) is
- // faster than ByteBuffer.get(byte[], offset, length)
- for (int i = 0; i < size; i++)
- buf[i] = bbwi.byteBuffer.get(i);
- }
-
- s.write_long(bbwi.position());
- s.write_octet_array(buf, 0, bbwi.position());
-
- }
-
- public final int getSize() {
- return bbwi.position();
- }
-
- public int getIndex() {
- return bbwi.position();
- }
-
- public boolean isLittleEndian() {
- return littleEndian;
- }
-
- public void setIndex(int value) {
- bbwi.position(value);
- }
-
- public ByteBufferWithInfo getByteBufferWithInfo() {
- return bbwi;
- }
-
- public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- this.bbwi = bbwi;
- }
-
- public ByteBuffer getByteBuffer() {
- ByteBuffer result = null;;
- if (bbwi != null) {
- result = bbwi.byteBuffer;
- }
- return result;
- }
-
- public void setByteBuffer(ByteBuffer byteBuffer) {
- bbwi.byteBuffer = byteBuffer;
- }
-
- private final void updateIndirectionTable(int indirection, java.lang.Object object,
- java.lang.Object key) {
- // int indirection = get_offset();
- if (valueCache == null)
- valueCache = new CacheTable(orb,true);
- valueCache.put(object, indirection);
- if (key != object)
- valueCache.put(key, indirection);
- }
-
- private final void write_repositoryId(String id) {
- // Use an indirection if available
- if (repositoryIdCache != null && repositoryIdCache.containsKey(id)) {
- writeIndirection(INDIRECTION_TAG, repositoryIdCache.getVal(id));
- return;
- }
-
- // Write it as a string. Note that we have already done the
- // special case conversion of non-Latin-1 characters to escaped
- // Latin-1 sequences in RepositoryId.
-
- // It's not a good idea to cache them now that we can have
- // multiple code sets.
- int indirection = writeString(id);
-
- // Add indirection for id to indirection table
- if (repositoryIdCache == null)
- repositoryIdCache = new CacheTable(orb,true);
- repositoryIdCache.put(id, indirection);
- }
-
- private void write_codebase(String str, int pos) {
- if (codebaseCache != null && codebaseCache.containsKey(str)) {
- writeIndirection(INDIRECTION_TAG, codebaseCache.getVal(str));
- }
- else {
- write_string(str);
- if (codebaseCache == null)
- codebaseCache = new CacheTable(orb,true);
- codebaseCache.put(str, pos);
- }
- }
-
- private final int writeValueTag(boolean chunkIt, boolean useRepId,
- String codebase) {
- int indirection = 0;
- if (chunkIt && !useRepId){
- if (codebase == null) {
- write_long(repIdUtil.getStandardRMIChunkedNoRepStrId());
- indirection = get_offset() - 4;
- } else {
- write_long(repIdUtil.getCodeBaseRMIChunkedNoRepStrId());
- indirection = get_offset() - 4;
- write_codebase(codebase, get_offset());
- }
- } else if (chunkIt && useRepId){
- if (codebase == null) {
- write_long(repIdUtil.getStandardRMIChunkedId());
- indirection = get_offset() - 4;
- } else {
- write_long(repIdUtil.getCodeBaseRMIChunkedId());
- indirection = get_offset() - 4;
- write_codebase(codebase, get_offset());
- }
- } else if (!chunkIt && !useRepId) {
- if (codebase == null) {
- write_long(repIdUtil.getStandardRMIUnchunkedNoRepStrId());
- indirection = get_offset() - 4;
- } else {
- write_long(repIdUtil.getCodeBaseRMIUnchunkedNoRepStrId());
- indirection = get_offset() - 4;
- write_codebase(codebase, get_offset());
- }
- } else if (!chunkIt && useRepId) {
- if (codebase == null) {
- write_long(repIdUtil.getStandardRMIUnchunkedId());
- indirection = get_offset() - 4;
- } else {
- write_long(repIdUtil.getCodeBaseRMIUnchunkedId());
- indirection = get_offset() - 4;
- write_codebase(codebase, get_offset());
- }
- }
- return indirection;
- }
-
- private void writeIDLValue(Serializable object, String repID)
- {
- if (object instanceof StreamableValue) {
- ((StreamableValue)object)._write(parent);
-
- } else if (object instanceof CustomValue) {
- ((CustomValue)object).marshal(parent);
-
- } else {
- BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
- boolean isCustom = false;
- if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
- try {
- if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
- isCustom = true;
- } catch(BadKind ex) {
- throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
- ex ) ;
- }
- }
- if (isCustom)
- ((CustomMarshal)object).marshal(parent);
- else
- helper.write_value(parent, object);
- }
- }
-
- // Handles end tag compaction...
- private void writeEndTag(boolean chunked){
-
- if (chunked) {
- if (get_offset() == end_flag_position) {
-
- if (bbwi.position() == end_flag_index) {
-
- // We are exactly at the same position and index as the
- // end of the last end tag. Thus, we can back up over it
- // and compact the tags.
- bbwi.position(bbwi.position() - 4);
-
- } else {
-
- // Special case in which we're at the beginning of a new
- // fragment, but the position is the same. We can't back up,
- // so we just write the new end tag without compaction. This
- // occurs when a value ends and calls start_block to open a
- // continuation chunk, but it's called at the very end of
- // a fragment.
- }
- }
-
- writeNestingLevel();
-
- // Remember the last index and position. These are only used when chunking.
- end_flag_index = bbwi.position();
- end_flag_position = get_offset();
-
- chunkedValueNestingLevel++;
- }
-
- // Increment the nesting level
- end_flag++;
- }
-
- /**
- * Handles ORB versioning of the end tag. Should only
- * be called if chunking.
- *
- * If talking to our older ORBs (Standard Extension,
- * Kestrel, and Ladybird), write the end flag that takes
- * into account all enclosing valuetypes.
- *
- * If talking a newer or foreign ORB, or if the orb
- * instance is null, write the end flag that only takes
- * into account the enclosing chunked valuetypes.
- */
- private void writeNestingLevel() {
- if (orb == null ||
- ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
- ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {
-
- write_long(chunkedValueNestingLevel);
-
- } else {
- write_long(end_flag);
- }
- }
-
- private void writeClass(String repository_id, Class clz) {
-
- if (repository_id == null)
- repository_id = repIdStrs.getClassDescValueRepId();
-
- // Write value_tag
- int indirection = writeValueTag(mustChunk, true, null);
- updateIndirectionTable(indirection, clz, clz);
-
- write_repositoryId(repository_id);
-
- if (mustChunk) {
- // Write Value chunk
- start_block();
- end_flag--;
- chunkedValueNestingLevel--;
- } else
- end_flag--;
-
- writeClassBody(clz);
-
- if (mustChunk)
- end_block();
-
- // Write end tag
- writeEndTag(mustChunk);
- }
-
- // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
- // and codebase strings in the wrong order. This handles
- // backwards compatibility.
- private void writeClassBody(Class clz) {
- if (orb == null ||
- ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
- ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {
-
- write_value(Util.getCodebase(clz));
- write_value(repIdStrs.createForAnyType(clz));
- } else {
-
- write_value(repIdStrs.createForAnyType(clz));
- write_value(Util.getCodebase(clz));
- }
- }
-
- // Casts and returns an Object as a Serializable
- // This is required for JDK 1.1 only to avoid VerifyErrors when
- // passing arrays as Serializable
- // private java.io.Serializable make_serializable(java.lang.Object object)
- // {
- // return (java.io.Serializable)object;
- // }
-
- private boolean shouldWriteAsIDLEntity(Serializable object)
- {
- return ((object instanceof IDLEntity) && (!(object instanceof ValueBase)) &&
- (!(object instanceof org.omg.CORBA.Object)));
-
- }
-
- private void writeIDLEntity(IDLEntity object) {
-
- // _REVISIT_ could check to see whether chunking really needed
- mustChunk = true;
-
- String repository_id = repIdStrs.createForJavaType(object);
- Class clazz = object.getClass();
- String codebase = Util.getCodebase(clazz);
-
- // Write value_tag
- int indirection = writeValueTag(true, true, codebase);
- updateIndirectionTable(indirection, object, object);
-
- // Write rep. id
- write_repositoryId(repository_id);
-
- // Write Value chunk
- end_flag--;
- chunkedValueNestingLevel--;
- start_block();
-
- // Write the IDLEntity using reflection
- try {
- ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader());
- final Class helperClass = Utility.loadClassForClass(clazz.getName()+"Helper", codebase,
- clazzLoader, clazz, clazzLoader);
- final Class argTypes[] = {org.omg.CORBA.portable.OutputStream.class, clazz};
- // getDeclaredMethod requires RuntimePermission accessDeclaredMembers
- // if a different class loader is used (even though the javadoc says otherwise)
- Method writeMethod = null;
- try {
- writeMethod = (Method)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public java.lang.Object run() throws NoSuchMethodException {
- return helperClass.getDeclaredMethod(kWriteMethod, argTypes);
- }
- }
- );
- } catch (PrivilegedActionException pae) {
- // this gets caught below
- throw (NoSuchMethodException)pae.getException();
- }
- java.lang.Object args[] = {parent, object};
- writeMethod.invoke(null, args);
- } catch (ClassNotFoundException cnfe) {
- throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, cnfe ) ;
- } catch(NoSuchMethodException nsme) {
- throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, nsme ) ;
- } catch(IllegalAccessException iae) {
- throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, iae ) ;
- } catch(InvocationTargetException ite) {
- throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, ite ) ;
- }
- end_block();
-
- // Write end tag
- writeEndTag(true);
- }
-
- /* DataOutputStream methods */
-
- public void write_Abstract (java.lang.Object value) {
- write_abstract_interface(value);
- }
-
- public void write_Value (java.io.Serializable value) {
- write_value(value);
- }
-
- // This will stay a custom add-on until the java-rtf issue is resolved.
- // Then it should be declared in org.omg.CORBA.portable.OutputStream.
- //
- // Pads the string representation of bigDecimal with zeros to fit the given
- // digits and scale before it gets written to the stream.
- public void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale) {
- String string = bigDecimal.toString();
- String integerPart;
- String fractionPart;
- StringBuffer stringBuffer;
-
- // Get rid of the sign
- if (string.charAt(0) == '-' || string.charAt(0) == '+') {
- string = string.substring(1);
- }
-
- // Determine integer and fraction parts
- int dotIndex = string.indexOf('.');
- if (dotIndex == -1) {
- integerPart = string;
- fractionPart = null;
- } else if (dotIndex == 0 ) {
- integerPart = null;
- fractionPart = string;
- } else {
- integerPart = string.substring(0, dotIndex);
- fractionPart = string.substring(dotIndex + 1);
- }
-
- // Pad both parts with zeros as necessary
- stringBuffer = new StringBuffer(digits);
- if (fractionPart != null) {
- stringBuffer.append(fractionPart);
- }
- while (stringBuffer.length() < scale) {
- stringBuffer.append('0');
- }
- if (integerPart != null) {
- stringBuffer.insert(0, integerPart);
- }
- while (stringBuffer.length() < digits) {
- stringBuffer.insert(0, '0');
- }
-
- // This string contains no sign or dot
- this.write_fixed(stringBuffer.toString(), bigDecimal.signum());
- }
-
- // This method should be remove by the java-rtf issue.
- // Right now the scale and digits information of the type code is lost.
- public void write_fixed(java.math.BigDecimal bigDecimal) {
- // This string might contain sign and/or dot
- this.write_fixed(bigDecimal.toString(), bigDecimal.signum());
- }
-
- // The string may contain a sign and dot
- public void write_fixed(String string, int signum) {
- int stringLength = string.length();
- // Each octet contains (up to) two decimal digits
- byte doubleDigit = 0;
- char ch;
- byte digit;
-
- // First calculate the length of the string without optional sign and dot
- int numDigits = 0;
- for (int i=0; i<stringLength; i++) {
- ch = string.charAt(i);
- if (ch == '-' || ch == '+' || ch == '.')
- continue;
- numDigits++;
- }
- for (int i=0; i<stringLength; i++) {
- ch = string.charAt(i);
- if (ch == '-' || ch == '+' || ch == '.')
- continue;
- digit = (byte)Character.digit(ch, 10);
- if (digit == -1) {
- throw wrapper.badDigitInFixed( CompletionStatus.COMPLETED_MAYBE ) ;
- }
- // If the fixed type has an odd number of decimal digits,
- // then the representation begins with the first (most significant) digit.
- // Otherwise, this first half-octet is all zero, and the first digit
- // is in the second half-octet.
- if (numDigits % 2 == 0) {
- doubleDigit |= digit;
- this.write_octet(doubleDigit);
- doubleDigit = 0;
- } else {
- doubleDigit |= (digit << 4);
- }
- numDigits--;
- }
- // The sign configuration, in the last half-octet of the representation,
- // is 0xD for negative numbers and 0xC for positive and zero values
- if (signum == -1) {
- doubleDigit |= 0xd;
- } else {
- doubleDigit |= 0xc;
- }
- this.write_octet(doubleDigit);
- }
-
- private final static String _id = "IDL:omg.org/CORBA/DataOutputStream:1.0";
- private final static String[] _ids = { _id };
-
- public String[] _truncatable_ids() {
- if (_ids == null)
- return null;
-
- return (String[])_ids.clone();
- }
-
- /* for debugging */
-
- public void printBuffer() {
- CDROutputStream_1_0.printBuffer(this.bbwi);
- }
-
- public static void printBuffer(ByteBufferWithInfo bbwi) {
-
- System.out.println("+++++++ Output Buffer ++++++++");
- System.out.println();
- System.out.println("Current position: " + bbwi.position());
- System.out.println("Total length : " + bbwi.buflen);
- System.out.println();
-
- char[] charBuf = new char[16];
-
- try {
-
- for (int i = 0; i < bbwi.position(); i += 16) {
-
- int j = 0;
-
- // For every 16 bytes, there is one line
- // of output. First, the hex output of
- // the 16 bytes with each byte separated
- // by a space.
- while (j < 16 && j + i < bbwi.position()) {
- int k = bbwi.byteBuffer.get(i + j);
- if (k < 0)
- k = 256 + k;
- String hex = Integer.toHexString(k);
- if (hex.length() == 1)
- hex = "0" + hex;
- System.out.print(hex + " ");
- j++;
- }
-
- // Add any extra spaces to align the
- // text column in case we didn't end
- // at 16
- while (j < 16) {
- System.out.print(" ");
- j++;
- }
-
- // Now output the ASCII equivalents. Non-ASCII
- // characters are shown as periods.
- int x = 0;
-
- while (x < 16 && x + i < bbwi.position()) {
- if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x)))
- charBuf[x] = (char)bbwi.byteBuffer.get(i + x);
- else
- charBuf[x] = '.';
- x++;
- }
- System.out.println(new String(charBuf, 0, x));
- }
- } catch (Throwable t) {
- t.printStackTrace();
- }
- System.out.println("++++++++++++++++++++++++++++++");
- }
-
- public void writeIndirection(int tag, int posIndirectedTo)
- {
- // Must ensure that there are no chunks between the tag
- // and the actual indirection value. This isn't talked about
- // in the spec, but seems to cause headaches in our code.
- // At the very least, this method isolates the indirection code
- // that was duplicated so often.
-
- handleSpecialChunkBegin(computeAlignment(4) + 8);
-
- // write indirection tag
- write_long(tag);
-
- // write indirection
- // Use parent.getRealIndex() so that it can be overridden by TypeCodeOutputStreams
-/*
- System.out.println("CDROutputStream_1_0 writing indirection pos " + posIndirectedTo +
- " - real index " + parent.getRealIndex(get_offset()) + " = " +
- (posIndirectedTo - parent.getRealIndex(get_offset())));
-*/
- write_long(posIndirectedTo - parent.getRealIndex(get_offset()));
-
- handleSpecialChunkEnd();
- }
-
- protected CodeSetConversion.CTBConverter getCharConverter() {
- if (charConverter == null)
- charConverter = parent.createCharCTBConverter();
-
- return charConverter;
- }
-
- protected CodeSetConversion.CTBConverter getWCharConverter() {
- if (wcharConverter == null)
- wcharConverter = parent.createWCharCTBConverter();
-
- return wcharConverter;
- }
-
- protected void dprint(String msg) {
- if (debug)
- ORBUtility.dprint(this, msg);
- }
-
- void alignOnBoundary(int octetBoundary) {
- alignAndReserve(octetBoundary, 0);
- }
-
- public void start_value(String rep_id) {
-
- if (debug) {
- dprint("start_value w/ rep id "
- + rep_id
- + " called at pos "
- + get_offset()
- + " position "
- + bbwi.position());
- }
-
- if (inBlock)
- end_block();
-
- // Write value_tag
- writeValueTag(true, true, null);
-
- // Write rep. id
- write_repositoryId(rep_id);
-
- // Write Value chunk
- end_flag--;
- chunkedValueNestingLevel--;
-
- // Make sure to chunk the custom data
- start_block();
- }
-
- public void end_value() {
-
- if (debug) {
- dprint("end_value called at pos "
- + get_offset()
- + " position "
- + bbwi.position());
- }
-
- end_block();
-
- writeEndTag(true);
-
- // Check to see if we need to start another block for a
- // possible outer value. Since we're in the stream
- // format 2 custom type contained by another custom
- // type, mustChunk should always be true.
- //
- // Here's why we need to open a continuation chunk:
- //
- // We need to enclose the default data of the
- // next subclass down in chunks. There won't be
- // an end tag separating the superclass optional
- // data and the subclass's default data.
-
- if (debug) {
- dprint("mustChunk is " + mustChunk);
- }
-
- if (mustChunk) {
- start_block();
- }
- }
-
- public void close() throws IOException
- {
- // tell BufferManagerWrite to release any ByteBuffers
- getBufferManager().close();
-
- // It's possible bbwi.byteBuffer is shared between
- // this OutputStream and an InputStream. Thus, we check
- // if the Input/Output streams are using the same ByteBuffer.
- // If they sharing the same ByteBuffer we need to ensure only
- // one of those ByteBuffers are released to the ByteBufferPool.
-
- if (getByteBufferWithInfo() != null && getByteBuffer() != null)
- {
- MessageMediator messageMediator = parent.getMessageMediator();
- if (messageMediator != null)
- {
- CDRInputObject inputObj =
- (CDRInputObject)messageMediator.getInputObject();
- if (inputObj != null)
- {
- if (inputObj.isSharing(getByteBuffer()))
- {
- // Set InputStream's ByteBuffer and bbwi to null
- // so its ByteBuffer cannot be released to the pool
- inputObj.setByteBuffer(null);
- inputObj.setByteBufferWithInfo(null);
- }
- }
- }
-
- // release this stream's ByteBuffer to the pool
- ByteBufferPool byteBufferPool = orb.getByteBufferPool();
- if (debug)
- {
- // print address of ByteBuffer being released
- int bbAddress = System.identityHashCode(bbwi.byteBuffer);
- StringBuffer sb = new StringBuffer(80);
- sb.append(".close - releasing ByteBuffer id (");
- sb.append(bbAddress).append(") to ByteBufferPool.");
- String msg = sb.toString();
- dprint(msg);
- }
- byteBufferPool.releaseByteBuffer(getByteBuffer());
- bbwi.byteBuffer = null;
- bbwi = null;
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_1.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_1.java
deleted file mode 100644
index 7fb977c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_1.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import org.omg.CORBA.CompletionStatus;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-
-public class CDROutputStream_1_1 extends CDROutputStream_1_0
-{
- // This is used to keep indirections working across fragments. When added
- // to the current bbwi.position(), the result is the current position
- // in the byte stream without any fragment headers.
- //
- // It is equal to the following:
- //
- // n = number of buffers (0 is original buffer, 1 is first fragment, etc)
- //
- // n == 0, fragmentOffset = 0
- //
- // n > 0, fragmentOffset
- // = sum i=[1,n] { bbwi_i-1_.size - buffer i header length }
- //
- protected int fragmentOffset = 0;
-
- protected void alignAndReserve(int align, int n) {
-
- // Notice that in 1.1, we won't end a fragment with
- // alignment padding. We also won't guarantee that
- // our fragments end on evenly divisible 8 byte
- // boundaries. There may be alignment
- // necessary with the header of the next fragment
- // since the header isn't aligned on an 8 byte
- // boundary, so we have to calculate it twice.
-
- int alignment = computeAlignment(align);
-
- if (bbwi.position() + n + alignment > bbwi.buflen) {
- grow(align, n);
-
- // Must recompute the alignment after a grow.
- // In the case of fragmentation, the alignment
- // calculation may no longer be correct.
-
- // People shouldn't be able to set their fragment
- // sizes so small that the fragment header plus
- // this alignment fills the entire buffer.
- alignment = computeAlignment(align);
- }
-
- bbwi.position(bbwi.position() + alignment);
- }
-
- protected void grow(int align, int n) {
- // Save the current size for possible post-fragmentation calculation
- int oldSize = bbwi.position();
-
- super.grow(align, n);
-
- // At this point, if we fragmented, we should have a ByteBufferWithInfo
- // with the fragment header already marshalled. The size and length fields
- // should be updated accordingly, and the fragmented flag should be set.
- if (bbwi.fragmented) {
-
- // Clear the flag
- bbwi.fragmented = false;
-
- // Update fragmentOffset so indirections work properly.
- // At this point, oldSize is the entire length of the
- // previous buffer. bbwi.position() is the length of the
- // fragment header of this buffer.
- fragmentOffset += (oldSize - bbwi.position());
- }
- }
-
- public int get_offset() {
- return bbwi.position() + fragmentOffset;
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_1;
- }
-
- public void write_wchar(char x)
- {
- // In GIOP 1.1, interoperability with wchar is limited
- // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6.
- // Note that the following code prohibits UTF-16 with a byte
- // order marker (which would result in 4 bytes).
- CodeSetConversion.CTBConverter converter = getWCharConverter();
-
- converter.convert(x);
-
- if (converter.getNumBytes() != 2)
- throw wrapper.badGiop11Ctb(CompletionStatus.COMPLETED_MAYBE);
-
- alignAndReserve(converter.getAlignment(),
- converter.getNumBytes());
-
- parent.write_octet_array(converter.getBytes(),
- 0,
- converter.getNumBytes());
- }
-
- public void write_wstring(String value)
- {
- if (value == null) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
-
- // The length is the number of code points (which are 2 bytes each)
- // including the 2 byte null. See CORBA formal 99-10-07 15.3.2.7.
-
- int len = value.length() + 1;
-
- write_long(len);
-
- CodeSetConversion.CTBConverter converter = getWCharConverter();
-
- converter.convert(value);
-
- internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes());
-
- // Write the 2 byte null ending
- write_short((short)0);
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_2.java b/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_2.java
deleted file mode 100644
index 165fd98..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_2.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-public class CDROutputStream_1_2 extends CDROutputStream_1_1
-{
- // There's a situation with chunking with fragmentation
- // in which the alignment for a primitive value is needed
- // to fill fragment N, but the primitive won't fit so
- // must go into fragment N + 1. The behavior is the same
- // as that for specialChunks.
- //
- // Unfortunately, given the current code, we can't reuse
- // specialChunk. If you wrap each of the following
- // write calls with handleSpecialChunkBegin/End, you
- // will lose your state because the primitive calls will
- // change the variables, etc.
- //
- // All of the CDR code should be rewritten moving chunking
- // to a different level, perhaps in the buffer managers.
- // We want to move to a compositional model rather than
- // using inheritance.
- //
- // Note that in the grow case, chunks are _NOT_ closed
- // at grow points, now.
- //
- // **** NOTE ****
- // Since we will not support valuetypes with GIOP 1.1, that
- // also means we do not support chunking there.
- //
- protected boolean primitiveAcrossFragmentedChunk = false;
-
- // Used in chunking. Here's how this works:
- //
- // When chunking and writing an array of primitives, a string, or a
- // wstring, _AND_ it won't fit in the buffer do the following. (As
- // you can see, this is a very "special" chunk.)
- //
- // 1. Write the length of the chunk including the array length
- // 2. Set specialChunk to true
- // 3 applies to ALL chunking:
- // 3. In grow, if we need to fragment and specialChunk is false
- // a) call end_block
- // b) fragment
- // Now back to the array only case:
- // [write the data]
- // 4. if specialChunk is true
- // a) Close the chunk
- // b) Set specialChunk to false
-
- protected boolean specialChunk = false;
-
- // Indicates whether the header should be padded. In GIOP 1.2 and above, the
- // body must be aligned on a 8-octet boundary, and so the header needs to be
- // padded appropriately. However, if there is no body to a request or reply
- // message, there is no need to pad the header, in the unfragmented case.
- private boolean headerPadding;
-
- protected void handleSpecialChunkBegin(int requiredSize)
- {
- // If we're chunking and the item won't fit in the buffer
- if (inBlock && requiredSize + bbwi.position() > bbwi.buflen) {
-
- // Duplicating some code from end_block. Compute
- // and write the total chunk length.
-
- int oldSize = bbwi.position();
- bbwi.position(blockSizeIndex - 4);
-
- //write_long(oldSize - blockSizeIndex);
- writeLongWithoutAlign((oldSize - blockSizeIndex) + requiredSize);
- bbwi.position(oldSize);
-
- // Set the special flag so we don't end the chunk when
- // we fragment
- specialChunk = true;
- }
- }
-
- protected void handleSpecialChunkEnd()
- {
- // If we're in a chunk and the item spanned fragments
- if (inBlock && specialChunk) {
-
- // This is unnecessary, but I just want to show that
- // we're done with the current chunk. (the end_block
- // call is inappropriate here)
- inBlock = false;
- blockSizeIndex = -1;
- blockSizePosition = -1;
-
- // Start a new chunk since we fragmented during the item.
- // Thus, no one can go back to add more to the chunk length
- start_block();
-
- // Now turn off the flag so we go back to the normal
- // behavior of closing a chunk when we fragment and
- // reopening afterwards.
- specialChunk = false;
- }
- }
-
- // Called after writing primitives
- private void checkPrimitiveAcrossFragmentedChunk()
- {
- if (primitiveAcrossFragmentedChunk) {
- primitiveAcrossFragmentedChunk = false;
-
- inBlock = false;
-
- // It would be nice to have a StreamPosition
- // abstraction if we could avoid allocation
- // overhead.
- blockSizeIndex = -1;
- blockSizePosition = -1;
-
- // Start a new chunk
- start_block();
- }
- }
-
-
- public void write_octet(byte x) {
- super.write_octet(x);
- checkPrimitiveAcrossFragmentedChunk();
- }
-
- public void write_short(short x) {
- super.write_short(x);
- checkPrimitiveAcrossFragmentedChunk();
- }
-
- public void write_long(int x) {
- super.write_long(x);
- checkPrimitiveAcrossFragmentedChunk();
- }
-
- public void write_longlong(long x) {
- super.write_longlong(x);
- checkPrimitiveAcrossFragmentedChunk();
- }
-
- // Called by RequestMessage_1_2 or ReplyMessage_1_2 classes only.
- void setHeaderPadding(boolean headerPadding) {
- this.headerPadding = headerPadding;
- }
-
- protected void alignAndReserve(int align, int n) {
-
- // headerPadding bit is set by the write operation of RequestMessage_1_2
- // or ReplyMessage_1_2 classes. When set, the very first body write
- // operation (from the stub code) would trigger an alignAndReserve
- // method call, that would in turn add the appropriate header padding,
- // such that the body is aligned on a 8-octet boundary. The padding
- // is required for GIOP versions 1.2 and above, only if body is present.
- if (headerPadding == true) {
- headerPadding = false;
- alignOnBoundary(ORBConstants.GIOP_12_MSG_BODY_ALIGNMENT);
- }
-
- // In GIOP 1.2, we always end fragments at our
- // fragment size, which is an "evenly divisible
- // 8 byte boundary" (aka divisible by 16). A fragment can
- // end with appropriate alignment padding, but no padding
- // is needed with respect to the next GIOP fragment
- // header since it ends on an 8 byte boundary.
-
- bbwi.position(bbwi.position() + computeAlignment(align));
-
- if (bbwi.position() + n > bbwi.buflen)
- grow(align, n);
- }
-
- protected void grow(int align, int n) {
-
- // Save the current size for possible post-fragmentation calculation
- int oldSize = bbwi.position();
-
- // See notes where specialChunk is defined, as well as the
- // above notes for primitiveAcrossFragmentedChunk.
- //
- // If we're writing a primitive and chunking, we need to update
- // the chunk length to include the length of the primitive (unless
- // this complexity is handled by specialChunk).
- //
- // Note that this is wasted processing in the grow case, but that
- // we don't actually close the chunk in that case.
- boolean handleChunk = (inBlock && !specialChunk);
- if (handleChunk) {
- int oldIndex = bbwi.position();
-
- bbwi.position(blockSizeIndex - 4);
-
- writeLongWithoutAlign((oldIndex - blockSizeIndex) + n);
-
- bbwi.position(oldIndex);
- }
-
- bbwi.needed = n;
- bufferManagerWrite.overflow(bbwi);
-
- // At this point, if we fragmented, we should have a ByteBufferWithInfo
- // with the fragment header already marshalled. The buflen and position
- // should be updated accordingly, and the fragmented flag should be set.
-
- // Note that fragmented is only true in the streaming and collect cases.
- if (bbwi.fragmented) {
-
- // Clear the flag
- bbwi.fragmented = false;
-
- // Update fragmentOffset so indirections work properly.
- // At this point, oldSize is the entire length of the
- // previous buffer. bbwi.position() is the length of the
- // fragment header of this buffer.
- fragmentOffset += (oldSize - bbwi.position());
-
- // We just fragmented, and need to signal that we should
- // start a new chunk after writing the primitive.
- if (handleChunk)
- primitiveAcrossFragmentedChunk = true;
-
- }
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_2;
- }
-
- public void write_wchar(char x)
- {
- // In GIOP 1.2, a wchar is encoded as an unsigned octet length
- // followed by the octets of the converted wchar. This is good,
- // but it causes problems with our chunking code. We don't
- // want that octet to get put in a different chunk at the end
- // of the previous fragment.
- //
- // Ensure that this won't happen by overriding write_wchar_array
- // and doing our own handleSpecialChunkBegin/End here.
- CodeSetConversion.CTBConverter converter = getWCharConverter();
-
- converter.convert(x);
-
- handleSpecialChunkBegin(1 + converter.getNumBytes());
-
- write_octet((byte)converter.getNumBytes());
-
- byte[] result = converter.getBytes();
-
- // Write the bytes without messing with chunking
- // See CDROutputStream_1_0
- internalWriteOctetArray(result, 0, converter.getNumBytes());
-
- handleSpecialChunkEnd();
- }
-
- public void write_wchar_array(char[] value, int offset, int length)
- {
- if (value == null) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
-
- CodeSetConversion.CTBConverter converter = getWCharConverter();
-
- // Unfortunately, because of chunking, we have to convert the
- // entire char[] to a byte[] array first so we can know how
- // many bytes we're writing ahead of time. You can't split
- // an array of primitives into multiple chunks.
- int totalNumBytes = 0;
-
- // Remember that every wchar starts with an octet telling
- // its length. The buffer size is an upper bound estimate.
- int maxLength = (int)Math.ceil(converter.getMaxBytesPerChar() * length);
- byte[] buffer = new byte[maxLength + length];
-
- for (int i = 0; i < length; i++) {
- // Convert one wchar
- converter.convert(value[offset + i]);
-
- // Make sure to add the octet length
- buffer[totalNumBytes++] = (byte)converter.getNumBytes();
-
- // Copy it into our buffer
- System.arraycopy(converter.getBytes(), 0,
- buffer, totalNumBytes,
- converter.getNumBytes());
-
- totalNumBytes += converter.getNumBytes();
- }
-
- // Now that we know the total length, we can deal with chunking.
- // Note that we don't have to worry about alignment since they're
- // just octets.
- handleSpecialChunkBegin(totalNumBytes);
-
- // Must use totalNumBytes rather than buffer.length since the
- // buffer.length is only the upper bound estimate.
- internalWriteOctetArray(buffer, 0, totalNumBytes);
-
- handleSpecialChunkEnd();
- }
-
- public void write_wstring(String value) {
- if (value == null) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
-
- // In GIOP 1.2, wstrings are not terminated by a null. The
- // length is the number of octets in the converted format.
- // A zero length string is represented with the 4 byte length
- // value of 0.
- if (value.length() == 0) {
- write_long(0);
- return;
- }
-
- CodeSetConversion.CTBConverter converter = getWCharConverter();
-
- converter.convert(value);
-
- handleSpecialChunkBegin(computeAlignment(4) + 4 + converter.getNumBytes());
-
- write_long(converter.getNumBytes());
-
- // Write the octet array without tampering with chunking
- internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes());
-
- handleSpecialChunkEnd();
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CachedCodeBase.java b/src/share/classes/com/sun/corba/se/impl/encoding/CachedCodeBase.java
deleted file mode 100644
index 3e69876..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CachedCodeBase.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.util.Hashtable;
-import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
-import com.sun.org.omg.SendingContext.CodeBase;
-import com.sun.org.omg.SendingContext.CodeBaseHelper;
-import com.sun.org.omg.SendingContext._CodeBaseImplBase;
-import com.sun.org.omg.SendingContext._CodeBaseStub;
-import com.sun.corba.se.spi.transport.CorbaConnection;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.orb.ORB;
-/**
- * Provides the reading side with a per connection cache of
- * info obtained via calls to the remote CodeBase.
- *
- * Previously, most of this was in IIOPConnection.
- *
- * Features:
- * Delays cache creation unless used
- * Postpones remote calls until necessary
- * Handles creating obj ref from IOR
- * Maintains caches for the following maps:
- * CodeBase IOR to obj ref (global)
- * RepId to implementation URL(s)
- * RepId to remote FVD
- * RepId to superclass type list
- *
- * Needs cache management.
- */
-public class CachedCodeBase extends _CodeBaseImplBase
-{
- private Hashtable implementations, fvds, bases;
- private volatile CodeBase delegate;
- private CorbaConnection conn;
-
- private static Object iorMapLock = new Object();
- private static Hashtable<IOR,CodeBase> iorMap = new Hashtable<>();
-
- public static synchronized void cleanCache( ORB orb ) {
- synchronized (iorMapLock) {
- for (IOR ior : iorMap.keySet()) {
- if (ior.getORB() == orb) {
- iorMap.remove(ior);
- }
- }
- }
- }
-
- public CachedCodeBase(CorbaConnection connection) {
- conn = connection;
- }
-
- public com.sun.org.omg.CORBA.Repository get_ir () {
- return null;
- }
-
- public synchronized String implementation (String repId) {
- String urlResult = null;
-
- if (implementations == null)
- implementations = new Hashtable();
- else
- urlResult = (String)implementations.get(repId);
-
- if (urlResult == null && connectedCodeBase()) {
- urlResult = delegate.implementation(repId);
-
- if (urlResult != null)
- implementations.put(repId, urlResult);
- }
-
- return urlResult;
- }
-
- public synchronized String[] implementations (String[] repIds) {
- String[] urlResults = new String[repIds.length];
-
- for (int i = 0; i < urlResults.length; i++)
- urlResults[i] = implementation(repIds[i]);
-
- return urlResults;
- }
-
- public synchronized FullValueDescription meta (String repId) {
- FullValueDescription result = null;
-
- if (fvds == null)
- fvds = new Hashtable();
- else
- result = (FullValueDescription)fvds.get(repId);
-
- if (result == null && connectedCodeBase()) {
- result = delegate.meta(repId);
-
- if (result != null)
- fvds.put(repId, result);
- }
-
- return result;
- }
-
- public synchronized FullValueDescription[] metas (String[] repIds) {
- FullValueDescription[] results
- = new FullValueDescription[repIds.length];
-
- for (int i = 0; i < results.length; i++)
- results[i] = meta(repIds[i]);
-
- return results;
- }
-
- public synchronized String[] bases (String repId) {
-
- String[] results = null;
-
- if (bases == null)
- bases = new Hashtable();
- else
- results = (String[])bases.get(repId);
-
- if (results == null && connectedCodeBase()) {
- results = delegate.bases(repId);
-
- if (results != null)
- bases.put(repId, results);
- }
-
- return results;
- }
-
- // Ensures that we've used the connection's IOR to create
- // a valid CodeBase delegate. If this returns false, then
- // it is not valid to access the delegate.
- private synchronized boolean connectedCodeBase() {
- if (delegate != null)
- return true;
-
- // The delegate was null, so see if the connection's
- // IOR was set. If so, then we just need to connect
- // it. Otherwise, there is no hope of checking the
- // remote code base. That could be bug if the
- // service context processing didn't occur, or it
- // could be that we're talking to a foreign ORB which
- // doesn't include this optional service context.
- if (conn.getCodeBaseIOR() == null) {
- // REVISIT. Use Merlin logging service to report that
- // codebase functionality was requested but unavailable.
- if (conn.getBroker().transportDebugFlag)
- conn.dprint("CodeBase unavailable on connection: " + conn);
-
- return false;
- }
-
- synchronized(iorMapLock) {
-
- // Recheck the condition to make sure another
- // thread didn't already do this while we waited
- if (delegate != null)
- return true;
-
- // Do we have a reference initialized by another connection?
- delegate = CachedCodeBase.iorMap.get(conn.getCodeBaseIOR());
-
- if (delegate != null)
- return true;
-
- // Connect the delegate and update the cache
- delegate = CodeBaseHelper.narrow(getObjectFromIOR());
-
- // Save it for the benefit of other connections
- CachedCodeBase.iorMap.put(conn.getCodeBaseIOR(), delegate);
- }
-
- // It's now safe to use the delegate
- return true;
- }
-
- private final org.omg.CORBA.Object getObjectFromIOR() {
- return CDRInputStream_1_0.internalIORToObject(
- conn.getCodeBaseIOR(), null /*stubFactory*/, conn.getBroker());
- }
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CodeSetCache.java b/src/share/classes/com/sun/corba/se/impl/encoding/CodeSetCache.java
deleted file mode 100644
index bcd417b..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CodeSetCache.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2001, 2004, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-/**
- * Thread local cache of sun.io code set converters for performance.
- *
- * The thread local class contains a single reference to a Map[]
- * containing two WeakHashMaps. One for CharsetEncoders and
- * one for CharsetDecoders. Constants are defined for indexing.
- *
- * This is used internally by CodeSetConversion.
- */
-class CodeSetCache
-{
- /**
- * The ThreadLocal data is a 2 element Map array indexed
- * by BTC_CACHE_MAP and CTB_CACHE_MAP.
- */
- private ThreadLocal converterCaches = new ThreadLocal() {
- public java.lang.Object initialValue() {
- return new Map[] { new WeakHashMap(), new WeakHashMap() };
- }
- };
-
- /**
- * Index in the thread local converterCaches array for
- * the byte to char converter Map. A key is the Java
- * name corresponding to the desired code set.
- */
- private static final int BTC_CACHE_MAP = 0;
-
- /**
- * Index in the thread local converterCaches array for
- * the char to byte converter Map. A key is the Java
- * name corresponding to the desired code set.
- */
- private static final int CTB_CACHE_MAP = 1;
-
- /**
- * Retrieve a CharsetDecoder from the Map using the given key.
- */
- CharsetDecoder getByteToCharConverter(Object key) {
- Map btcMap = ((Map[])converterCaches.get())[BTC_CACHE_MAP];
-
- return (CharsetDecoder)btcMap.get(key);
- }
-
- /**
- * Retrieve a CharsetEncoder from the Map using the given key.
- */
- CharsetEncoder getCharToByteConverter(Object key) {
- Map ctbMap = ((Map[])converterCaches.get())[CTB_CACHE_MAP];
-
- return (CharsetEncoder)ctbMap.get(key);
- }
-
- /**
- * Stores the given CharsetDecoder in the thread local cache,
- * and returns the same converter.
- */
- CharsetDecoder setConverter(Object key, CharsetDecoder converter) {
- Map btcMap = ((Map[])converterCaches.get())[BTC_CACHE_MAP];
-
- btcMap.put(key, converter);
-
- return converter;
- }
-
- /**
- * Stores the given CharsetEncoder in the thread local cache,
- * and returns the same converter.
- */
- CharsetEncoder setConverter(Object key, CharsetEncoder converter) {
-
- Map ctbMap = ((Map[])converterCaches.get())[CTB_CACHE_MAP];
-
- ctbMap.put(key, converter);
-
- return converter;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CodeSetComponentInfo.java b/src/share/classes/com/sun/corba/se/impl/encoding/CodeSetComponentInfo.java
deleted file mode 100644
index 8f0e7c0..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CodeSetComponentInfo.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.util.StringTokenizer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.NoSuchElementException;
-import org.omg.CORBA.INITIALIZE;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-public final class CodeSetComponentInfo {
-
- /**
- * CodeSetComponent is part of an IOR multi-component profile. Two
- * instances constitute a CodeSetComponentInfo (one for char and one
- * for wchar data)
- */
- public static final class CodeSetComponent {
- int nativeCodeSet;
- int[] conversionCodeSets;
-
- public boolean equals( Object obj )
- {
- if (this == obj)
- return true ;
-
- if (!(obj instanceof CodeSetComponent))
- return false ;
-
- CodeSetComponent other = (CodeSetComponent)obj ;
-
- return (nativeCodeSet == other.nativeCodeSet) &&
- Arrays.equals( conversionCodeSets, other.conversionCodeSets ) ;
- }
-
- public int hashCode()
- {
- int result = nativeCodeSet ;
- for (int ctr=0; ctr<conversionCodeSets.length; ctr++)
- result = 37*result + conversionCodeSets[ctr] ;
- return result ;
- }
-
- public CodeSetComponent() {}
-
- public CodeSetComponent(int nativeCodeSet, int[] conversionCodeSets) {
- this.nativeCodeSet = nativeCodeSet;
- if (conversionCodeSets == null)
- this.conversionCodeSets = new int[0];
- else
- this.conversionCodeSets = conversionCodeSets;
- }
-
- public void read(MarshalInputStream in) {
- nativeCodeSet = in.read_ulong();
- int len = in.read_long();
- conversionCodeSets = new int[len];
- in.read_ulong_array(conversionCodeSets, 0, len);
-
- }
-
- public void write(MarshalOutputStream out) {
- out.write_ulong(nativeCodeSet);
- out.write_long(conversionCodeSets.length);
- out.write_ulong_array(conversionCodeSets, 0, conversionCodeSets.length);
- }
-
- public String toString() {
- StringBuffer sbuf = new StringBuffer("CodeSetComponent(");
-
- sbuf.append("native:");
- sbuf.append(Integer.toHexString(nativeCodeSet));
- sbuf.append(" conversion:");
- if (conversionCodeSets == null)
- sbuf.append("null");
- else {
- for (int i = 0; i < conversionCodeSets.length; i++) {
- sbuf.append(Integer.toHexString(conversionCodeSets[i]));
- sbuf.append(' ');
- }
- }
- sbuf.append( ")" ) ;
-
- return sbuf.toString();
- }
- }
-
- private CodeSetComponent forCharData;
- private CodeSetComponent forWCharData;
-
- public boolean equals( Object obj )
- {
- if (this == obj)
- return true ;
-
- if (!(obj instanceof CodeSetComponentInfo))
- return false ;
-
- CodeSetComponentInfo other = (CodeSetComponentInfo)obj ;
- return forCharData.equals( other.forCharData ) &&
- forWCharData.equals( other.forWCharData ) ;
- }
-
- public int hashCode()
- {
- return forCharData.hashCode() ^ forWCharData.hashCode() ;
- }
-
- public String toString() {
- StringBuffer sbuf = new StringBuffer("CodeSetComponentInfo(");
-
- sbuf.append("char_data:");
- sbuf.append(forCharData.toString());
- sbuf.append(" wchar_data:");
- sbuf.append(forWCharData.toString());
- sbuf.append(")");
-
- return sbuf.toString();
- }
-
- public CodeSetComponentInfo() {
- forCharData = CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.forCharData;
- forWCharData = CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.forWCharData;
- }
-
- public CodeSetComponentInfo(CodeSetComponent charData,
- CodeSetComponent wcharData) {
- forCharData = charData;
- forWCharData = wcharData;
- }
-
- public void read(MarshalInputStream in) {
- forCharData = new CodeSetComponent();
- forCharData.read(in);
- forWCharData = new CodeSetComponent();
- forWCharData.read(in);
- }
-
- public void write(MarshalOutputStream out) {
- forCharData.write(out);
- forWCharData.write(out);
- }
-
- public CodeSetComponent getCharComponent() {
- return forCharData;
- }
-
- public CodeSetComponent getWCharComponent() {
- return forWCharData;
- }
-
- /**
- * CodeSetContext goes in a GIOP service context
- */
- public static final class CodeSetContext {
- private int char_data;
- private int wchar_data;
-
- public CodeSetContext() {}
-
- public CodeSetContext(int charEncoding, int wcharEncoding) {
- char_data = charEncoding;
- wchar_data = wcharEncoding;
- }
-
- public void read(MarshalInputStream in) {
- char_data = in.read_ulong();
- wchar_data = in.read_ulong();
- }
-
- public void write(MarshalOutputStream out) {
- out.write_ulong(char_data);
- out.write_ulong(wchar_data);
- }
-
- public int getCharCodeSet() {
- return char_data;
- }
-
- public int getWCharCodeSet() {
- return wchar_data;
- }
-
- public String toString() {
- StringBuffer sbuf = new StringBuffer();
- sbuf.append("CodeSetContext char set: ");
- sbuf.append(Integer.toHexString(char_data));
- sbuf.append(" wchar set: ");
- sbuf.append(Integer.toHexString(wchar_data));
- return sbuf.toString();
- }
- }
-
- /**
- * Our default code set scheme is as follows:
- *
- * char data:
- *
- * Native code set: ISO 8859-1 (8-bit)
- * Conversion sets: UTF-8, ISO 646 (7-bit)
- *
- * wchar data:
- *
- * Native code set: UTF-16
- * Conversion sets: UCS-2
- *
- * Pre-Merlin/J2EE 1.3 JavaSoft ORBs listed ISO646 for char and
- * UCS-2 for wchar, and provided no conversion sets. They also
- * didn't do correct negotiation or provide the fallback sets.
- * UCS-2 is still in the conversion list for backwards compatibility.
- *
- * The fallbacks are UTF-8 for char and UTF-16 for wchar.
- *
- * In GIOP 1.1, interoperability with wchar is limited to 2 byte fixed
- * width encodings since its wchars aren't preceded by a length.
- * Thus, I've chosen not to include UTF-8 in the conversion set
- * for wchar data.
- *
- */
- public static final CodeSetComponentInfo JAVASOFT_DEFAULT_CODESETS;
- static {
- CodeSetComponent charData
- = new CodeSetComponent(OSFCodeSetRegistry.ISO_8859_1.getNumber(),
- new int[] {
- OSFCodeSetRegistry.UTF_8.getNumber(),
- OSFCodeSetRegistry.ISO_646.getNumber()
- });
-
- CodeSetComponent wcharData
- = new CodeSetComponent(OSFCodeSetRegistry.UTF_16.getNumber(),
- new int[]
- {
- OSFCodeSetRegistry.UCS_2.getNumber()
- });
-
- JAVASOFT_DEFAULT_CODESETS = new CodeSetComponentInfo(charData, wcharData);
- }
-
- /**
- * Creates a CodeSetComponent from a String which contains a comma
- * delimited list of OSF Code Set Registry numbers. An INITIALIZE
- * exception is thrown if any of the numbers are not known by our
- * registry. Used by corba.ORB init.
- *
- * The first number in the list is taken as the native code set,
- * and the rest is the conversion code set list.
- *
- * The numbers can either be decimal or hex.
- */
- public static CodeSetComponent createFromString(String str) {
- ORBUtilSystemException wrapper = ORBUtilSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- if (str == null || str.length() == 0)
- throw wrapper.badCodeSetString() ;
-
- StringTokenizer stok = new StringTokenizer(str, ", ", false);
- int nativeSet = 0;
- int conversionInts[] = null;
-
- try {
-
- // The first value is the native code set
- nativeSet = Integer.decode(stok.nextToken()).intValue();
-
- if (OSFCodeSetRegistry.lookupEntry(nativeSet) == null)
- throw wrapper.unknownNativeCodeset( new Integer(nativeSet) ) ;
-
- List conversionList = new ArrayList(10);
-
- // Now process the other values as part of the
- // conversion code set list.
- while (stok.hasMoreTokens()) {
-
- // decode allows us to specify hex, decimal, etc
- Integer value = Integer.decode(stok.nextToken());
-
- if (OSFCodeSetRegistry.lookupEntry(value.intValue()) == null)
- throw wrapper.unknownConversionCodeSet( value ) ;
-
- conversionList.add(value);
- }
-
- conversionInts = new int[conversionList.size()];
-
- for (int i = 0; i < conversionInts.length; i++)
- conversionInts[i] = ((Integer)conversionList.get(i)).intValue();
-
- } catch (NumberFormatException nfe) {
- throw wrapper.invalidCodeSetNumber( nfe ) ;
- } catch (NoSuchElementException nsee) {
- throw wrapper.invalidCodeSetString( nsee, str ) ;
- }
-
- // Otherwise return the CodeSetComponent representing
- // the given values
- return new CodeSetComponent(nativeSet, conversionInts);
- }
-
- /**
- * Code sets for local cases without a connection.
- */
- public static final CodeSetContext LOCAL_CODE_SETS
- = new CodeSetContext(OSFCodeSetRegistry.ISO_8859_1.getNumber(),
- OSFCodeSetRegistry.UTF_16.getNumber());
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/CodeSetConversion.java b/src/share/classes/com/sun/corba/se/impl/encoding/CodeSetConversion.java
deleted file mode 100644
index 83f4135..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CodeSetConversion.java
+++ /dev/null
@@ -1,707 +0,0 @@
-/*
- * Copyright (c) 2001, 2004, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetEncoder;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.IllegalCharsetNameException;
-import java.nio.charset.MalformedInputException;
-import java.nio.charset.UnsupportedCharsetException;
-import java.nio.charset.UnmappableCharacterException;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-/**
- * Collection of classes, interfaces, and factory methods for
- * CORBA code set conversion.
- *
- * This is mainly used to shield other code from the sun.io
- * converters which might change, as well as provide some basic
- * translation from conversion to CORBA error exceptions. Some
- * extra work is required here to facilitate the way CORBA
- * says it uses UTF-16 as of the 00-11-03 spec.
- *
- * REVISIT - Since the nio.Charset and nio.Charset.Encoder/Decoder
- * use NIO ByteBuffer and NIO CharBuffer, the interaction
- * and interface between this class and the CDR streams
- * should be looked at more closely for optimizations to
- * avoid unnecessary copying of data between char[] &
- * CharBuffer and byte[] & ByteBuffer, especially
- * DirectByteBuffers.
- *
- */
-public class CodeSetConversion
-{
- /**
- * Abstraction for char to byte conversion.
- *
- * Must be used in the proper sequence:
- *
- * 1) convert
- * 2) Optional getNumBytes and/or getAlignment (if necessary)
- * 3) getBytes (see warning)
- */
- public abstract static class CTBConverter
- {
- // Perform the conversion of the provided char or String,
- // allowing the caller to query for more information
- // before writing.
- public abstract void convert(char chToConvert);
- public abstract void convert(String strToConvert);
-
- // How many bytes resulted from the conversion?
- public abstract int getNumBytes();
-
- // What's the maximum number of bytes per character?
- public abstract float getMaxBytesPerChar();
-
- public abstract boolean isFixedWidthEncoding();
-
- // What byte boundary should the stream align to before
- // calling writeBytes? For instance, a fixed width
- // encoding with 2 bytes per char in a stream which
- // doesn't encapsulate the char's bytes should align
- // on a 2 byte boundary. (Ex: UTF16 in GIOP1.1)
- //
- // Note: This has no effect on the converted bytes. It
- // is just information available to the caller.
- public abstract int getAlignment();
-
- // Get the resulting bytes. Warning: You must use getNumBytes()
- // to determine the end of the data in the byte array instead
- // of array.length! The array may be used internally, so don't
- // save references.
- public abstract byte[] getBytes();
- }
-
- /**
- * Abstraction for byte to char conversion.
- */
- public abstract static class BTCConverter
- {
- // In GIOP 1.1, interoperability can only be achieved with
- // fixed width encodings like UTF-16. This is because wstrings
- // specified how many code points follow rather than specifying
- // the length in octets.
- public abstract boolean isFixedWidthEncoding();
- public abstract int getFixedCharWidth();
-
- // Called after getChars to determine the true size of the
- // converted array.
- public abstract int getNumChars();
-
- // Perform the conversion using length bytes from the given
- // input stream. Warning: You must use getNumChars() to
- // determine the correct length of the resulting array.
- // The same array may be used internally over multiple
- // calls.
- public abstract char[] getChars(byte[] bytes, int offset, int length);
- }
-
- /**
- * Implementation of CTBConverter which uses a nio.Charset.CharsetEncoder
- * to do the real work. Handles translation of exceptions to the
- * appropriate CORBA versions.
- */
- private class JavaCTBConverter extends CTBConverter
- {
- private ORBUtilSystemException wrapper = ORBUtilSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- private OMGSystemException omgWrapper = OMGSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- // nio.Charset.CharsetEncoder actually does the work here
- // have to use it directly rather than through String's interface
- // because we want to know when errors occur during the conversion.
- private CharsetEncoder ctb;
-
- // Proper alignment for this type of converter. For instance,
- // ASCII has alignment of 1 (1 byte per char) but UTF16 has
- // alignment of 2 (2 bytes per char)
- private int alignment;
-
- // Char buffer to hold the input.
- private char[] chars = null;
-
- // How many bytes are generated from the conversion?
- private int numBytes = 0;
-
- // How many characters were converted (temporary variable
- // for cross method communication)
- private int numChars = 0;
-
- // ByteBuffer holding the converted input. This is necessary
- // since we have to do calculations that require the conversion
- // before writing the array to the stream.
- private ByteBuffer buffer;
-
- // What code set are we using?
- private OSFCodeSetRegistry.Entry codeset;
-
- public JavaCTBConverter(OSFCodeSetRegistry.Entry codeset,
- int alignmentForEncoding) {
-
- try {
- ctb = cache.getCharToByteConverter(codeset.getName());
- if (ctb == null) {
- Charset tmpCharset = Charset.forName(codeset.getName());
- ctb = tmpCharset.newEncoder();
- cache.setConverter(codeset.getName(), ctb);
- }
- } catch(IllegalCharsetNameException icne) {
-
- // This can only happen if one of our Entries has
- // an invalid name.
- throw wrapper.invalidCtbConverterName(icne,codeset.getName());
- } catch(UnsupportedCharsetException ucne) {
-
- // This can only happen if one of our Entries has
- // an unsupported name.
- throw wrapper.invalidCtbConverterName(ucne,codeset.getName());
- }
-
- this.codeset = codeset;
- alignment = alignmentForEncoding;
- }
-
- public final float getMaxBytesPerChar() {
- return ctb.maxBytesPerChar();
- }
-
- public void convert(char chToConvert) {
- if (chars == null)
- chars = new char[1];
-
- // The CharToByteConverter only takes a char[]
- chars[0] = chToConvert;
- numChars = 1;
-
- convertCharArray();
- }
-
- public void convert(String strToConvert) {
- // Try to save a memory allocation if possible. Usual
- // space/time trade off. If we could get the char[] out of
- // the String without copying, that would be great, but
- // it's forbidden since String is immutable.
- if (chars == null || chars.length < strToConvert.length())
- chars = new char[strToConvert.length()];
-
- numChars = strToConvert.length();
-
- strToConvert.getChars(0, numChars, chars, 0);
-
- convertCharArray();
- }
-
- public final int getNumBytes() {
- return numBytes;
- }
-
- public final int getAlignment() {
- return alignment;
- }
-
- public final boolean isFixedWidthEncoding() {
- return codeset.isFixedWidth();
- }
-
- public byte[] getBytes() {
- // Note that you can't use buffer.length since the buffer might
- // be larger than the actual number of converted bytes depending
- // on the encoding.
- return buffer.array();
- }
-
- private void convertCharArray() {
- try {
-
- // Possible optimization of directly converting into the CDR buffer.
- // However, that means the CDR code would have to reserve
- // a 4 byte string length ahead of time, and we'd need a
- // confusing partial conversion scheme for when we couldn't
- // fit everything in the buffer but needed to know the
- // converted length before proceeding due to fragmentation.
- // Then there's the issue of the chunking code.
- //
- // For right now, this is less messy and basic tests don't
- // show more than a 1 ms penalty worst case. Less than a
- // factor of 2 increase.
-
- // Convert the characters
- buffer = ctb.encode(CharBuffer.wrap(chars,0,numChars));
-
- // ByteBuffer returned by the encoder will set its limit
- // to byte immediately after the last written byte.
- numBytes = buffer.limit();
-
- } catch (IllegalStateException ise) {
- // an encoding operation is already in progress
- throw wrapper.ctbConverterFailure( ise ) ;
- } catch (MalformedInputException mie) {
- // There were illegal Unicode char pairs
- throw wrapper.badUnicodePair( mie ) ;
- } catch (UnmappableCharacterException uce) {
- // A character doesn't map to the desired code set
- // CORBA formal 00-11-03.
- throw omgWrapper.charNotInCodeset( uce ) ;
- } catch (CharacterCodingException cce) {
- // If this happens, then some other encoding error occured
- throw wrapper.ctbConverterFailure( cce ) ;
- }
- }
- }
-
- /**
- * Special UTF16 converter which can either always write a BOM
- * or use a specified byte order without one.
- */
- private class UTF16CTBConverter extends JavaCTBConverter
- {
- // Using this constructor, we will always write a BOM
- public UTF16CTBConverter() {
- super(OSFCodeSetRegistry.UTF_16, 2);
- }
-
- // Using this constructor, we don't use a BOM and use the
- // byte order specified
- public UTF16CTBConverter(boolean littleEndian) {
- super(littleEndian ?
- OSFCodeSetRegistry.UTF_16LE :
- OSFCodeSetRegistry.UTF_16BE,
- 2);
- }
- }
-
- /**
- * Implementation of BTCConverter which uses a sun.io.ByteToCharConverter
- * for the real work. Handles translation of exceptions to the
- * appropriate CORBA versions.
- */
- private class JavaBTCConverter extends BTCConverter
- {
- private ORBUtilSystemException wrapper = ORBUtilSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- private OMGSystemException omgWrapper = OMGSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- protected CharsetDecoder btc;
- private char[] buffer;
- private int resultingNumChars;
- private OSFCodeSetRegistry.Entry codeset;
-
- public JavaBTCConverter(OSFCodeSetRegistry.Entry codeset) {
-
- // Obtain a Decoder
- btc = this.getConverter(codeset.getName());
-
- this.codeset = codeset;
- }
-
- public final boolean isFixedWidthEncoding() {
- return codeset.isFixedWidth();
- }
-
- // Should only be called if isFixedWidthEncoding is true
- // IMPORTANT: This calls OSFCodeSetRegistry.Entry, not
- // CharsetDecoder.maxCharsPerByte().
- public final int getFixedCharWidth() {
- return codeset.getMaxBytesPerChar();
- }
-
- public final int getNumChars() {
- return resultingNumChars;
- }
-
- public char[] getChars(byte[] bytes, int offset, int numBytes) {
-
- // Possible optimization of reading directly from the CDR
- // byte buffer. The sun.io converter supposedly can handle
- // incremental conversions in which a char is broken across
- // two convert calls.
- //
- // Basic tests didn't show more than a 1 ms increase
- // worst case. It's less than a factor of 2 increase.
- // Also makes the interface more difficult.
-
-
- try {
-
- ByteBuffer byteBuf = ByteBuffer.wrap(bytes, offset, numBytes);
- CharBuffer charBuf = btc.decode(byteBuf);
-
- // CharBuffer returned by the decoder will set its limit
- // to byte immediately after the last written byte.
- resultingNumChars = charBuf.limit();
-
- // IMPORTANT - It's possible the underlying char[] in the
- // CharBuffer returned by btc.decode(byteBuf)
- // is longer in length than the number of characters
- // decoded. Hence, the check below to ensure the
- // char[] returned contains all the chars that have
- // been decoded and no more.
- if (charBuf.limit() == charBuf.capacity()) {
- buffer = charBuf.array();
- } else {
- buffer = new char[charBuf.limit()];
- charBuf.get(buffer, 0, charBuf.limit()).position(0);
- }
-
- return buffer;
-
- } catch (IllegalStateException ile) {
- // There were a decoding operation already in progress
- throw wrapper.btcConverterFailure( ile ) ;
- } catch (MalformedInputException mie) {
- // There were illegal Unicode char pairs
- throw wrapper.badUnicodePair( mie ) ;
- } catch (UnmappableCharacterException uce) {
- // A character doesn't map to the desired code set.
- // CORBA formal 00-11-03.
- throw omgWrapper.charNotInCodeset( uce ) ;
- } catch (CharacterCodingException cce) {
- // If this happens, then a character decoding error occured.
- throw wrapper.btcConverterFailure( cce ) ;
- }
- }
-
- /**
- * Utility method to find a CharsetDecoder in the
- * cache or create a new one if necessary. Throws an
- * INTERNAL if the code set is unknown.
- */
- protected CharsetDecoder getConverter(String javaCodeSetName) {
-
- CharsetDecoder result = null;
- try {
- result = cache.getByteToCharConverter(javaCodeSetName);
-
- if (result == null) {
- Charset tmpCharset = Charset.forName(javaCodeSetName);
- result = tmpCharset.newDecoder();
- cache.setConverter(javaCodeSetName, result);
- }
-
- } catch(IllegalCharsetNameException icne) {
- // This can only happen if one of our charset entries has
- // an illegal name.
- throw wrapper.invalidBtcConverterName( icne, javaCodeSetName ) ;
- }
-
- return result;
- }
- }
-
- /**
- * Special converter for UTF16 since it's required to optionally
- * support a byte order marker while the internal Java converters
- * either require it or require that it isn't there.
- *
- * The solution is to check for the byte order marker, and if we
- * need to do something differently, switch internal converters.
- */
- private class UTF16BTCConverter extends JavaBTCConverter
- {
- private boolean defaultToLittleEndian;
- private boolean converterUsesBOM = true;
-
- private static final char UTF16_BE_MARKER = (char) 0xfeff;
- private static final char UTF16_LE_MARKER = (char) 0xfffe;
-
- // When there isn't a byte order marker, used the byte
- // order specified.
- public UTF16BTCConverter(boolean defaultToLittleEndian) {
- super(OSFCodeSetRegistry.UTF_16);
-
- this.defaultToLittleEndian = defaultToLittleEndian;
- }
-
- public char[] getChars(byte[] bytes, int offset, int numBytes) {
-
- if (hasUTF16ByteOrderMarker(bytes, offset, numBytes)) {
- if (!converterUsesBOM)
- switchToConverter(OSFCodeSetRegistry.UTF_16);
-
- converterUsesBOM = true;
-
- return super.getChars(bytes, offset, numBytes);
- } else {
- if (converterUsesBOM) {
- if (defaultToLittleEndian)
- switchToConverter(OSFCodeSetRegistry.UTF_16LE);
- else
- switchToConverter(OSFCodeSetRegistry.UTF_16BE);
-
- converterUsesBOM = false;
- }
-
- return super.getChars(bytes, offset, numBytes);
- }
- }
-
- /**
- * Utility method for determining if a UTF-16 byte order marker is present.
- */
- private boolean hasUTF16ByteOrderMarker(byte[] array, int offset, int length) {
- // If there aren't enough bytes to represent the marker and data,
- // return false.
- if (length >= 4) {
-
- int b1 = array[offset] & 0x00FF;
- int b2 = array[offset + 1] & 0x00FF;
-
- char marker = (char)((b1 << 8) | (b2 << 0));
-
- return (marker == UTF16_BE_MARKER || marker == UTF16_LE_MARKER);
- } else
- return false;
- }
-
- /**
- * The current solution for dealing with UTF-16 in CORBA
- * is that if our sun.io converter requires byte order markers,
- * and then we see a CORBA wstring/wchar without them, we
- * switch to the sun.io converter that doesn't require them.
- */
- private void switchToConverter(OSFCodeSetRegistry.Entry newCodeSet) {
-
- // Use the getConverter method from our superclass.
- btc = super.getConverter(newCodeSet.getName());
- }
- }
-
- /**
- * CTB converter factory for single byte or variable length encodings.
- */
- public CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset) {
- int alignment = (!codeset.isFixedWidth() ?
- 1 :
- codeset.getMaxBytesPerChar());
-
- return new JavaCTBConverter(codeset, alignment);
- }
-
- /**
- * CTB converter factory for multibyte (mainly fixed) encodings.
- *
- * Because of the awkwardness with byte order markers and the possibility of
- * using UCS-2, you must specify both the endianness of the stream as well as
- * whether or not to use byte order markers if applicable. UCS-2 has no byte
- * order markers. UTF-16 has optional markers.
- *
- * If you select useByteOrderMarkers, there is no guarantee that the encoding
- * will use the endianness specified.
- *
- */
- public CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset,
- boolean littleEndian,
- boolean useByteOrderMarkers) {
-
- // UCS2 doesn't have byte order markers, and we're encoding it
- // as UTF-16 since UCS2 isn't available in all Java platforms.
- // They should be identical with only minor differences in
- // negative cases.
- if (codeset == OSFCodeSetRegistry.UCS_2)
- return new UTF16CTBConverter(littleEndian);
-
- // We can write UTF-16 with or without a byte order marker.
- if (codeset == OSFCodeSetRegistry.UTF_16) {
- if (useByteOrderMarkers)
- return new UTF16CTBConverter();
- else
- return new UTF16CTBConverter(littleEndian);
- }
-
- // Everything else uses the generic JavaCTBConverter.
- //
- // Variable width encodings are aligned on 1 byte boundaries.
- // A fixed width encoding with a max. of 4 bytes/char should
- // align on a 4 byte boundary. Note that UTF-16 is a special
- // case because of the optional byte order marker, so it's
- // handled above.
- //
- // This doesn't matter for GIOP 1.2 wchars and wstrings
- // since the encoded bytes are treated as an encapsulation.
- int alignment = (!codeset.isFixedWidth() ?
- 1 :
- codeset.getMaxBytesPerChar());
-
- return new JavaCTBConverter(codeset, alignment);
- }
-
- /**
- * BTCConverter factory for single byte or variable width encodings.
- */
- public BTCConverter getBTCConverter(OSFCodeSetRegistry.Entry codeset) {
- return new JavaBTCConverter(codeset);
- }
-
- /**
- * BTCConverter factory for fixed width multibyte encodings.
- */
- public BTCConverter getBTCConverter(OSFCodeSetRegistry.Entry codeset,
- boolean defaultToLittleEndian) {
-
- if (codeset == OSFCodeSetRegistry.UTF_16 ||
- codeset == OSFCodeSetRegistry.UCS_2) {
-
- return new UTF16BTCConverter(defaultToLittleEndian);
- } else {
- return new JavaBTCConverter(codeset);
- }
- }
-
- /**
- * Follows the code set negotiation algorithm in CORBA formal 99-10-07 13.7.2.
- *
- * Returns the proper negotiated OSF character encoding number or
- * CodeSetConversion.FALLBACK_CODESET.
- */
- private int selectEncoding(CodeSetComponentInfo.CodeSetComponent client,
- CodeSetComponentInfo.CodeSetComponent server) {
-
- // A "null" value for the server's nativeCodeSet means that
- // the server desired not to indicate one. We'll take that
- // to mean that it wants the first thing in its conversion list.
- // If it's conversion list is empty, too, then use the fallback
- // codeset.
- int serverNative = server.nativeCodeSet;
-
- if (serverNative == 0) {
- if (server.conversionCodeSets.length > 0)
- serverNative = server.conversionCodeSets[0];
- else
- return CodeSetConversion.FALLBACK_CODESET;
- }
-
- if (client.nativeCodeSet == serverNative) {
- // Best case -- client and server don't have to convert
- return serverNative;
- }
-
- // Is this client capable of converting to the server's
- // native code set?
- for (int i = 0; i < client.conversionCodeSets.length; i++) {
- if (serverNative == client.conversionCodeSets[i]) {
- // The client will convert to the server's
- // native code set.
- return serverNative;
- }
- }
-
- // Is the server capable of converting to the client's
- // native code set?
- for (int i = 0; i < server.conversionCodeSets.length; i++) {
- if (client.nativeCodeSet == server.conversionCodeSets[i]) {
- // The server will convert to the client's
- // native code set.
- return client.nativeCodeSet;
- }
- }
-
- // See if there are any code sets that both the server and client
- // support (giving preference to the server). The order
- // of conversion sets is from most to least desired.
- for (int i = 0; i < server.conversionCodeSets.length; i++) {
- for (int y = 0; y < client.conversionCodeSets.length; y++) {
- if (server.conversionCodeSets[i] == client.conversionCodeSets[y]) {
- return server.conversionCodeSets[i];
- }
- }
- }
-
- // Before using the fallback codesets, the spec calls for a
- // compatibility check on the native code sets. It doesn't make
- // sense because loss free communication is always possible with
- // UTF8 and UTF16, the fall back code sets. It's also a lot
- // of work to implement. In the case of incompatibility, the
- // spec says to throw a CODESET_INCOMPATIBLE exception.
-
- // Use the fallback
- return CodeSetConversion.FALLBACK_CODESET;
- }
-
- /**
- * Perform the code set negotiation algorithm and come up with
- * the two encodings to use.
- */
- public CodeSetComponentInfo.CodeSetContext negotiate(CodeSetComponentInfo client,
- CodeSetComponentInfo server) {
- int charData
- = selectEncoding(client.getCharComponent(),
- server.getCharComponent());
-
- if (charData == CodeSetConversion.FALLBACK_CODESET) {
- charData = OSFCodeSetRegistry.UTF_8.getNumber();
- }
-
- int wcharData
- = selectEncoding(client.getWCharComponent(),
- server.getWCharComponent());
-
- if (wcharData == CodeSetConversion.FALLBACK_CODESET) {
- wcharData = OSFCodeSetRegistry.UTF_16.getNumber();
- }
-
- return new CodeSetComponentInfo.CodeSetContext(charData,
- wcharData);
- }
-
- // No one should instantiate a CodeSetConversion but the singleton
- // instance method
- private CodeSetConversion() {}
-
- // initialize-on-demand holder
- private static class CodeSetConversionHolder {
- static final CodeSetConversion csc = new CodeSetConversion() ;
- }
-
- /**
- * CodeSetConversion is a singleton, and this is the access point.
- */
- public final static CodeSetConversion impl() {
- return CodeSetConversionHolder.csc ;
- }
-
- // Singleton instance
- private static CodeSetConversion implementation;
-
- // Number used internally to indicate the fallback code
- // set.
- private static final int FALLBACK_CODESET = 0;
-
- // Provides a thread local cache for the sun.io
- // converters.
- private CodeSetCache cache = new CodeSetCache();
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java
deleted file mode 100644
index 7853812..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.ByteBuffer;
-import org.omg.CORBA.CompletionStatus;
-import com.sun.org.omg.SendingContext.CodeBase;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.BufferManagerFactory;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-import sun.corba.EncapsInputStreamFactory;
-/**
- * Encapsulations are supposed to explicitly define their
- * code sets and GIOP version. The original resolution to issue 2784
- * said that the defaults were UTF-8 and UTF-16, but that was not
- * agreed upon.
- *
- * These streams currently use CDR 1.2 with ISO8859-1 for char/string and
- * UTF16 for wchar/wstring. If no byte order marker is available,
- * the endianness of the encapsulation is used.
- *
- * When more encapsulations arise that have their own special code
- * sets defined, we can make all constructors take such parameters.
- */
-public class EncapsInputStream extends CDRInputStream
-{
- private ORBUtilSystemException wrapper ;
-
- // corba/EncapsOutputStream
- // corba/ORBSingleton
- // iiop/ORB
- public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] buf,
- int size, boolean littleEndian,
- GIOPVersion version) {
- super(orb, ByteBuffer.wrap(buf), size, littleEndian,
- version, Message.CDR_ENC_VERSION,
- BufferManagerFactory.newBufferManagerRead(
- BufferManagerFactory.GROW,
- Message.CDR_ENC_VERSION,
- (ORB)orb));
-
- wrapper = ORBUtilSystemException.get( (ORB)orb,
- CORBALogDomains.RPC_ENCODING ) ;
-
- performORBVersionSpecificInit();
- }
-
- public EncapsInputStream(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer,
- int size, boolean littleEndian,
- GIOPVersion version) {
- super(orb, byteBuffer, size, littleEndian,
- version, Message.CDR_ENC_VERSION,
- BufferManagerFactory.newBufferManagerRead(
- BufferManagerFactory.GROW,
- Message.CDR_ENC_VERSION,
- (com.sun.corba.se.spi.orb.ORB)orb));
-
- performORBVersionSpecificInit();
- }
-
- // ior/IdentifiableBase
- // ior/IIOPProfile
- // corba/ORBSingleton
- // iiop/ORB
- public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size)
- {
- this(orb, data, size, GIOPVersion.V1_2);
- }
-
- // corba/AnyImpl
- public EncapsInputStream(EncapsInputStream eis)
- {
- super(eis);
-
- wrapper = ORBUtilSystemException.get( (ORB)(eis.orb()),
- CORBALogDomains.RPC_ENCODING ) ;
-
- performORBVersionSpecificInit();
- }
-
- // CDREncapsCodec
- // ServiceContext
- //
- // Assumes big endian (can use consumeEndian to read and set
- // the endianness if it is an encapsulation with a byte order
- // mark at the beginning)
- public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size, GIOPVersion version)
- {
- this(orb, data, size, false, version);
- }
-
- /**
- * Full constructor with a CodeBase parameter useful for
- * unmarshaling RMI-IIOP valuetypes (technically against the
- * intention of an encapsulation, but necessary due to OMG
- * issue 4795. Used by ServiceContexts.
- */
- public EncapsInputStream(org.omg.CORBA.ORB orb,
- byte[] data,
- int size,
- GIOPVersion version,
- CodeBase codeBase) {
- super(orb,
- ByteBuffer.wrap(data),
- size,
- false,
- version, Message.CDR_ENC_VERSION,
- BufferManagerFactory.newBufferManagerRead(
- BufferManagerFactory.GROW,
- Message.CDR_ENC_VERSION,
- (ORB)orb));
-
- this.codeBase = codeBase;
-
- performORBVersionSpecificInit();
- }
-
- public CDRInputStream dup() {
- return EncapsInputStreamFactory.newEncapsInputStream(this);
- }
-
- protected CodeSetConversion.BTCConverter createCharBTCConverter() {
- return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1);
- }
-
- protected CodeSetConversion.BTCConverter createWCharBTCConverter() {
- // Wide characters don't exist in GIOP 1.0
- if (getGIOPVersion().equals(GIOPVersion.V1_0))
- throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE);
-
- // In GIOP 1.1, we shouldn't have byte order markers. Take the order
- // of the stream if we don't see them.
- if (getGIOPVersion().equals(GIOPVersion.V1_1))
- return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.UTF_16,
- isLittleEndian());
-
- // Assume anything else adheres to GIOP 1.2 requirements.
- //
- // Our UTF_16 converter will work with byte order markers, and if
- // they aren't present, it will use the provided endianness.
- //
- // With no byte order marker, it's big endian in GIOP 1.2.
- // formal 00-11-03 15.3.16.
- return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.UTF_16,
- false);
- }
-
- public CodeBase getCodeBase() {
- return codeBase;
- }
-
- private CodeBase codeBase;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java
deleted file mode 100644
index 4f908dc..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-import com.sun.corba.se.impl.encoding.BufferManagerWrite;
-import com.sun.corba.se.impl.encoding.BufferManagerFactory;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-import sun.corba.EncapsInputStreamFactory;
-
-/**
- * Encapsulations are supposed to explicitly define their
- * code sets and GIOP version. The original resolution to issue 2784
- * said that the defaults were UTF-8 and UTF-16, but that was not
- * agreed upon.
- *
- * These streams currently use CDR 1.2 with ISO8859-1 for char/string and
- * UTF16 for wchar/wstring. If no byte order marker is available,
- * the endianness of the encapsulation is used.
- *
- * When more encapsulations arise that have their own special code
- * sets defined, we can make all constructors take such parameters.
- */
-public class EncapsOutputStream extends CDROutputStream
-{
-
- // REVISIT - Right now, EncapsOutputStream's do not use
- // pooled byte buffers. This is controlled by the following
- // static constant. This should be re-factored such that
- // the EncapsOutputStream doesn't know it's using pooled
- // byte buffers.
- final static boolean usePooledByteBuffers = false;
-
- // REVISIT - Right now, valuetypes in encapsulations will
- // only use stream format version 1, which may create problems
- // for service contexts or codecs (?).
-
- // corba/ORB
- // corba/ORBSingleton
- // iiop/ORB
- // iiop/GIOPImpl
- // corba/AnyImpl
- public EncapsOutputStream(ORB orb) {
- // GIOP version 1.2 with no fragmentation, big endian,
- // UTF8 for char data and UTF-16 for wide char data;
- this(orb, GIOPVersion.V1_2);
- }
-
- // CDREncapsCodec
- //
- // REVISIT. A UTF-16 encoding with GIOP 1.1 will not work
- // with byte order markers.
- public EncapsOutputStream(ORB orb, GIOPVersion version) {
- this(orb, version, false);
- }
-
- // Used by IIOPProfileTemplate
- //
- public EncapsOutputStream(ORB orb, boolean isLittleEndian) {
- this(orb, GIOPVersion.V1_2, isLittleEndian);
- }
-
- public EncapsOutputStream(ORB orb,
- GIOPVersion version,
- boolean isLittleEndian)
- {
- super(orb, version, Message.CDR_ENC_VERSION, isLittleEndian,
- BufferManagerFactory.newBufferManagerWrite(
- BufferManagerFactory.GROW,
- Message.CDR_ENC_VERSION,
- orb),
- ORBConstants.STREAM_FORMAT_VERSION_1,
- usePooledByteBuffers);
- }
-
- public org.omg.CORBA.portable.InputStream create_input_stream() {
- freeInternalCaches();
-
- return EncapsInputStreamFactory.newEncapsInputStream(orb(),
- getByteBuffer(),
- getSize(),
- isLittleEndian(),
- getGIOPVersion());
- }
-
- protected CodeSetConversion.CTBConverter createCharCTBConverter() {
- return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1);
- }
-
- protected CodeSetConversion.CTBConverter createWCharCTBConverter() {
- if (getGIOPVersion().equals(GIOPVersion.V1_0))
- throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE);
-
- // In the case of GIOP 1.1, we take the byte order of the stream and don't
- // use byte order markers since we're limited to a 2 byte fixed width encoding.
- if (getGIOPVersion().equals(GIOPVersion.V1_1))
- return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16,
- isLittleEndian(),
- false);
-
- // Assume anything else meets GIOP 1.2 requirements
- //
- // Use byte order markers? If not, use big endian in GIOP 1.2.
- // (formal 00-11-03 15.3.16)
-
- boolean useBOM = ((ORB)orb()).getORBData().useByteOrderMarkersInEncapsulations();
-
- return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16,
- false,
- useBOM);
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationInputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationInputStream.java
deleted file mode 100644
index 12ca370..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationInputStream.java
+++ /dev/null
@@ -1,1083 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.Serializable;
-import java.io.ObjectInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.math.BigDecimal;
-import java.util.LinkedList;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactories;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
-import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
-
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.impl.util.RepositoryId;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.portable.IDLEntity;
-
-/**
- * Implementation class that uses Java serialization for input streams.
- * This assumes a GIOP version 1.2 message format.
- *
- * This class uses a ByteArrayInputStream as the underlying buffer. The
- * first 16 bytes are directly read out of the underlying buffer. This allows
- * [GIOPHeader (12 bytes) + requestID (4 bytes)] to be read as bytes.
- * Subsequent write operations on this output stream object uses
- * ObjectInputStream class to read into the buffer. This allows unmarshaling
- * complex types and graphs using the ObjectInputStream implementation.
- *
- * Note, this class assumes a GIOP 1.2 style header. Further, the first
- * 12 bytes, that is, the GIOPHeader is read directly from the received
- * message, before this stream object is called. So, this class effectively
- * reads only the requestID (4 bytes) directly, and uses the
- * ObjectInputStream for further unmarshaling.
- *
- * @author Ram Jeyaraman
- */
-public class IDLJavaSerializationInputStream extends CDRInputStreamBase {
-
- private ORB orb;
- private int bufSize;
- private ByteBuffer buffer;
- private byte encodingVersion;
- private ObjectInputStream is;
- private _ByteArrayInputStream bis;
- private BufferManagerRead bufferManager;
-
- // [GIOPHeader(12) + requestID(4)] bytes
- private final int directReadLength = Message.GIOPMessageHeaderLength + 4;
-
- // Used for mark / reset operations.
- private boolean markOn;
- private int peekIndex, peekCount;
- private LinkedList markedItemQ = new LinkedList();
-
- protected ORBUtilSystemException wrapper;
-
- class _ByteArrayInputStream extends ByteArrayInputStream {
-
- _ByteArrayInputStream(byte[] buf) {
- super(buf);
- }
-
- int getPosition() {
- return this.pos;
- }
-
- void setPosition(int value) {
- if (value < 0 || value > count) {
- throw new IndexOutOfBoundsException();
- }
- this.pos = value;
- }
- }
-
- class MarshalObjectInputStream extends ObjectInputStream {
-
- ORB orb;
-
- MarshalObjectInputStream(java.io.InputStream out, ORB orb)
- throws IOException {
-
- super(out);
- this.orb = orb;
-
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
- // needs SerializablePermission("enableSubstitution")
- enableResolveObject(true);
- return null;
- }
- }
- );
- }
-
- /**
- * Connect the Stub to the ORB.
- */
- protected final Object resolveObject(Object obj) throws IOException {
- try {
- if (StubAdapter.isStub(obj)) {
- StubAdapter.connect(obj, orb);
- }
- } catch (java.rmi.RemoteException re) {
- IOException ie = new IOException("resolveObject failed");
- ie.initCause(re);
- throw ie;
- }
- return obj;
- }
- }
-
- public IDLJavaSerializationInputStream(byte encodingVersion) {
- super();
- this.encodingVersion = encodingVersion;
- }
-
- public void init(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int bufSize,
- boolean littleEndian,
- BufferManagerRead bufferManager) {
- this.orb = (ORB) orb;
- this.bufSize = bufSize;
- this.bufferManager = bufferManager;
- buffer = byteBuffer;
- wrapper =
- ORBUtilSystemException.get((ORB)orb, CORBALogDomains.RPC_ENCODING);
-
- byte[] buf;
- if (buffer.hasArray()) {
- buf = buffer.array();
- } else {
- buf = new byte[bufSize];
- buffer.get(buf);
- }
- // Note: at this point, the buffer position is zero. The setIndex()
- // method call can be used to set a desired read index.
- bis = new _ByteArrayInputStream(buf);
- }
-
- // Called from read_octet or read_long or read_ulong method.
- private void initObjectInputStream() {
- //System.out.print(" is ");
- if (is != null) {
- throw wrapper.javaStreamInitFailed();
- }
- try {
- is = new MarshalObjectInputStream(bis, orb);
- } catch (Exception e) {
- throw wrapper.javaStreamInitFailed(e);
- }
- }
-
- // org.omg.CORBA.portable.InputStream
-
- // Primitive types.
-
- public boolean read_boolean() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Boolean)markedItemQ.removeFirst()).booleanValue();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Boolean)markedItemQ.get(peekIndex++)).booleanValue();
- }
- try {
- boolean value = is.readBoolean();
- if (markOn) { // enqueue
- markedItemQ.addLast(Boolean.valueOf(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_boolean");
- }
- }
-
- public char read_char() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Character)markedItemQ.removeFirst()).charValue();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Character)markedItemQ.get(peekIndex++)).charValue();
- }
- try {
- char value = is.readChar();
- if (markOn) { // enqueue
- markedItemQ.addLast(new Character(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_char");
- }
- }
-
- public char read_wchar() {
- return this.read_char();
- }
-
- public byte read_octet() {
-
- // check if size < [ GIOPHeader(12) + requestID(4)] bytes
- if (bis.getPosition() < directReadLength) {
- byte b = (byte) bis.read();
- if (bis.getPosition() == directReadLength) {
- initObjectInputStream();
- }
- return b;
- }
-
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Byte)markedItemQ.removeFirst()).byteValue();
- }
-
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Byte)markedItemQ.get(peekIndex++)).byteValue();
- }
-
- try {
- byte value = is.readByte();
- if (markOn) { // enqueue
- //markedItemQ.addLast(Byte.valueOf(value)); // only in JDK 1.5
- markedItemQ.addLast(new Byte(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_octet");
- }
- }
-
- public short read_short() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Short)markedItemQ.removeFirst()).shortValue();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Short)markedItemQ.get(peekIndex++)).shortValue();
- }
-
- try {
- short value = is.readShort();
- if (markOn) { // enqueue
- markedItemQ.addLast(new Short(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_short");
- }
- }
-
- public short read_ushort() {
- return this.read_short();
- }
-
- public int read_long() {
-
- // check if size < [ GIOPHeader(12) + requestID(4)] bytes
- if (bis.getPosition() < directReadLength) {
-
- // Use big endian (network byte order). This is fixed.
- // Both the writer and reader use the same byte order.
- int b1 = (bis.read() << 24) & 0xFF000000;
- int b2 = (bis.read() << 16) & 0x00FF0000;
- int b3 = (bis.read() << 8) & 0x0000FF00;
- int b4 = (bis.read() << 0) & 0x000000FF;
-
- if (bis.getPosition() == directReadLength) {
- initObjectInputStream();
- } else if (bis.getPosition() > directReadLength) {
- // Cannot happen. All direct reads are contained
- // within the first 16 bytes.
- wrapper.javaSerializationException("read_long");
- }
-
- return (b1 | b2 | b3 | b4);
- }
-
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Integer)markedItemQ.removeFirst()).intValue();
- }
-
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Integer)markedItemQ.get(peekIndex++)).intValue();
- }
-
- try {
- int value = is.readInt();
- if (markOn) { // enqueue
- markedItemQ.addLast(new Integer(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_long");
- }
- }
-
- public int read_ulong() {
- return this.read_long();
- }
-
- public long read_longlong() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Long)markedItemQ.removeFirst()).longValue();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Long)markedItemQ.get(peekIndex++)).longValue();
- }
-
- try {
- long value = is.readLong();
- if (markOn) { // enqueue
- markedItemQ.addLast(new Long(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_longlong");
- }
- }
-
- public long read_ulonglong() {
- return read_longlong();
- }
-
- public float read_float() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Float)markedItemQ.removeFirst()).floatValue();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Float)markedItemQ.get(peekIndex++)).floatValue();
- }
-
- try {
- float value = is.readFloat();
- if (markOn) { // enqueue
- markedItemQ.addLast(new Float(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_float");
- }
- }
-
- public double read_double() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Double)markedItemQ.removeFirst()).doubleValue();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Double)markedItemQ.get(peekIndex++)).doubleValue();
- }
-
- try {
- double value = is.readDouble();
- if (markOn) { // enqueue
- markedItemQ.addLast(new Double(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_double");
- }
- }
-
- // String types.
-
- public String read_string() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return (String) markedItemQ.removeFirst();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return (String) markedItemQ.get(peekIndex++);
- }
- try {
- String value = is.readUTF();
- if (markOn) { // enqueue
- markedItemQ.addLast(value);
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_string");
- }
- }
-
- public String read_wstring() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return (String) markedItemQ.removeFirst();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return (String) markedItemQ.get(peekIndex++);
- }
- try {
- String value = (String) is.readObject();
- if (markOn) { // enqueue
- markedItemQ.addLast(value);
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_wstring");
- }
- }
-
- // Array types.
-
- public void read_boolean_array(boolean[] value, int offset, int length){
- for(int i = 0; i < length; i++) {
- value[i+offset] = read_boolean();
- }
- }
-
- public void read_char_array(char[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_char();
- }
- }
-
- public void read_wchar_array(char[] value, int offset, int length) {
- read_char_array(value, offset, length);
- }
-
- public void read_octet_array(byte[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_octet();
- }
- /* // Cannot use this efficient read due to mark/reset support.
- try {
- while (length > 0) {
- int n = is.read(value, offset, length);
- offset += n;
- length -= n;
- }
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_octet_array");
- }
- */
- }
-
- public void read_short_array(short[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_short();
- }
- }
-
- public void read_ushort_array(short[] value, int offset, int length) {
- read_short_array(value, offset, length);
- }
-
- public void read_long_array(int[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_long();
- }
- }
-
- public void read_ulong_array(int[] value, int offset, int length) {
- read_long_array(value, offset, length);
- }
-
- public void read_longlong_array(long[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_longlong();
- }
- }
-
- public void read_ulonglong_array(long[] value, int offset, int length) {
- read_longlong_array(value, offset, length);
- }
-
- public void read_float_array(float[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_float();
- }
- }
-
- public void read_double_array(double[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_double();
- }
- }
-
- // Complex types.
-
- public org.omg.CORBA.Object read_Object() {
- return read_Object(null);
- }
-
- public TypeCode read_TypeCode() {
- TypeCodeImpl tc = new TypeCodeImpl(orb);
- tc.read_value(parent);
- return tc;
- }
-
- public Any read_any() {
-
- Any any = orb.create_any();
- TypeCodeImpl tc = new TypeCodeImpl(orb);
-
- // read off the typecode
-
- // REVISIT We could avoid this try-catch if we could peek the typecode
- // kind off this stream and see if it is a tk_value.
- // Looking at the code we know that for tk_value the Any.read_value()
- // below ignores the tc argument anyway (except for the kind field).
- // But still we would need to make sure that the whole typecode,
- // including encapsulations, is read off.
- try {
- tc.read_value(parent);
- } catch (org.omg.CORBA.MARSHAL ex) {
- if (tc.kind().value() != org.omg.CORBA.TCKind._tk_value) {
- throw ex;
- }
- // We can be sure that the whole typecode encapsulation has been
- // read off.
- ex.printStackTrace();
- }
-
- // read off the value of the any.
- any.read_value(parent, tc);
-
- return any;
- }
-
- public Principal read_Principal() {
- // We don't need an implementation for this method, since principal
- // is absent in GIOP version 1.2 or above.
- int len = read_long();
- byte[] pvalue = new byte[len];
- read_octet_array(pvalue,0,len);
- Principal p = new com.sun.corba.se.impl.corba.PrincipalImpl();
- p.name(pvalue);
- return p;
- }
-
- public BigDecimal read_fixed() {
- return new BigDecimal(read_fixed_buffer().toString());
- }
-
- // Each octet contains (up to) two decimal digits. If the fixed type has
- // an odd number of decimal digits, then the representation
- // begins with the first (most significant) digit.
- // Otherwise, this first half-octet is all zero, and the first digit
- // is in the second half-octet.
- // The sign configuration, in the last half-octet of the representation,
- // is 0xD for negative numbers and 0xC for positive and zero values.
- private StringBuffer read_fixed_buffer() {
- StringBuffer buffer = new StringBuffer(64);
- byte doubleDigit;
- int firstDigit;
- int secondDigit;
- boolean wroteFirstDigit = false;
- boolean more = true;
- while (more) {
- doubleDigit = read_octet();
- firstDigit = (int)((doubleDigit & 0xf0) >> 4);
- secondDigit = (int)(doubleDigit & 0x0f);
- if (wroteFirstDigit || firstDigit != 0) {
- buffer.append(Character.forDigit(firstDigit, 10));
- wroteFirstDigit = true;
- }
- if (secondDigit == 12) {
- // positive number or zero
- if ( ! wroteFirstDigit) {
- // zero
- return new StringBuffer("0.0");
- } else {
- // positive number
- // done
- }
- more = false;
- } else if (secondDigit == 13) {
- // negative number
- buffer.insert(0, '-');
- more = false;
- } else {
- buffer.append(Character.forDigit(secondDigit, 10));
- wroteFirstDigit = true;
- }
- }
- return buffer;
- }
-
- public org.omg.CORBA.Object read_Object(java.lang.Class clz) {
-
- // In any case, we must first read the IOR.
- IOR ior = IORFactories.makeIOR(parent) ;
- if (ior.isNil()) {
- return null;
- }
-
- PresentationManager.StubFactoryFactory sff =
- ORB.getStubFactoryFactory();
- String codeBase = ior.getProfile().getCodebase();
- PresentationManager.StubFactory stubFactory = null;
-
- if (clz == null) {
- RepositoryId rid = RepositoryId.cache.getId(ior.getTypeId() );
- String className = rid.getClassName();
- boolean isIDLInterface = rid.isIDLType();
-
- if (className == null || className.equals( "" )) {
- stubFactory = null;
- } else {
- try {
- stubFactory = sff.createStubFactory(className,
- isIDLInterface, codeBase, (Class) null,
- (ClassLoader) null);
- } catch (Exception exc) {
- // Could not create stubFactory, so use null.
- // XXX stubFactory handling is still too complex:
- // Can we resolve the stubFactory question once in
- // a single place?
- stubFactory = null ;
- }
- }
- } else if (StubAdapter.isStubClass(clz)) {
- stubFactory = PresentationDefaults.makeStaticStubFactory(clz);
- } else {
- // clz is an interface class
- boolean isIDL = IDLEntity.class.isAssignableFrom(clz);
-
- stubFactory = sff.createStubFactory(
- clz.getName(), isIDL, codeBase, clz, clz.getClassLoader());
- }
-
- return CDRInputStream_1_0.internalIORToObject(ior, stubFactory, orb);
- }
-
- public org.omg.CORBA.ORB orb() {
- return this.orb;
- }
-
- // org.omg.CORBA_2_3.portable.InputStream
-
- public java.io.Serializable read_value() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return (Serializable) markedItemQ.removeFirst();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return (Serializable) markedItemQ.get(peekIndex++);
- }
- try {
- Serializable value = (java.io.Serializable) is.readObject();
- if (markOn) { // enqueue
- markedItemQ.addLast(value);
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_value");
- }
- }
-
- public java.io.Serializable read_value(java.lang.Class clz) {
- return read_value();
- }
-
- public java.io.Serializable read_value(
- org.omg.CORBA.portable.BoxedValueHelper factory) {
- return read_value();
- }
-
- public java.io.Serializable read_value(java.lang.String rep_id) {
- return read_value();
- }
-
- public java.io.Serializable read_value(java.io.Serializable value) {
- return read_value();
- }
-
- public java.lang.Object read_abstract_interface() {
- return read_abstract_interface(null);
- }
-
- public java.lang.Object read_abstract_interface(java.lang.Class clz) {
- boolean isObject = read_boolean();
- if (isObject) {
- return read_Object(clz);
- } else {
- return read_value();
- }
- }
-
- // com.sun.corba.se.impl.encoding.MarshalInputStream
- public void consumeEndian() {
- throw wrapper.giopVersionError();
- }
-
- public int getPosition() {
- try {
- return bis.getPosition();
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "getPosition");
- }
- }
-
- // org.omg.CORBA.DataInputStream
- public java.lang.Object read_Abstract() {
- return read_abstract_interface();
- }
-
- public java.io.Serializable read_Value() {
- return read_value();
- }
-
- public void read_any_array (org.omg.CORBA.AnySeqHolder seq,
- int offset, int length) {
- read_any_array(seq.value, offset, length);
- }
-
- private final void read_any_array(org.omg.CORBA.Any[] value,
- int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_any();
- }
- }
-
- public void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq,
- int offset, int length){
- read_boolean_array(seq.value, offset, length);
- }
-
- public void read_char_array (org.omg.CORBA.CharSeqHolder seq,
- int offset, int length){
- read_char_array(seq.value, offset, length);
- }
-
- public void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq,
- int offset, int length){
- read_wchar_array(seq.value, offset, length);
- }
-
- public void read_octet_array (org.omg.CORBA.OctetSeqHolder seq,
- int offset, int length){
- read_octet_array(seq.value, offset, length);
- }
-
- public void read_short_array (org.omg.CORBA.ShortSeqHolder seq,
- int offset, int length){
- read_short_array(seq.value, offset, length);
- }
-
- public void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq,
- int offset, int length){
- read_ushort_array(seq.value, offset, length);
- }
-
- public void read_long_array (org.omg.CORBA.LongSeqHolder seq,
- int offset, int length){
- read_long_array(seq.value, offset, length);
- }
-
- public void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq,
- int offset, int length){
- read_ulong_array(seq.value, offset, length);
- }
-
- public void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq,
- int offset, int length){
- read_ulonglong_array(seq.value, offset, length);
- }
-
- public void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq,
- int offset, int length){
- read_longlong_array(seq.value, offset, length);
- }
-
- public void read_float_array (org.omg.CORBA.FloatSeqHolder seq,
- int offset, int length){
- read_float_array(seq.value, offset, length);
- }
-
- public void read_double_array (org.omg.CORBA.DoubleSeqHolder seq,
- int offset, int length){
- read_double_array(seq.value, offset, length);
- }
-
- // org.omg.CORBA.portable.ValueBase
-
- public String[] _truncatable_ids() {
- throw wrapper.giopVersionError();
- }
-
- // java.io.InputStream
- // REVISIT - should we make these throw UnsupportedOperationExceptions?
- // Right now, they'll go up to the java.io versions!
-
- // public int read(byte b[]) throws IOException;
- // public int read(byte b[], int off, int len) throws IOException
- // public long skip(long n) throws IOException;
- // public int available() throws IOException;
- // public void close() throws IOException;
-
- public void mark(int readLimit) {
- // Nested mark disallowed.
- // Further, mark is not supported until first 16 bytes are read.
- if (markOn || is == null) {
- throw wrapper.javaSerializationException("mark");
- }
- markOn = true;
- if (!(markedItemQ.isEmpty())) {
- peekIndex = 0;
- peekCount = markedItemQ.size();
- }
- /*
- // Note: only ByteArrayInputStream supports mark/reset.
- if (is == null || is.markSupported() == false) {
- throw wrapper.javaSerializationException("mark");
- }
- is.mark(readLimit);
- */
- }
-
- public void reset() {
- markOn = false;
- peekIndex = 0;
- peekCount = 0;
- /*
- // Note: only ByteArrayInputStream supports mark/reset.
- if (is == null || is.markSupported() == false) {
- throw wrapper.javaSerializationException("mark");
- }
- try {
- is.reset();
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "reset");
- }
- */
- }
-
- // This should return false so that outside users (people using the JDK)
- // don't have any guarantees that mark/reset will work in their
- // custom marshaling code. This is necessary since they could do things
- // like expect obj1a == obj1b in the following code:
- //
- // is.mark(10000);
- // Object obj1a = is.readObject();
- // is.reset();
- // Object obj1b = is.readObject();
- //
- public boolean markSupported() {
- return true;
- }
-
- // Needed by AnyImpl and ServiceContexts
- public CDRInputStreamBase dup() {
-
- CDRInputStreamBase result = null ;
-
- try {
- result = (CDRInputStreamBase) this.getClass().newInstance();
- } catch (Exception e) {
- throw wrapper.couldNotDuplicateCdrInputStream(e);
- }
-
- result.init(this.orb, this.buffer, this.bufSize, false, null);
-
- // Set the buffer position.
- ((IDLJavaSerializationInputStream)result).skipBytes(getPosition());
-
- // Set mark related data.
- ((IDLJavaSerializationInputStream)result).
- setMarkData(markOn, peekIndex, peekCount,
- (LinkedList) markedItemQ.clone());
-
- return result;
- }
-
- // Used exclusively by the dup() method.
- void skipBytes(int len) {
- try {
- is.skipBytes(len);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "skipBytes");
- }
- }
-
- // Used exclusively by the dup() method.
- void setMarkData(boolean markOn, int peekIndex, int peekCount,
- LinkedList markedItemQ) {
- this.markOn = markOn;
- this.peekIndex = peekIndex;
- this.peekCount = peekCount;
- this.markedItemQ = markedItemQ;
- }
-
- // Needed by TCUtility
- public java.math.BigDecimal read_fixed(short digits, short scale) {
- // digits isn't really needed here
- StringBuffer buffer = read_fixed_buffer();
- if (digits != buffer.length())
- throw wrapper.badFixed( new Integer(digits),
- new Integer(buffer.length()) ) ;
- buffer.insert(digits - scale, '.');
- return new BigDecimal(buffer.toString());
- }
-
- // Needed by TypeCodeImpl
- public boolean isLittleEndian() {
- throw wrapper.giopVersionError();
- }
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- void setHeaderPadding(boolean headerPadding) {
- // no-op. We don't care about body alignment while using
- // Java serialization. What the GIOP spec states does not apply here.
- }
-
- // Needed by IIOPInputStream and other subclasses
-
- public ByteBuffer getByteBuffer() {
- throw wrapper.giopVersionError();
- }
-
- public void setByteBuffer(ByteBuffer byteBuffer) {
- throw wrapper.giopVersionError();
- }
-
- public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- throw wrapper.giopVersionError();
- }
-
- public int getBufferLength() {
- return bufSize;
- }
-
- public void setBufferLength(int value) {
- // this is redundant, since buffer size was already specified
- // as part of the init call. So, ignore.
- }
-
- public int getIndex() {
- return bis.getPosition();
- }
-
- public void setIndex(int value) {
- try {
- bis.setPosition(value);
- } catch (IndexOutOfBoundsException e) {
- throw wrapper.javaSerializationException(e, "setIndex");
- }
- }
-
- public void orb(org.omg.CORBA.ORB orb) {
- this.orb = (ORB) orb;
- }
-
- public BufferManagerRead getBufferManager() {
- return bufferManager;
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_2;
- }
-
- com.sun.org.omg.SendingContext.CodeBase getCodeBase() {
- return parent.getCodeBase();
- }
-
- void printBuffer() {
- byte[] buf = this.buffer.array();
-
- System.out.println("+++++++ Input Buffer ++++++++");
- System.out.println();
- System.out.println("Current position: " + getPosition());
- System.out.println("Total length : " + this.bufSize);
- System.out.println();
-
- char[] charBuf = new char[16];
-
- try {
-
- for (int i = 0; i < buf.length; i += 16) {
-
- int j = 0;
-
- // For every 16 bytes, there is one line
- // of output. First, the hex output of
- // the 16 bytes with each byte separated
- // by a space.
- while (j < 16 && j + i < buf.length) {
- int k = buf[i + j];
- if (k < 0)
- k = 256 + k;
- String hex = Integer.toHexString(k);
- if (hex.length() == 1)
- hex = "0" + hex;
- System.out.print(hex + " ");
- j++;
- }
-
- // Add any extra spaces to align the
- // text column in case we didn't end
- // at 16
- while (j < 16) {
- System.out.print(" ");
- j++;
- }
-
- // Now output the ASCII equivalents. Non-ASCII
- // characters are shown as periods.
- int x = 0;
-
- while (x < 16 && x + i < buf.length) {
- if (ORBUtility.isPrintable((char)buf[i + x])) {
- charBuf[x] = (char) buf[i + x];
- } else {
- charBuf[x] = '.';
- }
- x++;
- }
- System.out.println(new String(charBuf, 0, x));
- }
- } catch (Throwable t) {
- t.printStackTrace();
- }
- System.out.println("++++++++++++++++++++++++++++++");
- }
-
- void alignOnBoundary(int octetBoundary) {
- throw wrapper.giopVersionError();
- }
-
- void performORBVersionSpecificInit() {
- // No-op.
- }
-
- public void resetCodeSetConverters() {
- // No-op.
- }
-
- // ValueInputStream -------------------------
-
- public void start_value() {
- throw wrapper.giopVersionError();
- }
-
- public void end_value() {
- throw wrapper.giopVersionError();
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java
deleted file mode 100644
index 6914e0e..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java
+++ /dev/null
@@ -1,798 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.ByteArrayOutputStream;
-
-import java.nio.ByteBuffer;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactories;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.CompletionStatus;
-
-/**
- * Implementation class that uses Java serialization for output streams.
- * This assumes a GIOP version 1.2 message format.
- *
- * This class uses a ByteArrayOutputStream as the underlying buffer. The
- * first 16 bytes are direct writes into the underlying buffer. This allows
- * [GIOPHeader (12 bytes) + requestID (4 bytes)] to be written as bytes.
- * Subsequent write operations on this output stream object uses
- * ObjectOutputStream class to write into the buffer. This allows marshaling
- * complex types and graphs using the ObjectOutputStream implementation.
- *
- * Note, this class assumes a GIOP 1.2 style header. Note, we expect that the
- * first 16 bytes are written only using the write_octet, write_long or
- * write_ulong method calls.
- *
- * @author Ram Jeyaraman
- */
-final class IDLJavaSerializationOutputStream extends CDROutputStreamBase {
-
- private ORB orb;
- private byte encodingVersion;
- private ObjectOutputStream os;
- private _ByteArrayOutputStream bos;
- private BufferManagerWrite bufferManager;
-
- // [GIOPHeader(12) + requestID(4)] bytes
- private final int directWriteLength = Message.GIOPMessageHeaderLength + 4;
-
- protected ORBUtilSystemException wrapper;
-
- class _ByteArrayOutputStream extends ByteArrayOutputStream {
-
- _ByteArrayOutputStream(int initialSize) {
- super(initialSize);
- }
-
- byte[] getByteArray() {
- return this.buf;
- }
- }
-
- class MarshalObjectOutputStream extends ObjectOutputStream {
-
- ORB orb;
-
- MarshalObjectOutputStream(java.io.OutputStream out, ORB orb)
- throws IOException {
-
- super(out);
- this.orb = orb;
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
- // needs SerializablePermission("enableSubstitution")
- enableReplaceObject(true);
- return null;
- }
- }
- );
- }
-
- /**
- * Checks for objects that are instances of java.rmi.Remote
- * that need to be serialized as proxy (Stub) objects.
- */
- protected final Object replaceObject(Object obj) throws IOException {
- try {
- if ((obj instanceof java.rmi.Remote) &&
- !(StubAdapter.isStub(obj))) {
- return Utility.autoConnect(obj, orb, true);
- }
- } catch (Exception e) {
- IOException ie = new IOException("replaceObject failed");
- ie.initCause(e);
- throw ie;
- }
- return obj;
- }
- }
-
- public IDLJavaSerializationOutputStream(byte encodingVersion) {
- super();
- this.encodingVersion = encodingVersion;
- }
-
- public void init(org.omg.CORBA.ORB orb, boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion,
- boolean usePooledByteBuffers) {
- this.orb = (ORB) orb;
- this.bufferManager = bufferManager;
- wrapper = ORBUtilSystemException.get((ORB) orb,
- CORBALogDomains.RPC_ENCODING);
- bos =
- new _ByteArrayOutputStream(ORBConstants.GIOP_DEFAULT_BUFFER_SIZE);
- }
-
- // Called from read_octet or read_long or read_ulong method.
- private void initObjectOutputStream() {
- //System.out.print(" os ");
- if (os != null) {
- throw wrapper.javaStreamInitFailed();
- }
- try {
- os = new MarshalObjectOutputStream(bos, orb);
- } catch (Exception e) {
- throw wrapper.javaStreamInitFailed(e);
- }
- }
-
- // org.omg.CORBA.portable.OutputStream
-
- // Primitive types.
-
- public final void write_boolean(boolean value) {
- try {
- os.writeBoolean(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_boolean");
- }
- }
-
- public final void write_char(char value) {
- try {
- os.writeChar(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_char");
- }
- }
-
- public final void write_wchar(char value) {
- this.write_char(value);
- }
-
- public final void write_octet(byte value) {
-
- // check if size < [ GIOPHeader(12) + requestID(4)] bytes
- if (bos.size() < directWriteLength) {
- bos.write(value); // direct write.
- if (bos.size() == directWriteLength) {
- initObjectOutputStream();
- }
- return;
- }
-
- try {
- os.writeByte(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_octet");
- }
- }
-
- public final void write_short(short value) {
- try {
- os.writeShort(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_short");
- }
- }
-
- public final void write_ushort(short value) {
- this.write_short(value);
- }
-
- public final void write_long(int value) {
-
- // check if size < [ GIOPHeader(12) + requestID(4)] bytes
- if (bos.size() < directWriteLength) {
-
- // Use big endian (network byte order). This is fixed.
- // Both the writer and reader use the same byte order.
- bos.write((byte)((value >>> 24) & 0xFF));
- bos.write((byte)((value >>> 16) & 0xFF));
- bos.write((byte)((value >>> 8) & 0xFF));
- bos.write((byte)((value >>> 0) & 0xFF));
-
- if (bos.size() == directWriteLength) {
- initObjectOutputStream();
- } else if (bos.size() > directWriteLength) {
- // Cannot happen. All direct writes are contained
- // within the first 16 bytes.
- wrapper.javaSerializationException("write_long");
- }
- return;
- }
-
- try {
- os.writeInt(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_long");
- }
- }
-
- public final void write_ulong(int value) {
- this.write_long(value);
- }
-
- public final void write_longlong(long value) {
- try {
- os.writeLong(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_longlong");
- }
- }
-
- public final void write_ulonglong(long value) {
- this.write_longlong(value);
- }
-
- public final void write_float(float value) {
- try {
- os.writeFloat(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_float");
- }
- }
-
- public final void write_double(double value) {
- try {
- os.writeDouble(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_double");
- }
- }
-
- // String types.
-
- public final void write_string(String value) {
- try {
- os.writeUTF(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_string");
- }
- }
-
- public final void write_wstring(String value) {
- try {
- os.writeObject(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_wstring");
- }
- }
-
- // Array types.
-
- public final void write_boolean_array(boolean[] value,
- int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_boolean(value[offset + i]);
- }
- }
-
- public final void write_char_array(char[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_char(value[offset + i]);
- }
- }
-
- public final void write_wchar_array(char[] value, int offset, int length) {
- write_char_array(value, offset, length);
- }
-
- public final void write_octet_array(byte[] value, int offset, int length) {
- try {
- os.write(value, offset, length);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_octet_array");
- }
- }
-
- public final void write_short_array(short[] value,
- int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_short(value[offset + i]);
- }
- }
-
- public final void write_ushort_array(short[] value,
- int offset, int length){
- write_short_array(value, offset, length);
- }
-
- public final void write_long_array(int[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_long(value[offset + i]);
- }
- }
-
- public final void write_ulong_array(int[] value, int offset, int length) {
- write_long_array(value, offset, length);
- }
-
- public final void write_longlong_array(long[] value,
- int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_longlong(value[offset + i]);
- }
- }
-
- public final void write_ulonglong_array(long[] value,
- int offset,int length) {
- write_longlong_array(value, offset, length);
- }
-
- public final void write_float_array(float[] value,
- int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_float(value[offset + i]);
- }
- }
-
- public final void write_double_array(double[] value,
- int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_double(value[offset + i]);
- }
- }
-
- // Complex types (objects and graphs).
-
- public final void write_Object(org.omg.CORBA.Object value) {
- if (value == null) {
- IOR nullIOR = IORFactories.makeIOR(orb);
- nullIOR.write(parent);
- return;
- }
- // IDL to Java formal 01-06-06 1.21.4.2
- if (value instanceof org.omg.CORBA.LocalObject) {
- throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE);
- }
- IOR ior = ORBUtility.connectAndGetIOR(orb, value);
- ior.write(parent);
- return;
- }
-
- public final void write_TypeCode(TypeCode tc) {
- if (tc == null) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
- TypeCodeImpl tci;
- if (tc instanceof TypeCodeImpl) {
- tci = (TypeCodeImpl) tc;
- } else {
- tci = new TypeCodeImpl(orb, tc);
- }
- tci.write_value((org.omg.CORBA_2_3.portable.OutputStream) parent);
- }
-
- public final void write_any(Any any) {
- if (any == null) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
- write_TypeCode(any.type());
- any.write_value(parent);
- }
-
- public final void write_Principal(Principal p) {
- // We don't need an implementation for this method, since principal
- // is absent in GIOP version 1.2 or above.
- write_long(p.name().length);
- write_octet_array(p.name(), 0, p.name().length);
- }
-
- public final void write_fixed(java.math.BigDecimal bigDecimal) {
- // This string might contain sign and/or dot
- this.write_fixed(bigDecimal.toString(), bigDecimal.signum());
- }
-
- // The string may contain a sign and dot
- private void write_fixed(String string, int signum) {
-
- int stringLength = string.length();
-
- // Each octet contains (up to) two decimal digits.
- byte doubleDigit = 0;
- char ch;
- byte digit;
-
- // First calculate the string length without optional sign and dot.
- int numDigits = 0;
- for (int i=0; i<stringLength; i++) {
- ch = string.charAt(i);
- if (ch == '-' || ch == '+' || ch == '.')
- continue;
- numDigits++;
- }
-
- for (int i=0; i<stringLength; i++) {
- ch = string.charAt(i);
- if (ch == '-' || ch == '+' || ch == '.')
- continue;
- digit = (byte)Character.digit(ch, 10);
- if (digit == -1) {
- throw wrapper.badDigitInFixed(
- CompletionStatus.COMPLETED_MAYBE);
- }
- // If the fixed type has an odd number of decimal digits, then the
- // representation begins with the first (most significant) digit.
- // Otherwise, this first half-octet is all zero, and the first
- // digit is in the second half-octet.
- if (numDigits % 2 == 0) {
- doubleDigit |= digit;
- this.write_octet(doubleDigit);
- doubleDigit = 0;
- } else {
- doubleDigit |= (digit << 4);
- }
- numDigits--;
- }
-
- // The sign configuration in the last half-octet of the representation,
- // is 0xD for negative numbers and 0xC for positive and zero values.
- if (signum == -1) {
- doubleDigit |= 0xd;
- } else {
- doubleDigit |= 0xc;
- }
- this.write_octet(doubleDigit);
- }
-
- public final org.omg.CORBA.ORB orb() {
- return this.orb;
- }
-
- // org.omg.CORBA_2_3.portable.OutputStream
-
- public final void write_value(java.io.Serializable value) {
- write_value(value, (String) null);
- }
-
- public final void write_value(java.io.Serializable value,
- java.lang.Class clz) {
- write_value(value);
- }
-
- public final void write_value(java.io.Serializable value,
- String repository_id) {
- try {
- os.writeObject(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_value");
- }
- }
-
- public final void write_value(java.io.Serializable value,
- org.omg.CORBA.portable.BoxedValueHelper factory) {
- this.write_value(value, (String) null);
- }
-
- public final void write_abstract_interface(java.lang.Object obj) {
-
- boolean isCorbaObject = false; // Assume value type.
- org.omg.CORBA.Object theCorbaObject = null;
-
- // Is it a CORBA.Object?
- if (obj != null && obj instanceof org.omg.CORBA.Object) {
- theCorbaObject = (org.omg.CORBA.Object)obj;
- isCorbaObject = true;
- }
-
- // Write the boolean flag.
- this.write_boolean(isCorbaObject);
-
- // Now write out the object.
- if (isCorbaObject) {
- write_Object(theCorbaObject);
- } else {
- try {
- write_value((java.io.Serializable)obj);
- } catch(ClassCastException cce) {
- if (obj instanceof java.io.Serializable) {
- throw cce;
- } else {
- ORBUtility.throwNotSerializableForCorba(
- obj.getClass().getName());
- }
- }
- }
- }
-
- // com.sun.corba.se.os.encoding.MarshalOutputStream
-
- public final void start_block() {
- throw wrapper.giopVersionError();
- }
-
- public final void end_block() {
- throw wrapper.giopVersionError();
- }
-
- public final void putEndian() {
- throw wrapper.giopVersionError();
- }
-
- public void writeTo(java.io.OutputStream s) throws IOException {
- try {
- os.flush();
- bos.writeTo(s);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "writeTo");
- }
- }
-
- public final byte[] toByteArray() {
- try {
- os.flush();
- return bos.toByteArray(); // new copy.
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "toByteArray");
- }
- }
-
- // org.omg.CORBA.DataOutputStream
-
- public final void write_Abstract (java.lang.Object value) {
- write_abstract_interface(value);
- }
-
- public final void write_Value(java.io.Serializable value) {
- write_value(value);
- }
-
- public final void write_any_array(org.omg.CORBA.Any[] value,
- int offset, int length) {
- for(int i = 0; i < length; i++) {
- write_any(value[offset + i]);
- }
- }
-
- // org.omg.CORBA.portable.ValueBase
-
- public final String[] _truncatable_ids() {
- throw wrapper.giopVersionError();
- }
-
- // Other.
-
- public final int getSize() {
- try {
- os.flush();
- return bos.size();
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_boolean");
- }
- }
-
- public final int getIndex() {
- return getSize();
- }
-
- protected int getRealIndex(int index) {
- return getSize();
- }
-
- public final void setIndex(int value) {
- throw wrapper.giopVersionError();
- }
-
- public final ByteBuffer getByteBuffer() {
- throw wrapper.giopVersionError();
- }
-
- public final void setByteBuffer(ByteBuffer byteBuffer) {
- throw wrapper.giopVersionError();
- }
-
- public final boolean isLittleEndian() {
- // Java serialization uses network byte order, that is, big-endian.
- return false;
- }
-
- public ByteBufferWithInfo getByteBufferWithInfo() {
- try {
- os.flush();
- } catch (Exception e) {
- throw wrapper.javaSerializationException(
- e, "getByteBufferWithInfo");
- }
- ByteBuffer byteBuffer = ByteBuffer.wrap(bos.getByteArray());
- byteBuffer.limit(bos.size());
- return new ByteBufferWithInfo(this.orb, byteBuffer, bos.size());
- }
-
- public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- throw wrapper.giopVersionError();
- }
-
- public final BufferManagerWrite getBufferManager() {
- return bufferManager;
- }
-
- // This will stay a custom add-on until the java-rtf issue is resolved.
- // Then it should be declared in org.omg.CORBA.portable.OutputStream.
- //
- // Pads the string representation of bigDecimal with zeros to fit the given
- // digits and scale before it gets written to the stream.
- public final void write_fixed(java.math.BigDecimal bigDecimal,
- short digits, short scale) {
- String string = bigDecimal.toString();
- String integerPart;
- String fractionPart;
- StringBuffer stringBuffer;
-
- // Get rid of the sign
- if (string.charAt(0) == '-' || string.charAt(0) == '+') {
- string = string.substring(1);
- }
-
- // Determine integer and fraction parts
- int dotIndex = string.indexOf('.');
- if (dotIndex == -1) {
- integerPart = string;
- fractionPart = null;
- } else if (dotIndex == 0 ) {
- integerPart = null;
- fractionPart = string;
- } else {
- integerPart = string.substring(0, dotIndex);
- fractionPart = string.substring(dotIndex + 1);
- }
-
- // Pad both parts with zeros as necessary
- stringBuffer = new StringBuffer(digits);
- if (fractionPart != null) {
- stringBuffer.append(fractionPart);
- }
- while (stringBuffer.length() < scale) {
- stringBuffer.append('0');
- }
- if (integerPart != null) {
- stringBuffer.insert(0, integerPart);
- }
- while (stringBuffer.length() < digits) {
- stringBuffer.insert(0, '0');
- }
-
- // This string contains no sign or dot
- this.write_fixed(stringBuffer.toString(), bigDecimal.signum());
- }
-
- public final void writeOctetSequenceTo(
- org.omg.CORBA.portable.OutputStream s) {
- byte[] buf = this.toByteArray(); // new copy.
- s.write_long(buf.length);
- s.write_octet_array(buf, 0, buf.length);
- }
-
- public final GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_2;
- }
-
- public final void writeIndirection(int tag, int posIndirectedTo) {
- throw wrapper.giopVersionError();
- }
-
- void freeInternalCaches() {}
-
- void printBuffer() {
- byte[] buf = this.toByteArray();
-
- System.out.println("+++++++ Output Buffer ++++++++");
- System.out.println();
- System.out.println("Current position: " + buf.length);
- //System.out.println("Total length : " + buf.length);
- System.out.println();
-
- char[] charBuf = new char[16];
-
- try {
-
- for (int i = 0; i < buf.length; i += 16) {
-
- int j = 0;
-
- // For every 16 bytes, there is one line
- // of output. First, the hex output of
- // the 16 bytes with each byte separated
- // by a space.
- while (j < 16 && j + i < buf.length) {
- int k = buf[i + j];
- if (k < 0)
- k = 256 + k;
- String hex = Integer.toHexString(k);
- if (hex.length() == 1)
- hex = "0" + hex;
- System.out.print(hex + " ");
- j++;
- }
-
- // Add any extra spaces to align the
- // text column in case we didn't end
- // at 16
- while (j < 16) {
- System.out.print(" ");
- j++;
- }
-
- // Now output the ASCII equivalents. Non-ASCII
- // characters are shown as periods.
- int x = 0;
-
- while (x < 16 && x + i < buf.length) {
- if (ORBUtility.isPrintable((char)buf[i + x])) {
- charBuf[x] = (char) buf[i + x];
- } else {
- charBuf[x] = '.';
- }
- x++;
- }
- System.out.println(new String(charBuf, 0, x));
- }
- } catch (Throwable t) {
- t.printStackTrace();
- }
- System.out.println("++++++++++++++++++++++++++++++");
- }
-
- public void alignOnBoundary(int octetBoundary) {
- throw wrapper.giopVersionError();
- }
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- public void setHeaderPadding(boolean headerPadding) {
- // no-op. We don't care about body alignment while using
- // Java serialization. What the GIOP spec states does not apply here.
- }
-
- // ValueOutputStream -----------------------------
-
- public void start_value(String rep_id) {
- throw wrapper.giopVersionError();
- }
-
- public void end_value() {
- throw wrapper.giopVersionError();
- }
-
- // java.io.OutputStream
-
- // Note: These methods are defined in the super class and accessible.
-
- //public abstract void write(byte b[]) throws IOException;
- //public abstract void write(byte b[], int off, int len)
- // throws IOException;
- //public abstract void flush() throws IOException;
- //public abstract void close() throws IOException;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/MarkAndResetHandler.java b/src/share/classes/com/sun/corba/se/impl/encoding/MarkAndResetHandler.java
deleted file mode 100644
index 7774ab6..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/MarkAndResetHandler.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-
-/**
- * Defines an abstraction for a RestorableInputStream to
- * implement mark/reset.
- */
-interface MarkAndResetHandler
-{
- void mark(RestorableInputStream inputStream);
-
- void fragmentationOccured(ByteBufferWithInfo newFragment);
-
- void reset();
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/MarshalInputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/MarshalInputStream.java
deleted file mode 100644
index 73e47af..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/MarshalInputStream.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-public interface MarshalInputStream {
- public boolean read_boolean();
- public char read_char();
- public char read_wchar();
- public byte read_octet();
- public short read_short();
- public short read_ushort();
- public int read_long();
- public int read_ulong();
- public long read_longlong();
- public long read_ulonglong();
- public float read_float();
- public double read_double();
- public String read_string();
- public String read_wstring();
-
- public void read_boolean_array(boolean[] value, int offset, int length);
- public void read_char_array(char[] value, int offset, int length);
- public void read_wchar_array(char[] value, int offset, int length);
- public void read_octet_array(byte[] value, int offset, int length);
- public void read_short_array(short[] value, int offset, int length);
- public void read_ushort_array(short[] value, int offset, int length);
- public void read_long_array(int[] value, int offset, int length);
- public void read_ulong_array(int[] value, int offset, int length);
- public void read_longlong_array(long[] value, int offset, int length);
- public void read_ulonglong_array(long[] value, int offset, int length);
- public void read_float_array(float[] value, int offset, int length);
- public void read_double_array(double[] value, int offset, int length);
-
- public org.omg.CORBA.Object read_Object();
- public TypeCode read_TypeCode();
- public Any read_any();
- public Principal read_Principal();
-
- /*
- * The methods necessary to support RMI
- */
- public org.omg.CORBA.Object read_Object(Class stubClass);
- public java.io.Serializable read_value() throws Exception;
-
- /*
- * Additional Methods
- */
- public void consumeEndian();
-
- // Determines the current byte stream position
- // (also handles fragmented streams)
- public int getPosition();
-
- // mark/reset from java.io.InputStream
- public void mark(int readAheadLimit);
- public void reset();
-
- /**
- * This must be called once before unmarshaling valuetypes or anything
- * that uses repository IDs. The ORB's version should be set
- * to the desired value prior to calling.
- */
- public void performORBVersionSpecificInit();
-
- /**
- * Tells the input stream to null any code set converter
- * references, forcing it to reacquire them if it needs
- * converters again. This is used when the server
- * input stream needs to switch the connection's char code set
- * converter to something different after reading the
- * code set service context for the first time. Initially,
- * we use ISO8859-1 to read the operation name (it can't
- * be more than ASCII).
- */
- public void resetCodeSetConverters();
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/MarshalOutputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/MarshalOutputStream.java
deleted file mode 100644
index 531f89d..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/MarshalOutputStream.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-import org.omg.CORBA.portable.InputStream;
-
-public interface MarshalOutputStream {
-
- public InputStream create_input_stream();
-
- public void write_boolean(boolean value);
- public void write_char(char value);
- public void write_wchar(char value);
- public void write_octet(byte value);
- public void write_short(short value);
- public void write_ushort(short value);
- public void write_long(int value);
- public void write_ulong(int value);
- public void write_longlong(long value);
- public void write_ulonglong(long value);
- public void write_float(float value);
- public void write_double(double value);
- public void write_string(String value);
- public void write_wstring(String value);
-
- public void write_boolean_array(boolean[] value, int offset, int length);
- public void write_char_array(char[] value, int offset, int length);
- public void write_wchar_array(char[] value, int offset, int length);
- public void write_octet_array(byte[] value, int offset, int length);
- public void write_short_array(short[] value, int offset, int length);
- public void write_ushort_array(short[] value, int offset, int length);
- public void write_long_array(int[] value, int offset, int length);
- public void write_ulong_array(int[] value, int offset, int length);
- public void write_longlong_array(long[] value, int offset, int length);
- public void write_ulonglong_array(long[] value, int offset, int length);
- public void write_float_array(float[] value, int offset, int length);
- public void write_double_array(double[] value, int offset, int length);
-
- public void write_Object(org.omg.CORBA.Object value);
- public void write_TypeCode(TypeCode value);
- public void write_any(Any value);
- public void write_Principal(Principal value);
-
-
- /*
- * The methods necessary to support RMI
- */
- public void write_value(java.io.Serializable value);
- public void start_block();
- public void end_block();
-
- /*
- * Additional Methods
- */
-
- public void putEndian();
- public void writeTo(java.io.OutputStream s)
- throws IOException;
-
- public byte[] toByteArray();
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/OSFCodeSetRegistry.java b/src/share/classes/com/sun/corba/se/impl/encoding/OSFCodeSetRegistry.java
deleted file mode 100644
index 6950082..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/OSFCodeSetRegistry.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-/**
- *
- * Information from the OSF code set registry version 1.2g.
- *
- * Use the Entry corresponding to the desired code set.
- *
- * Consider rename to CodeSetRegistry since OSF is dead.
- */
-public final class OSFCodeSetRegistry
-{
- // Numbers from the OSF code set registry version 1.2g.
- //
- // Please see the individual Entry definitions for
- // more details.
- public static final int ISO_8859_1_VALUE = 0x00010001;
- public static final int UTF_16_VALUE = 0x00010109;
- public static final int UTF_8_VALUE = 0x05010001;
- public static final int UCS_2_VALUE = 0x00010100;
- public static final int ISO_646_VALUE = 0x00010020;
-
- private OSFCodeSetRegistry() {}
-
- /**
- * An entry in the OSF registry which allows users
- * to find out the equivalent Java character encoding
- * name as well as some other facts from the registry.
- */
- public final static class Entry
- {
- private String javaName;
- private int encodingNum;
- private boolean isFixedWidth;
- private int maxBytesPerChar;
-
- private Entry(String javaName,
- int encodingNum,
- boolean isFixedWidth,
- int maxBytesPerChar) {
- this.javaName = javaName;
- this.encodingNum = encodingNum;
- this.isFixedWidth = isFixedWidth;
- this.maxBytesPerChar = maxBytesPerChar;
- }
-
- /**
- * Returns the Java equivalent name. If the encoding has
- * an optional byte order marker, this name will map to the
- * Java encoding that includes the marker.
- */
- public String getName() {
- return javaName;
- }
-
- /**
- * Get the OSF registry number for this code set.
- */
- public int getNumber() {
- return encodingNum;
- }
-
- /**
- * Is this a fixed or variable width code set? (In CORBA
- * terms, "non-byte-oriented" or a "byte-oriented"
- * code set, respectively)
- */
- public boolean isFixedWidth() {
- return isFixedWidth;
- }
-
- public int getMaxBytesPerChar() {
- return maxBytesPerChar;
- }
-
- /**
- * First checks reference equality since it's expected
- * people will use the pre-defined constant Entries.
- */
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
-
- if (!(obj instanceof OSFCodeSetRegistry.Entry))
- return false;
-
- OSFCodeSetRegistry.Entry other
- = (OSFCodeSetRegistry.Entry)obj;
-
- return (javaName.equals(other.javaName) &&
- encodingNum == other.encodingNum &&
- isFixedWidth == other.isFixedWidth &&
- maxBytesPerChar == other.maxBytesPerChar);
- }
-
- /**
- * Uses the registry number as the hash code.
- */
- public int hashCode() {
- return encodingNum;
- }
- }
-
- /**
- * 8-bit encoding required for GIOP 1.0, and used as the char set
- * when nothing else is specified.
- */
- public static final Entry ISO_8859_1
- = new Entry("ISO-8859-1",
- ISO_8859_1_VALUE,
- true,
- 1);
-
- /**
- * UTF-16 as specified in the OSF registry has an optional
- * byte order marker. UTF-16BE and UTF-16LE are not in the OSF
- * registry since it is no longer being developed. When the OMG
- * switches to the IANA registry, these can be public. Right
- * now, they're used internally by CodeSetConversion.
- */
- static final Entry UTF_16BE
- = new Entry("UTF-16BE",
- -1,
- true,
- 2);
-
- static final Entry UTF_16LE
- = new Entry("UTF-16LE",
- -2,
- true,
- 2);
-
- /**
- * Fallback wchar code set.
- *
- * In the resolution of issue 3405b, UTF-16 defaults to big endian, so
- * doesn't have to have a byte order marker. Unfortunately, this has to be
- * a special case for compatibility.
- */
- public static final Entry UTF_16
- = new Entry("UTF-16",
- UTF_16_VALUE,
- true,
- 4);
-
- /**
- * Fallback char code set. Also the code set for char data
- * in encapsulations. However, since CORBA says chars are
- * only one octet, it is really the same as Latin-1.
- */
- public static final Entry UTF_8
- = new Entry("UTF-8",
- UTF_8_VALUE,
- false,
- 6);
-
- /*
- * At least in JDK 1.3, UCS-2 isn't one of the mandatory Java character
- * encodings. However, our old ORBs require what they call UCS2, even
- * though they didn't necessarily do the correct encoding of it.
- *
- * This is a special case for our legacy ORBs, and put as the last thing
- * in our conversion list for wchar data.
- *
- * If a foreign ORB actually tries to speak UCS2 with us, it probably
- * won't work! Beware!
- */
- public static final Entry UCS_2
- = new Entry("UCS-2",
- UCS_2_VALUE,
- true,
- 2);
-
- /**
- * This is the encoding older JavaSoft ORBs advertised as their
- * CORBA char code set. Actually, they took the lower byte of
- * the Java char. This is a 7-bit encoding, so they
- * were really sending ISO8859-1.
- */
- public static final Entry ISO_646
- = new Entry("US-ASCII",
- ISO_646_VALUE,
- true,
- 1);
-
- /**
- * Given an OSF registry value, return the corresponding Entry.
- * Returns null if an Entry for that value is unavailable.
- */
- public static Entry lookupEntry(int encodingValue) {
- switch(encodingValue) {
- case ISO_8859_1_VALUE:
- return OSFCodeSetRegistry.ISO_8859_1;
- case UTF_16_VALUE:
- return OSFCodeSetRegistry.UTF_16;
- case UTF_8_VALUE:
- return OSFCodeSetRegistry.UTF_8;
- case ISO_646_VALUE:
- return OSFCodeSetRegistry.ISO_646;
- case UCS_2_VALUE:
- return OSFCodeSetRegistry.UCS_2;
- default:
- return null;
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/RestorableInputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/RestorableInputStream.java
deleted file mode 100644
index 8d1c9b6..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/RestorableInputStream.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-package com.sun.corba.se.impl.encoding;
-
-/**
- * Defines the methods on an input stream which provide
- * a way to get and restore its internal state without
- * violating encapsulation.
- */
-interface RestorableInputStream
-{
- Object createStreamMemento();
-
- void restoreInternalState(Object streamMemento);
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java
deleted file mode 100644
index ae91457..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.StructMember ;
-import org.omg.CORBA.UnionMember ;
-import org.omg.CORBA.ValueMember ;
-import org.omg.CORBA.TCKind ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.Principal ;
-import org.omg.CORBA.BAD_TYPECODE ;
-import org.omg.CORBA.BAD_PARAM ;
-import org.omg.CORBA.BAD_OPERATION ;
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.MARSHAL ;
-
-import org.omg.CORBA.TypeCodePackage.BadKind ;
-
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-import com.sun.corba.se.impl.encoding.MarshalInputStream;
-
-import sun.corba.EncapsInputStreamFactory;
-
-public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeReader
-{
- private Map typeMap = null;
- private InputStream enclosure = null;
- private boolean isEncapsulation = false;
-
- public TypeCodeInputStream(org.omg.CORBA.ORB orb, byte[] data, int size) {
- super(orb, data, size);
- }
-
- public TypeCodeInputStream(org.omg.CORBA.ORB orb,
- byte[] data,
- int size,
- boolean littleEndian,
- GIOPVersion version) {
- super(orb, data, size, littleEndian, version);
- }
-
- public TypeCodeInputStream(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int size,
- boolean littleEndian,
- GIOPVersion version) {
- super(orb, byteBuffer, size, littleEndian, version);
- }
-
- public void addTypeCodeAtPosition(TypeCodeImpl tc, int position) {
- if (typeMap == null) {
- //if (TypeCodeImpl.debug) System.out.println("Creating typeMap");
- typeMap = new HashMap(16);
- }
- //if (TypeCodeImpl.debug) System.out.println(this + " adding tc " + tc + " at position " + position);
- typeMap.put(new Integer(position), tc);
- }
-
- public TypeCodeImpl getTypeCodeAtPosition(int position) {
- if (typeMap == null)
- return null;
- //if (TypeCodeImpl.debug) {
- //System.out.println("Getting tc " + (TypeCode)typeMap.get(new Integer(position)) +
- //" at position " + position);
- //}
- return (TypeCodeImpl)typeMap.get(new Integer(position));
- }
-
- public void setEnclosingInputStream(InputStream enclosure) {
- this.enclosure = enclosure;
- }
-
- public TypeCodeReader getTopLevelStream() {
- if (enclosure == null)
- return this;
- if (enclosure instanceof TypeCodeReader)
- return ((TypeCodeReader)enclosure).getTopLevelStream();
- return this;
- }
-
- public int getTopLevelPosition() {
- if (enclosure != null && enclosure instanceof TypeCodeReader) {
- // The enclosed stream has to consider if the enclosing stream
- // had to read the enclosed stream completely when creating it.
- // This is why the size of the enclosed stream needs to be substracted.
- int topPos = ((TypeCodeReader)enclosure).getTopLevelPosition();
- // Substract getBufferLength from the parents pos because it read this stream
- // from its own when creating it
- int pos = topPos - getBufferLength() + getPosition();
- //if (TypeCodeImpl.debug) {
- //System.out.println("TypeCodeInputStream.getTopLevelPosition using getTopLevelPosition " + topPos +
- //(isEncapsulation ? " - encaps length 4" : "") +
- //" - getBufferLength() " + getBufferLength() +
- //" + getPosition() " + getPosition() + " = " + pos);
- //}
- return pos;
- }
- //if (TypeCodeImpl.debug) {
- //System.out.println("TypeCodeInputStream.getTopLevelPosition returning getPosition() = " +
- //getPosition() + " because enclosure is " + enclosure);
- //}
- return getPosition();
- }
-
- public static TypeCodeInputStream readEncapsulation(InputStream is, org.omg.CORBA.ORB _orb) {
- // _REVISIT_ Would be nice if we didn't have to copy the buffer!
- TypeCodeInputStream encap;
-
- int encapLength = is.read_long();
-
- // read off part of the buffer corresponding to the encapsulation
- byte[] encapBuffer = new byte[encapLength];
- is.read_octet_array(encapBuffer, 0, encapBuffer.length);
-
- // create an encapsulation using the marshal buffer
- if (is instanceof CDRInputStream) {
- encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
- encapBuffer, encapBuffer.length,
- ((CDRInputStream) is).isLittleEndian(),
- ((CDRInputStream) is).getGIOPVersion());
- } else {
- encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
- encapBuffer, encapBuffer.length);
- }
- encap.setEnclosingInputStream(is);
- encap.makeEncapsulation();
- //if (TypeCodeImpl.debug) {
- //System.out.println("Created TypeCodeInputStream " + encap + " with parent " + is);
- //encap.printBuffer();
- //}
- return encap;
- }
-
- protected void makeEncapsulation() {
- // first entry in an encapsulation is the endianess
- consumeEndian();
- isEncapsulation = true;
- }
-
- public void printTypeMap() {
- System.out.println("typeMap = {");
- Iterator i = typeMap.keySet().iterator();
- while (i.hasNext()) {
- Integer pos = (Integer)i.next();
- TypeCodeImpl tci = (TypeCodeImpl)typeMap.get(pos);
- System.out.println(" key = " + pos.intValue() + ", value = " + tci.description());
- }
- System.out.println("}");
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java
deleted file mode 100644
index 93f7c97..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.StructMember ;
-import org.omg.CORBA.UnionMember ;
-import org.omg.CORBA.ValueMember ;
-import org.omg.CORBA.TCKind ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.Principal ;
-import org.omg.CORBA.CompletionStatus ;
-
-import org.omg.CORBA.TypeCodePackage.BadKind ;
-
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.encoding.MarshalInputStream;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-
-import sun.corba.EncapsInputStreamFactory;
-
-public final class TypeCodeOutputStream extends EncapsOutputStream
-{
- private OutputStream enclosure = null;
- private Map typeMap = null;
- private boolean isEncapsulation = false;
-
- public TypeCodeOutputStream(ORB orb) {
- super(orb, false);
- }
-
- public TypeCodeOutputStream(ORB orb, boolean littleEndian) {
- super(orb, littleEndian);
- }
-
- public org.omg.CORBA.portable.InputStream create_input_stream()
- {
- TypeCodeInputStream tcis = EncapsInputStreamFactory
- .newTypeCodeInputStream((ORB) orb(), getByteBuffer(),
- getIndex(), isLittleEndian(), getGIOPVersion());
- //if (TypeCodeImpl.debug) {
- //System.out.println("Created TypeCodeInputStream " + tcis + " with no parent");
- //tcis.printBuffer();
- //}
- return tcis;
- }
-
- public void setEnclosingOutputStream(OutputStream enclosure) {
- this.enclosure = enclosure;
- }
-
- /*
- public boolean isEncapsulatedIn(TypeCodeOutputStream outerEnclosure) {
- if (outerEnclosure == this)
- return true;
- if (enclosure == null)
- return false;
- if (enclosure instanceof TypeCodeOutputStream)
- return ((TypeCodeOutputStream)enclosure).isEncapsulatedIn(outerEnclosure);
- // Last chance! Recursion ends with first non TypeCodeOutputStream.
- return (enclosure == outerEnclosure);
- }
- */
-
- public TypeCodeOutputStream getTopLevelStream() {
- if (enclosure == null)
- return this;
- if (enclosure instanceof TypeCodeOutputStream)
- return ((TypeCodeOutputStream)enclosure).getTopLevelStream();
- return this;
- }
-
- public int getTopLevelPosition() {
- if (enclosure != null && enclosure instanceof TypeCodeOutputStream) {
- int pos = ((TypeCodeOutputStream)enclosure).getTopLevelPosition() + getPosition();
- // Add four bytes for the encaps length, not another 4 for the byte order
- // which is included in getPosition().
- if (isEncapsulation) pos += 4;
- //if (TypeCodeImpl.debug) {
- //System.out.println("TypeCodeOutputStream.getTopLevelPosition using getTopLevelPosition " +
- //((TypeCodeOutputStream)enclosure).getTopLevelPosition() +
- //" + getPosition() " + getPosition() +
- //(isEncapsulation ? " + encaps length 4" : "") +
- //" = " + pos);
- //}
- return pos;
- }
- //if (TypeCodeImpl.debug) {
- //System.out.println("TypeCodeOutputStream.getTopLevelPosition returning getPosition() = " +
- //getPosition() + ", enclosure is " + enclosure);
- //}
- return getPosition();
- }
-
- public void addIDAtPosition(String id, int position) {
- if (typeMap == null)
- typeMap = new HashMap(16);
- //if (TypeCodeImpl.debug) System.out.println(this + " adding id " + id + " at position " + position);
- typeMap.put(id, new Integer(position));
- }
-
- public int getPositionForID(String id) {
- if (typeMap == null)
- throw wrapper.refTypeIndirType( CompletionStatus.COMPLETED_NO ) ;
- //if (TypeCodeImpl.debug) System.out.println("Getting position " + ((Integer)typeMap.get(id)).intValue() +
- //" for id " + id);
- return ((Integer)typeMap.get(id)).intValue();
- }
-
- public void writeRawBuffer(org.omg.CORBA.portable.OutputStream s, int firstLong) {
- // Writes this streams buffer to the given OutputStream
- // without byte order flag and length as is the case for encapsulations.
-
- // Make sure to align s to 4 byte boundaries.
- // Unfortunately we can't do just this:
- // s.alignAndReserve(4, 4);
- // So we have to take the first four bytes given in firstLong and write them
- // with a call to write_long which will trigger the alignment.
- // Then write the rest of the byte array.
-
- //if (TypeCodeImpl.debug) {
- //System.out.println(this + ".writeRawBuffer(" + s + ", " + firstLong + ")");
- //if (s instanceof CDROutputStream) {
- //System.out.println("Parent position before writing kind = " + ((CDROutputStream)s).getIndex());
- //}
- //}
- s.write_long(firstLong);
- //if (TypeCodeImpl.debug) {
- //if (s instanceof CDROutputStream) {
- //System.out.println("Parent position after writing kind = " + ((CDROutputStream)s).getIndex());
- //}
- //}
- ByteBuffer byteBuffer = getByteBuffer();
- if (byteBuffer.hasArray())
- {
- s.write_octet_array(byteBuffer.array(), 4, getIndex() - 4);
- }
- else
- {
- // get bytes from DirectByteBuffer
- // NOTE: Microbenchmarks are showing it is faster to do
- // a loop of ByteBuffer.get(int) than it is to do
- // a bulk ByteBuffer.get(byte[], offset, length)
- byte[] buf = new byte[byteBuffer.limit()];
- for (int i = 0; i < buf.length; i++)
- buf[i] = byteBuffer.get(i);
- s.write_octet_array(buf, 4, getIndex() - 4);
- }
- //if (TypeCodeImpl.debug) {
- //if (s instanceof CDROutputStream) {
- //System.out.println("Parent position after writing all " + getIndex() + " bytes = " + ((CDROutputStream)s).getIndex());
- //}
- //}
- }
-
- public TypeCodeOutputStream createEncapsulation(org.omg.CORBA.ORB _orb) {
- TypeCodeOutputStream encap =
- sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)_orb, isLittleEndian());
- encap.setEnclosingOutputStream(this);
- encap.makeEncapsulation();
- //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + encap + " with parent " + this);
- return encap;
- }
-
- protected void makeEncapsulation() {
- // first entry in an encapsulation is the endianess
- putEndian();
- isEncapsulation = true;
- }
-
- public static TypeCodeOutputStream wrapOutputStream(OutputStream os) {
- boolean littleEndian = ((os instanceof CDROutputStream) ? ((CDROutputStream)os).isLittleEndian() : false);
- TypeCodeOutputStream tos =
- sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)os.orb(), littleEndian);
- tos.setEnclosingOutputStream(os);
- //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + tos + " with parent " + os);
- return tos;
- }
-
- public int getPosition() {
- return getIndex();
- }
-
- public int getRealIndex(int index) {
- int topPos = getTopLevelPosition();
- //if (TypeCodeImpl.debug) System.out.println("TypeCodeOutputStream.getRealIndex using getTopLevelPosition " +
- //topPos + " instead of getPosition " + getPosition());
- return topPos;
- }
-/*
- protected void printBuffer() {
- super.printBuffer();
- }
-*/
- public byte[] getTypeCodeBuffer() {
- // Returns the buffer trimmed of the trailing zeros and without the
- // known _kind value at the beginning.
- ByteBuffer theBuffer = getByteBuffer();
- //System.out.println("outBuffer length = " + (getIndex() - 4));
- byte[] tcBuffer = new byte[getIndex() - 4];
- // Micro-benchmarks show that DirectByteBuffer.get(int) is faster
- // than DirectByteBuffer.get(byte[], offset, length).
- // REVISIT - May want to check if buffer is direct or non-direct
- // and use array copy if ByteBuffer is non-direct.
- for (int i = 0; i < tcBuffer.length; i++)
- tcBuffer[i] = theBuffer.get(i+4);
- return tcBuffer;
- }
-
- public void printTypeMap() {
- System.out.println("typeMap = {");
- Iterator i = typeMap.keySet().iterator();
- while (i.hasNext()) {
- String id = (String)i.next();
- Integer pos = (Integer)typeMap.get(id);
- System.out.println(" key = " + id + ", value = " + pos);
- }
- System.out.println("}");
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeReader.java b/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeReader.java
deleted file mode 100644
index 8f55fc2..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeReader.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.StructMember ;
-import org.omg.CORBA.UnionMember ;
-import org.omg.CORBA.ValueMember ;
-import org.omg.CORBA.TCKind ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.Principal ;
-import org.omg.CORBA.BAD_TYPECODE ;
-import org.omg.CORBA.BAD_PARAM ;
-import org.omg.CORBA.BAD_OPERATION ;
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.MARSHAL ;
-
-import org.omg.CORBA.TypeCodePackage.BadKind ;
-
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.encoding.MarshalInputStream;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-
-public interface TypeCodeReader extends MarshalInputStream {
- public void addTypeCodeAtPosition(TypeCodeImpl tc, int position);
- public TypeCodeImpl getTypeCodeAtPosition(int position);
- public void setEnclosingInputStream(InputStream enclosure);
- public TypeCodeReader getTopLevelStream();
- public int getTopLevelPosition();
- // for debugging
- //public void printBuffer();
- public int getPosition();
- public void printTypeMap();
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/WrapperInputStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/WrapperInputStream.java
deleted file mode 100644
index aad4380..0000000
--- a/src/share/classes/com/sun/corba/se/impl/encoding/WrapperInputStream.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.StructMember ;
-import org.omg.CORBA.UnionMember ;
-import org.omg.CORBA.ValueMember ;
-import org.omg.CORBA.TCKind ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.Principal ;
-import org.omg.CORBA.BAD_TYPECODE ;
-import org.omg.CORBA.BAD_PARAM ;
-import org.omg.CORBA.BAD_OPERATION ;
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.MARSHAL ;
-
-import org.omg.CORBA.TypeCodePackage.BadKind ;
-
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.encoding.MarshalInputStream;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-
-public class WrapperInputStream extends org.omg.CORBA_2_3.portable.InputStream implements TypeCodeReader
-{
- private CDRInputStream stream;
- private Map typeMap = null;
- private int startPos = 0;
-
- public WrapperInputStream(CDRInputStream s) {
- super();
- stream = s;
- startPos = stream.getPosition();
- }
-
- public int read() throws IOException { return stream.read(); }
- public int read(byte b[]) throws IOException { return stream.read(b); }
- public int read(byte b[], int off, int len) throws IOException {
- return stream.read(b, off, len);
- }
- public long skip(long n) throws IOException { return stream.skip(n); }
- public int available() throws IOException { return stream.available(); }
- public void close() throws IOException { stream.close(); }
- public void mark(int readlimit) { stream.mark(readlimit); }
- public void reset() { stream.reset(); }
- public boolean markSupported() { return stream.markSupported(); }
- public int getPosition() { return stream.getPosition(); }
- public void consumeEndian() { stream.consumeEndian(); }
- public boolean read_boolean() { return stream.read_boolean(); }
- public char read_char() { return stream.read_char(); }
- public char read_wchar() { return stream.read_wchar(); }
- public byte read_octet() { return stream.read_octet(); }
- public short read_short() { return stream.read_short(); }
- public short read_ushort() { return stream.read_ushort(); }
- public int read_long() { return stream.read_long(); }
- public int read_ulong() { return stream.read_ulong(); }
- public long read_longlong() { return stream.read_longlong(); }
- public long read_ulonglong() { return stream.read_ulonglong(); }
- public float read_float() { return stream.read_float(); }
- public double read_double() { return stream.read_double(); }
- public String read_string() { return stream.read_string(); }
- public String read_wstring() { return stream.read_wstring(); }
-
- public void read_boolean_array(boolean[] value, int offset, int length) {
- stream.read_boolean_array(value, offset, length);
- }
- public void read_char_array(char[] value, int offset, int length) {
- stream.read_char_array(value, offset, length);
- }
- public void read_wchar_array(char[] value, int offset, int length) {
- stream.read_wchar_array(value, offset, length);
- }
- public void read_octet_array(byte[] value, int offset, int length) {
- stream.read_octet_array(value, offset, length);
- }
- public void read_short_array(short[] value, int offset, int length) {
- stream.read_short_array(value, offset, length);
- }
- public void read_ushort_array(short[] value, int offset, int length) {
- stream.read_ushort_array(value, offset, length);
- }
- public void read_long_array(int[] value, int offset, int length) {
- stream.read_long_array(value, offset, length);
- }
- public void read_ulong_array(int[] value, int offset, int length) {
- stream.read_ulong_array(value, offset, length);
- }
- public void read_longlong_array(long[] value, int offset, int length) {
- stream.read_longlong_array(value, offset, length);
- }
- public void read_ulonglong_array(long[] value, int offset, int length) {
- stream.read_ulonglong_array(value, offset, length);
- }
- public void read_float_array(float[] value, int offset, int length) {
- stream.read_float_array(value, offset, length);
- }
- public void read_double_array(double[] value, int offset, int length) {
- stream.read_double_array(value, offset, length);
- }
-
- public org.omg.CORBA.Object read_Object() { return stream.read_Object(); }
- public java.io.Serializable read_value() {return stream.read_value();}
- public TypeCode read_TypeCode() { return stream.read_TypeCode(); }
- public Any read_any() { return stream.read_any(); }
- public Principal read_Principal() { return stream.read_Principal(); }
- public java.math.BigDecimal read_fixed() { return stream.read_fixed(); }
- public org.omg.CORBA.Context read_Context() { return stream.read_Context(); }
-
- public org.omg.CORBA.ORB orb() { return stream.orb(); }
-
- public void addTypeCodeAtPosition(TypeCodeImpl tc, int position) {
- if (typeMap == null) {
- //if (TypeCodeImpl.debug) System.out.println("Creating typeMap");
- typeMap = new HashMap(16);
- }
- //if (TypeCodeImpl.debug) System.out.println(this + " adding tc " + tc + " at position " + position);
- typeMap.put(new Integer(position), tc);
- }
-
- public TypeCodeImpl getTypeCodeAtPosition(int position) {
- if (typeMap == null)
- return null;
- //if (TypeCodeImpl.debug) System.out.println("Getting tc " + (TypeCodeImpl)typeMap.get(new Integer(position)) +
- //" at position " + position);
- return (TypeCodeImpl)typeMap.get(new Integer(position));
- }
-
- public void setEnclosingInputStream(InputStream enclosure) {
- // WrapperInputStream has no enclosure
- }
-
- public TypeCodeReader getTopLevelStream() {
- // WrapperInputStream has no enclosure
- return this;
- }
-
- public int getTopLevelPosition() {
- //if (TypeCodeImpl.debug) System.out.println("WrapperInputStream.getTopLevelPosition " +
- //"returning getPosition " + getPosition() + " - startPos " + startPos +
- //" = " + (getPosition() - startPos));
- return getPosition() - startPos;
- }
-
- public void performORBVersionSpecificInit() {
- // This is never actually called on a WrapperInputStream, but
- // exists to satisfy the interface requirement.
- stream.performORBVersionSpecificInit();
- }
-
- public void resetCodeSetConverters() {
- stream.resetCodeSetConverters();
- }
-
- //public void printBuffer() { stream.printBuffer(); }
-
- public void printTypeMap() {
- System.out.println("typeMap = {");
- List sortedKeys = new ArrayList(typeMap.keySet());
- Collections.sort(sortedKeys);
- Iterator i = sortedKeys.iterator();
- while (i.hasNext()) {
- Integer pos = (Integer)i.next();
- TypeCodeImpl tci = (TypeCodeImpl)typeMap.get(pos);
- System.out.println(" key = " + pos.intValue() + ", value = " + tci.description());
- }
- System.out.println("}");
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java b/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java
deleted file mode 100644
index 235b895..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.LocalObject;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import sun.corba.EncapsInputStreamFactory;
-
-import com.sun.corba.se.impl.corba.AnyImpl;
-import com.sun.corba.se.impl.encoding.EncapsInputStream;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-import org.omg.IOP.Codec;
-import org.omg.IOP.CodecPackage.FormatMismatch;
-import org.omg.IOP.CodecPackage.InvalidTypeForEncoding;
-import org.omg.IOP.CodecPackage.TypeMismatch;
-
-/**
- * CDREncapsCodec is an implementation of Codec, as described
- * in orbos/99-12-02, that supports CDR encapsulation version 1.0, 1.1, and
- * 1.2.
- */
-public final class CDREncapsCodec
- extends org.omg.CORBA.LocalObject
- implements Codec
-{
- // The ORB that created the factory this codec was created from
- private ORB orb;
- ORBUtilSystemException wrapper;
-
- // The GIOP version we are encoding for
- private GIOPVersion giopVersion;
-
- /*
- *******************************************************************
- * NOTE: CDREncapsCodec must remain immutable! This is so that we
- * can pre-create CDREncapsCodecs for each version of GIOP in
- * CodecFactoryImpl.
- *******************************************************************/
-
- /**
- * Creates a new codec implementation. Uses the given ORB to create
- * CDRInputStreams when necessary.
- *
- * @param orb The ORB to use to create a CDRInputStream or CDROutputStream
- * @param major The major version of GIOP we are encoding for
- * @param minor The minor version of GIOP we are encoding for
- */
- public CDREncapsCodec( ORB orb, int major, int minor ) {
- this.orb = orb;
- wrapper = ORBUtilSystemException.get(
- (com.sun.corba.se.spi.orb.ORB)orb, CORBALogDomains.RPC_PROTOCOL ) ;
-
- giopVersion = GIOPVersion.getInstance( (byte)major, (byte)minor );
- }
-
- /**
- * Convert the given any into a CDR encapsulated octet sequence
- */
- public byte[] encode( Any data )
- throws InvalidTypeForEncoding
- {
- if ( data == null )
- throw wrapper.nullParam() ;
- return encodeImpl( data, true );
- }
-
- /**
- * Decode the given octet sequence into an any based on a CDR
- * encapsulated octet sequence.
- */
- public Any decode ( byte[] data )
- throws FormatMismatch
- {
- if( data == null )
- throw wrapper.nullParam() ;
- return decodeImpl( data, null );
- }
-
- /**
- * Convert the given any into a CDR encapsulated octet sequence. Only
- * the data is stored. The type code is not.
- */
- public byte[] encode_value( Any data )
- throws InvalidTypeForEncoding
- {
- if( data == null )
- throw wrapper.nullParam() ;
- return encodeImpl( data, false );
- }
-
- /**
- * Decode the given octet sequence into an any based on a CDR
- * encapsulated octet sequence. The type code is expected not to appear
- * in the octet sequence, and the given type code is used instead.
- */
- public Any decode_value( byte[] data, TypeCode tc )
- throws FormatMismatch, TypeMismatch
- {
- if( data == null )
- throw wrapper.nullParam() ;
- if( tc == null )
- throw wrapper.nullParam() ;
- return decodeImpl( data, tc );
- }
-
- /**
- * Convert the given any into a CDR encapsulated octet sequence.
- * If sendTypeCode is true, the type code is sent with the message, as in
- * a standard encapsulation. If it is false, only the data is sent.
- * Either way, the endian type is sent as the first part of the message.
- */
- private byte[] encodeImpl( Any data, boolean sendTypeCode )
- throws InvalidTypeForEncoding
- {
- if( data == null )
- throw wrapper.nullParam() ;
-
- // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
- // the body of this method. This is due to the fact that CDR*Stream
- // will never throw an exception if the encoding is invalid. To
- // fix this, the CDROutputStream must know the version of GIOP it
- // is encoding for and it must check to ensure that, for example,
- // wstring cannot be encoded in GIOP 1.0.
- //
- // As part of the GIOP 1.2 work, the CDRInput and OutputStream will
- // be versioned. This can be handled once this work is complete.
-
- // Create output stream with default endianness.
- EncapsOutputStream cdrOut =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(
- (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );
-
- // This is an encapsulation, so put out the endian:
- cdrOut.putEndian();
-
- // Sometimes encode type code:
- if( sendTypeCode ) {
- cdrOut.write_TypeCode( data.type() );
- }
-
- // Encode value and return.
- data.write_value( cdrOut );
-
- return cdrOut.toByteArray();
- }
-
- /**
- * Decode the given octet sequence into an any based on a CDR
- * encapsulated octet sequence. If the type code is null, it is
- * expected to appear in the octet sequence. Otherwise, the given
- * type code is used.
- */
- private Any decodeImpl( byte[] data, TypeCode tc )
- throws FormatMismatch
- {
- if( data == null )
- throw wrapper.nullParam() ;
-
- AnyImpl any = null; // return value
-
- // _REVISIT_ Currently there is no way for us to distinguish between
- // a FormatMismatch and a TypeMismatch because we cannot get this
- // information from the CDRInputStream. If a RuntimeException occurs,
- // it is turned into a FormatMismatch exception.
-
- try {
- EncapsInputStream cdrIn = EncapsInputStreamFactory.newEncapsInputStream( orb, data,
- data.length, giopVersion );
-
-
- cdrIn.consumeEndian();
-
- // If type code not specified, read it from octet stream:
- if( tc == null ) {
- tc = cdrIn.read_TypeCode();
- }
-
- // Create a new Any object:
- any = new AnyImpl( (com.sun.corba.se.spi.orb.ORB)orb );
- any.read_value( cdrIn, tc );
- }
- catch( RuntimeException e ) {
- // See above note.
- throw new FormatMismatch();
- }
-
- return any;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java b/src/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java
deleted file mode 100644
index 94e3f95..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java
+++ /dev/null
@@ -1,978 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import java.util.HashMap ;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.CTX_RESTRICT_SCOPE;
-import org.omg.CORBA.ExceptionList;
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.NamedValue;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.NO_RESOURCES;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.ParameterMode;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.portable.ApplicationException;
-import org.omg.CORBA.portable.InputStream;
-import com.sun.corba.se.spi.servicecontext.ServiceContexts;
-import com.sun.corba.se.spi.servicecontext.UnknownServiceContext;
-
-import org.omg.IOP.ServiceContext;
-import org.omg.IOP.ServiceContextHelper;
-import org.omg.IOP.TaggedProfile;
-import org.omg.IOP.TaggedProfileHelper;
-import org.omg.IOP.TaggedComponent;
-import org.omg.IOP.TaggedComponentHelper;
-import org.omg.IOP.TAG_INTERNET_IOP;
-import org.omg.Dynamic.Parameter;
-import org.omg.PortableInterceptor.ClientRequestInfo;
-import org.omg.PortableInterceptor.LOCATION_FORWARD;
-import org.omg.PortableInterceptor.SUCCESSFUL;
-import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
-import org.omg.PortableInterceptor.TRANSPORT_RETRY;
-import org.omg.PortableInterceptor.USER_EXCEPTION;
-
-import com.sun.corba.se.pept.protocol.MessageMediator;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-import com.sun.corba.se.spi.protocol.RetryType;
-import com.sun.corba.se.spi.transport.CorbaContactInfo;
-import com.sun.corba.se.spi.transport.CorbaContactInfoList;
-import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator;
-
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-import com.sun.corba.se.impl.encoding.CDRInputStream_1_0;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.protocol.CorbaInvocationInfo;
-import com.sun.corba.se.impl.util.RepositoryId;
-
-/**
- * Implementation of the ClientRequestInfo interface as specified in
- * orbos/99-12-02 section 5.4.2.
- */
-public final class ClientRequestInfoImpl
- extends RequestInfoImpl
- implements ClientRequestInfo
-{
-
- // The available constants for startingPointCall
- static final int CALL_SEND_REQUEST = 0;
- static final int CALL_SEND_POLL = 1;
-
- // The available constants for endingPointCall
- static final int CALL_RECEIVE_REPLY = 0;
- static final int CALL_RECEIVE_EXCEPTION = 1;
- static final int CALL_RECEIVE_OTHER = 2;
-
- //////////////////////////////////////////////////////////////////////
- //
- // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
- //
- //////////////////////////////////////////////////////////////////////
-
- // The current retry request status. True if this request is being
- // retried and this info object is to be reused, or false otherwise.
- private RetryType retryRequest;
-
- // The number of times this info object has been (re)used. This is
- // incremented every time a request is retried, and decremented every
- // time a request is complete. When this reaches zero, the info object
- // is popped from the ClientRequestInfoImpl ThreadLocal stack in the ORB.
- private int entryCount = 0;
-
- // The RequestImpl is set when the call is DII based.
- // The DII query calls like ParameterList, ExceptionList,
- // ContextList will be delegated to RequestImpl.
- private org.omg.CORBA.Request request;
-
- // Sources of client request information
- private boolean diiInitiate;
- private CorbaMessageMediator messageMediator;
-
- // Cached information:
- private org.omg.CORBA.Object cachedTargetObject;
- private org.omg.CORBA.Object cachedEffectiveTargetObject;
- private Parameter[] cachedArguments;
- private TypeCode[] cachedExceptions;
- private String[] cachedContexts;
- private String[] cachedOperationContext;
- private String cachedReceivedExceptionId;
- private Any cachedResult;
- private Any cachedReceivedException;
- private TaggedProfile cachedEffectiveProfile;
- // key = Integer, value = IOP.ServiceContext.
- private HashMap cachedRequestServiceContexts;
- // key = Integer, value = IOP.ServiceContext.
- private HashMap cachedReplyServiceContexts;
- // key = Integer, value = TaggedComponent
- private HashMap cachedEffectiveComponents;
-
-
- protected boolean piCurrentPushed;
-
- //////////////////////////////////////////////////////////////////////
- //
- // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
- //
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Reset the info object so that it can be reused for a retry,
- * for example.
- */
- void reset() {
- super.reset();
-
- // Please keep these in the same order that they're declared above.
-
- // 6763340
- retryRequest = RetryType.NONE;
-
- // Do not reset entryCount because we need to know when to pop this
- // from the stack.
-
- request = null;
- diiInitiate = false;
- messageMediator = null;
-
- // Clear cached attributes:
- cachedTargetObject = null;
- cachedEffectiveTargetObject = null;
- cachedArguments = null;
- cachedExceptions = null;
- cachedContexts = null;
- cachedOperationContext = null;
- cachedReceivedExceptionId = null;
- cachedResult = null;
- cachedReceivedException = null;
- cachedEffectiveProfile = null;
- cachedRequestServiceContexts = null;
- cachedReplyServiceContexts = null;
- cachedEffectiveComponents = null;
-
- piCurrentPushed = false;
-
- startingPointCall = CALL_SEND_REQUEST;
- endingPointCall = CALL_RECEIVE_REPLY;
-
- }
-
- /*
- **********************************************************************
- * Access protection
- **********************************************************************/
-
- // Method IDs for all methods in ClientRequestInfo. This allows for a
- // convenient O(1) lookup for checkAccess().
- protected static final int MID_TARGET = MID_RI_LAST + 1;
- protected static final int MID_EFFECTIVE_TARGET = MID_RI_LAST + 2;
- protected static final int MID_EFFECTIVE_PROFILE = MID_RI_LAST + 3;
- protected static final int MID_RECEIVED_EXCEPTION = MID_RI_LAST + 4;
- protected static final int MID_RECEIVED_EXCEPTION_ID = MID_RI_LAST + 5;
- protected static final int MID_GET_EFFECTIVE_COMPONENT = MID_RI_LAST + 6;
- protected static final int MID_GET_EFFECTIVE_COMPONENTS
- = MID_RI_LAST + 7;
- protected static final int MID_GET_REQUEST_POLICY = MID_RI_LAST + 8;
- protected static final int MID_ADD_REQUEST_SERVICE_CONTEXT
- = MID_RI_LAST + 9;
-
- // ClientRequestInfo validity table (see ptc/00-08-06 table 21-1).
- // Note: These must be in the same order as specified in contants.
- private static final boolean validCall[][] = {
- // LEGEND:
- // s_req = send_request r_rep = receive_reply
- // s_pol = send_poll r_exc = receive_exception
- // r_oth = receive_other
- //
- // A true value indicates call is valid at specified point.
- // A false value indicates the call is invalid.
- //
- //
- // NOTE: If the order or number of columns change, update
- // checkAccess() accordingly.
- //
- // { s_req, s_pol, r_rep, r_exc, r_oth }
- // RequestInfo methods:
- /*request_id*/ { true , true , true , true , true },
- /*operation*/ { true , true , true , true , true },
- /*arguments*/ { true , false, true , false, false },
- /*exceptions*/ { true , false, true , true , true },
- /*contexts*/ { true , false, true , true , true },
- /*operation_context*/ { true , false, true , true , true },
- /*result*/ { false, false, true , false, false },
- /*response_expected*/ { true , true , true , true , true },
- /*sync_scope*/ { true , false, true , true , true },
- /*reply_status*/ { false, false, true , true , true },
- /*forward_reference*/ { false, false, false, false, true },
- /*get_slot*/ { true , true , true , true , true },
- /*get_request_service_context*/ { true , false, true , true , true },
- /*get_reply_service_context*/ { false, false, true , true , true },
- //
- // ClientRequestInfo methods::
- /*target*/ { true , true , true , true , true },
- /*effective_target*/ { true , true , true , true , true },
- /*effective_profile*/ { true , true , true , true , true },
- /*received_exception*/ { false, false, false, true , false },
- /*received_exception_id*/ { false, false, false, true , false },
- /*get_effective_component*/ { true , false, true , true , true },
- /*get_effective_components*/ { true , false, true , true , true },
- /*get_request_policy*/ { true , false, true , true , true },
- /*add_request_service_context*/ { true , false, false, false, false }
- };
-
-
- /*
- **********************************************************************
- * Public ClientRequestInfo interfaces
- **********************************************************************/
-
- /**
- * Creates a new ClientRequestInfo implementation.
- * The constructor is package scope since no other package need create
- * an instance of this class.
- */
- protected ClientRequestInfoImpl( ORB myORB ) {
- super( myORB );
- startingPointCall = CALL_SEND_REQUEST;
- endingPointCall = CALL_RECEIVE_REPLY;
- }
-
- /**
- * The object which the client called to perform the operation.
- */
- public org.omg.CORBA.Object target (){
- // access is currently valid for all states:
- //checkAccess( MID_TARGET );
- if (cachedTargetObject == null) {
- CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
- messageMediator.getContactInfo();
- cachedTargetObject =
- iorToObject(corbaContactInfo.getTargetIOR());
- }
- return cachedTargetObject;
- }
-
- /**
- * The actual object on which the operation will be invoked. If the
- * reply_status is LOCATION_FORWARD, then on subsequent requests,
- * effective_target will contain the forwarded IOR while target will
- * remain unchanged.
- */
- public org.omg.CORBA.Object effective_target() {
- // access is currently valid for all states:
- //checkAccess( MID_EFFECTIVE_TARGET );
-
- // Note: This is not necessarily the same as locatedIOR.
- // Reason: See the way we handle COMM_FAILURES in
- // ClientRequestDispatcher.createRequest, v1.32
-
- if (cachedEffectiveTargetObject == null) {
- CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
- messageMediator.getContactInfo();
- // REVISIT - get through chain like getLocatedIOR helper below.
- cachedEffectiveTargetObject =
- iorToObject(corbaContactInfo.getEffectiveTargetIOR());
- }
- return cachedEffectiveTargetObject;
- }
-
- /**
- * The profile that will be used to send the request. If a location
- * forward has occurred for this operation's object and that object's
- * profile change accordingly, then this profile will be that located
- * profile.
- */
- public TaggedProfile effective_profile (){
- // access is currently valid for all states:
- //checkAccess( MID_EFFECTIVE_PROFILE );
-
- if( cachedEffectiveProfile == null ) {
- CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
- messageMediator.getContactInfo();
- cachedEffectiveProfile =
- corbaContactInfo.getEffectiveProfile().getIOPProfile();
- }
-
- // Good citizen: In the interest of efficiency, we assume interceptors
- // will not modify the returned TaggedProfile in any way so we need
- // not make a deep copy of it.
-
- return cachedEffectiveProfile;
- }
-
- /**
- * Contains the exception to be returned to the client.
- */
- public Any received_exception (){
- checkAccess( MID_RECEIVED_EXCEPTION );
-
- if( cachedReceivedException == null ) {
- cachedReceivedException = exceptionToAny( exception );
- }
-
- // Good citizen: In the interest of efficiency, we assume interceptors
- // will not modify the returned Any in any way so we need
- // not make a deep copy of it.
-
- return cachedReceivedException;
- }
-
- /**
- * The CORBA::RepositoryId of the exception to be returned to the client.
- */
- public String received_exception_id (){
- checkAccess( MID_RECEIVED_EXCEPTION_ID );
-
- if( cachedReceivedExceptionId == null ) {
- String result = null;
-
- if( exception == null ) {
- // Note: exception should never be null here since we will
- // throw a BAD_INV_ORDER if this is not called from
- // receive_exception.
- throw wrapper.exceptionWasNull() ;
- } else if( exception instanceof SystemException ) {
- String name = exception.getClass().getName();
- result = ORBUtility.repositoryIdOf(name);
- } else if( exception instanceof ApplicationException ) {
- result = ((ApplicationException)exception).getId();
- }
-
- // _REVISIT_ We need to be able to handle a UserException in the
- // DII case. How do we extract the ID from a UserException?
-
- cachedReceivedExceptionId = result;
- }
-
- return cachedReceivedExceptionId;
- }
-
- /**
- * Returns the IOP::TaggedComponent with the given ID from the profile
- * selected for this request. IF there is more than one component for a
- * given component ID, it is undefined which component this operation
- * returns (get_effective_component should be called instead).
- */
- public TaggedComponent get_effective_component (int id){
- checkAccess( MID_GET_EFFECTIVE_COMPONENT );
-
- return get_effective_components( id )[0];
- }
-
- /**
- * Returns all the tagged components with the given ID from the profile
- * selected for this request.
- */
- public TaggedComponent[] get_effective_components (int id){
- checkAccess( MID_GET_EFFECTIVE_COMPONENTS );
- Integer integerId = new Integer( id );
- TaggedComponent[] result = null;
- boolean justCreatedCache = false;
-
- if( cachedEffectiveComponents == null ) {
- cachedEffectiveComponents = new HashMap();
- justCreatedCache = true;
- }
- else {
- // Look in cache:
- result = (TaggedComponent[])cachedEffectiveComponents.get(
- integerId );
- }
-
- // null could mean we cached null or not in cache.
- if( (result == null) &&
- (justCreatedCache ||
- !cachedEffectiveComponents.containsKey( integerId ) ) )
- {
- // Not in cache. Get it from the profile:
- CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
- messageMediator.getContactInfo();
- IIOPProfileTemplate ptemp =
- (IIOPProfileTemplate)corbaContactInfo.getEffectiveProfile().
- getTaggedProfileTemplate();
- result = ptemp.getIOPComponents(myORB, id);
- cachedEffectiveComponents.put( integerId, result );
- }
-
- // As per ptc/00-08-06, section 21.3.13.6., If not found, raise
- // BAD_PARAM with minor code INVALID_COMPONENT_ID.
- if( (result == null) || (result.length == 0) ) {
- throw stdWrapper.invalidComponentId( integerId ) ;
- }
-
- // Good citizen: In the interest of efficiency, we will assume
- // interceptors will not modify the returned TaggedCompoent[], or
- // the TaggedComponents inside of it. Otherwise, we would need to
- // clone the array and make a deep copy of its contents.
-
- return result;
- }
-
- /**
- * Returns the given policy in effect for this operation.
- */
- public Policy get_request_policy (int type){
- checkAccess( MID_GET_REQUEST_POLICY );
- // _REVISIT_ Our ORB is not policy-based at this time.
- throw wrapper.piOrbNotPolicyBased() ;
- }
-
- /**
- * Allows interceptors to add service contexts to the request.
- * <p>
- * There is no declaration of the order of the service contexts. They
- * may or may not appear in the order they are added.
- */
- public void add_request_service_context (ServiceContext service_context,
- boolean replace)
- {
- checkAccess( MID_ADD_REQUEST_SERVICE_CONTEXT );
-
- if( cachedRequestServiceContexts == null ) {
- cachedRequestServiceContexts = new HashMap();
- }
-
- addServiceContext( cachedRequestServiceContexts,
- messageMediator.getRequestServiceContexts(),
- service_context, replace );
- }
-
- // NOTE: When adding a method, be sure to:
- // 1. Add a MID_* constant for that method
- // 2. Call checkAccess at the start of the method
- // 3. Define entries in the validCall[][] table for interception points.
-
- /*
- **********************************************************************
- * Public RequestInfo interfaces
- *
- * These are implemented here because they have differing
- * implementations depending on whether this is a client or a server
- * request info object.
- **********************************************************************/
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public int request_id (){
- // access is currently valid for all states:
- //checkAccess( MID_REQUEST_ID );
- /*
- * NOTE: The requestId in client interceptors is the same as the
- * GIOP request id. This works because both interceptors and
- * request ids are scoped by the ORB on the client side.
- */
- return messageMediator.getRequestId();
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public String operation (){
- // access is currently valid for all states:
- //checkAccess( MID_OPERATION );
- return messageMediator.getOperationName();
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public Parameter[] arguments (){
- checkAccess( MID_ARGUMENTS );
-
- if( cachedArguments == null ) {
- if( request == null ) {
- throw stdWrapper.piOperationNotSupported1() ;
- }
-
- // If it is DII request then get the arguments from the DII req
- // and convert that into parameters.
- cachedArguments = nvListToParameterArray( request.arguments() );
- }
-
- // Good citizen: In the interest of efficiency, we assume
- // interceptors will be "good citizens" in that they will not
- // modify the contents of the Parameter[] array. We also assume
- // they will not change the values of the containing Anys.
-
- return cachedArguments;
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public TypeCode[] exceptions (){
- checkAccess( MID_EXCEPTIONS );
-
- if( cachedExceptions == null ) {
- if( request == null ) {
- throw stdWrapper.piOperationNotSupported2() ;
- }
-
- // Get the list of exceptions from DII request data, If there are
- // no exceptions raised then this method will return null.
- ExceptionList excList = request.exceptions( );
- int count = excList.count();
- TypeCode[] excTCList = new TypeCode[count];
- try {
- for( int i = 0; i < count; i++ ) {
- excTCList[i] = excList.item( i );
- }
- } catch( Exception e ) {
- throw wrapper.exceptionInExceptions( e ) ;
- }
-
- cachedExceptions = excTCList;
- }
-
- // Good citizen: In the interest of efficiency, we assume
- // interceptors will be "good citizens" in that they will not
- // modify the contents of the TypeCode[] array. We also assume
- // they will not change the values of the containing TypeCodes.
-
- return cachedExceptions;
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public String[] contexts (){
- checkAccess( MID_CONTEXTS );
-
- if( cachedContexts == null ) {
- if( request == null ) {
- throw stdWrapper.piOperationNotSupported3() ;
- }
-
- // Get the list of contexts from DII request data, If there are
- // no contexts then this method will return null.
- ContextList ctxList = request.contexts( );
- int count = ctxList.count();
- String[] ctxListToReturn = new String[count];
- try {
- for( int i = 0; i < count; i++ ) {
- ctxListToReturn[i] = ctxList.item( i );
- }
- } catch( Exception e ) {
- throw wrapper.exceptionInContexts( e ) ;
- }
-
- cachedContexts = ctxListToReturn;
- }
-
- // Good citizen: In the interest of efficiency, we assume
- // interceptors will be "good citizens" in that they will not
- // modify the contents of the String[] array.
-
- return cachedContexts;
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public String[] operation_context (){
- checkAccess( MID_OPERATION_CONTEXT );
-
- if( cachedOperationContext == null ) {
- if( request == null ) {
- throw stdWrapper.piOperationNotSupported4() ;
- }
-
- // Get the list of contexts from DII request data, If there are
- // no contexts then this method will return null.
- Context ctx = request.ctx( );
- // _REVISIT_ The API for get_values is not compliant with the spec,
- // Revisit this code once it's fixed.
- // _REVISIT_ Our ORB doesn't support Operation Context, This code
- // will not be excerscised until it's supported.
- // The first parameter in get_values is the start_scope which
- // if blank makes it as a global scope.
- // The second parameter is op_flags which is set to RESTRICT_SCOPE
- // As there is only one defined in the spec.
- // The Third param is the pattern which is '*' requiring it to
- // get all the contexts.
- NVList nvList = ctx.get_values( "", CTX_RESTRICT_SCOPE.value,"*" );
- String[] context = new String[(nvList.count() * 2) ];
- if( ( nvList != null ) &&( nvList.count() != 0 ) ) {
- // The String[] array will contain Name and Value for each
- // context and hence double the size in the array.
- int index = 0;
- for( int i = 0; i < nvList.count(); i++ ) {
- NamedValue nv;
- try {
- nv = nvList.item( i );
- }
- catch (Exception e ) {
- return (String[]) null;
- }
- context[index] = nv.name();
- index++;
- context[index] = nv.value().extract_string();
- index++;
- }
- }
-
- cachedOperationContext = context;
- }
-
- // Good citizen: In the interest of efficiency, we assume
- // interceptors will be "good citizens" in that they will not
- // modify the contents of the String[] array.
-
- return cachedOperationContext;
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public Any result (){
- checkAccess( MID_RESULT );
-
- if( cachedResult == null ) {
- if( request == null ) {
- throw stdWrapper.piOperationNotSupported5() ;
- }
- // Get the result from the DII request data.
- NamedValue nvResult = request.result( );
-
- if( nvResult == null ) {
- throw wrapper.piDiiResultIsNull() ;
- }
-
- cachedResult = nvResult.value();
- }
-
- // Good citizen: In the interest of efficiency, we assume that
- // interceptors will not modify the contents of the result Any.
- // Otherwise, we would need to create a deep copy of the Any.
-
- return cachedResult;
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public boolean response_expected (){
- // access is currently valid for all states:
- //checkAccess( MID_RESPONSE_EXPECTED );
- return ! messageMediator.isOneWay();
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public Object forward_reference (){
- checkAccess( MID_FORWARD_REFERENCE );
- // Check to make sure we are in LOCATION_FORWARD
- // state as per ptc/00-08-06, table 21-1
- // footnote 2.
- if( replyStatus != LOCATION_FORWARD.value ) {
- throw stdWrapper.invalidPiCall1() ;
- }
-
- // Do not cache this value since if an interceptor raises
- // forward request then the next interceptor in the
- // list should see the new value.
- IOR ior = getLocatedIOR();
- return iorToObject(ior);
- }
-
- private IOR getLocatedIOR()
- {
- IOR ior;
- CorbaContactInfoList contactInfoList = (CorbaContactInfoList)
- messageMediator.getContactInfo().getContactInfoList();
- ior = contactInfoList.getEffectiveTargetIOR();
- return ior;
- }
-
- protected void setLocatedIOR(IOR ior)
- {
- ORB orb = (ORB) messageMediator.getBroker();
-
- CorbaContactInfoListIterator iterator = (CorbaContactInfoListIterator)
- ((CorbaInvocationInfo)orb.getInvocationInfo())
- .getContactInfoListIterator();
-
- // REVISIT - this most likely causes reportRedirect to happen twice.
- // Once here and once inside the request dispatcher.
- iterator.reportRedirect(
- (CorbaContactInfo)messageMediator.getContactInfo(),
- ior);
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public org.omg.IOP.ServiceContext get_request_service_context( int id ) {
- checkAccess( MID_GET_REQUEST_SERVICE_CONTEXT );
-
- if( cachedRequestServiceContexts == null ) {
- cachedRequestServiceContexts = new HashMap();
- }
-
- return getServiceContext(cachedRequestServiceContexts,
- messageMediator.getRequestServiceContexts(),
- id);
- }
-
- /**
- * does not contain an etry for that ID, BAD_PARAM with a minor code of
- * TBD_BP is raised.
- */
- public org.omg.IOP.ServiceContext get_reply_service_context( int id ) {
- checkAccess( MID_GET_REPLY_SERVICE_CONTEXT );
-
- if( cachedReplyServiceContexts == null ) {
- cachedReplyServiceContexts = new HashMap();
- }
-
- // In the event this is called from a oneway, we will have no
- // response object.
- //
- // In the event this is called after a IIOPConnection.purgeCalls,
- // we will have a response object, but that object will
- // not contain a header (which would hold the service context
- // container). See bug 4624102.
- //
- // REVISIT: this is the only thing used
- // from response at this time. However, a more general solution
- // would avoid accessing other parts of response's header.
- //
- // Instead of throwing a NullPointer, we will
- // "gracefully" handle these with a BAD_PARAM with minor code 25.
-
- try {
- ServiceContexts serviceContexts =
- messageMediator.getReplyServiceContexts();
- if (serviceContexts == null) {
- throw new NullPointerException();
- }
- return getServiceContext(cachedReplyServiceContexts,
- serviceContexts, id);
- } catch (NullPointerException e) {
- // REVISIT how this is programmed - not what it does.
- // See purge calls test. The waiter is woken up by the
- // call to purge calls - but there is no reply containing
- // service contexts.
- throw stdWrapper.invalidServiceContextId( e ) ;
- }
- }
-
- //
- // REVISIT
- // Override RequestInfoImpl connection to work in framework.
- //
-
- public com.sun.corba.se.spi.legacy.connection.Connection connection()
- {
- return (com.sun.corba.se.spi.legacy.connection.Connection)
- messageMediator.getConnection();
- }
-
-
-
- /*
- **********************************************************************
- * Package-scope interfaces
- **********************************************************************/
-
- protected void setInfo(MessageMediator messageMediator)
- {
- this.messageMediator = (CorbaMessageMediator)messageMediator;
- // REVISIT - so mediator can handle DII in subcontract.
- this.messageMediator.setDIIInfo(request);
- }
-
- /**
- * Set or reset the retry request flag.
- */
- void setRetryRequest( RetryType retryRequest ) {
- this.retryRequest = retryRequest;
- }
-
- /**
- * Retrieve the current retry request status.
- */
- RetryType getRetryRequest() {
- // 6763340
- return this.retryRequest;
- }
-
- /**
- * Increases the entry count by 1.
- */
- void incrementEntryCount() {
- this.entryCount++;
- }
-
- /**
- * Decreases the entry count by 1.
- */
- void decrementEntryCount() {
- this.entryCount--;
- }
-
- /**
- * Retrieve the current entry count
- */
- int getEntryCount() {
- return this.entryCount;
- }
-
- /**
- * Overridden from RequestInfoImpl. Calls the super class, then
- * sets the ending point call depending on the reply status.
- */
- protected void setReplyStatus( short replyStatus ) {
- super.setReplyStatus( replyStatus );
- switch( replyStatus ) {
- case SUCCESSFUL.value:
- endingPointCall = CALL_RECEIVE_REPLY;
- break;
- case SYSTEM_EXCEPTION.value:
- case USER_EXCEPTION.value:
- endingPointCall = CALL_RECEIVE_EXCEPTION;
- break;
- case LOCATION_FORWARD.value:
- case TRANSPORT_RETRY.value:
- endingPointCall = CALL_RECEIVE_OTHER;
- break;
- }
- }
-
- /**
- * Sets DII request object in the RequestInfoObject.
- */
- protected void setDIIRequest(org.omg.CORBA.Request req) {
- request = req;
- }
-
- /**
- * Keeps track of whether initiate was called for a DII request. The ORB
- * needs to know this so it knows whether to ignore a second call to
- * initiateClientPIRequest or not.
- */
- protected void setDIIInitiate( boolean diiInitiate ) {
- this.diiInitiate = diiInitiate;
- }
-
- /**
- * See comment for setDIIInitiate
- */
- protected boolean isDIIInitiate() {
- return this.diiInitiate;
- }
-
- /**
- * The PICurrent stack should only be popped if it was pushed.
- * This is generally the case. But exceptions which occur
- * after the stub's entry to _request but before the push
- * end up in _releaseReply which will try to pop unless told not to.
- */
- protected void setPICurrentPushed( boolean piCurrentPushed ) {
- this.piCurrentPushed = piCurrentPushed;
- }
-
- protected boolean isPICurrentPushed() {
- return this.piCurrentPushed;
- }
-
- /**
- * Overridden from RequestInfoImpl.
- */
- protected void setException( Exception exception ) {
- super.setException( exception );
-
- // Clear cached values:
- cachedReceivedException = null;
- cachedReceivedExceptionId = null;
- }
-
- protected boolean getIsOneWay() {
- return ! response_expected();
- }
-
- /**
- * See description for RequestInfoImpl.checkAccess
- */
- protected void checkAccess( int methodID )
- throws BAD_INV_ORDER
- {
- // Make sure currentPoint matches the appropriate index in the
- // validCall table:
- int validCallIndex = 0;
- switch( currentExecutionPoint ) {
- case EXECUTION_POINT_STARTING:
- switch( startingPointCall ) {
- case CALL_SEND_REQUEST:
- validCallIndex = 0;
- break;
- case CALL_SEND_POLL:
- validCallIndex = 1;
- break;
- }
- break;
- case EXECUTION_POINT_ENDING:
- switch( endingPointCall ) {
- case CALL_RECEIVE_REPLY:
- validCallIndex = 2;
- break;
- case CALL_RECEIVE_EXCEPTION:
- validCallIndex = 3;
- break;
- case CALL_RECEIVE_OTHER:
- validCallIndex = 4;
- break;
- }
- break;
- }
-
- // Check the validCall table:
- if( !validCall[methodID][validCallIndex] ) {
- throw stdWrapper.invalidPiCall2() ;
- }
- }
-
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/CodecFactoryImpl.java b/src/share/classes/com/sun/corba/se/impl/interceptors/CodecFactoryImpl.java
deleted file mode 100644
index 5274b55..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/CodecFactoryImpl.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.IOP.Codec;
-import org.omg.IOP.CodecFactory;
-import org.omg.IOP.CodecFactoryPackage.UnknownEncoding;
-import org.omg.IOP.Encoding;
-import org.omg.IOP.ENCODING_CDR_ENCAPS;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.LocalObject;
-
-/**
- * CodecFactoryImpl is the implementation of the Codec Factory, as described
- * in orbos/99-12-02.
- */
-public final class CodecFactoryImpl
- extends org.omg.CORBA.LocalObject
- implements CodecFactory
-{
- // The ORB that created this Codec Factory
- private ORB orb;
- private ORBUtilSystemException wrapper ;
-
- // The maximum minor version of GIOP supported by this codec factory.
- // Currently, this is 1.2.
- private static final int MAX_MINOR_VERSION_SUPPORTED = 2;
-
- // The pre-created minor versions of Codec version 1.0, 1.1, ...,
- // 1.(MAX_MINOR_VERSION_SUPPORTED)
- private Codec codecs[] = new Codec[MAX_MINOR_VERSION_SUPPORTED + 1];
-
- /**
- * Creates a new CodecFactory implementation. Stores the ORB that
- * created this factory, for later use by the Codec.
- */
- public CodecFactoryImpl( ORB orb ) {
- this.orb = orb;
- wrapper = ORBUtilSystemException.get(
- (com.sun.corba.se.spi.orb.ORB)orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
-
- // Precreate a codec for version 1.0 through
- // 1.(MAX_MINOR_VERSION_SUPPORTED). This can be
- // done since Codecs are immutable in their current implementation.
- // This is an optimization that eliminates the overhead of creating
- // a new Codec each time create_codec is called.
- for( int minor = 0; minor <= MAX_MINOR_VERSION_SUPPORTED; minor++ ) {
- codecs[minor] = new CDREncapsCodec( orb, 1, minor );
- }
- }
-
- /**
- * Creates a codec of the given encoding. The only format recognized
- * by this factory is ENCODING_CDR_ENCAPS, versions 1.0 through
- * 1.(MAX_MINOR_VERSION_SUPPORTED).
- *
- * @exception UnknownEncoding Thrown if this factory cannot create a
- * Codec of the given encoding.
- */
- public Codec create_codec ( Encoding enc )
- throws UnknownEncoding
- {
- if( enc == null ) nullParam();
-
- Codec result = null;
-
- // This is the only format we can currently create codecs for:
- if( (enc.format == ENCODING_CDR_ENCAPS.value) &&
- (enc.major_version == 1) )
- {
- if( (enc.minor_version >= 0) &&
- (enc.minor_version <= MAX_MINOR_VERSION_SUPPORTED) )
- {
- result = codecs[enc.minor_version];
- }
- }
-
- if( result == null ) {
- throw new UnknownEncoding();
- }
-
- return result;
- }
-
- /**
- * Called when an invalid null parameter was passed. Throws a
- * BAD_PARAM with a minor code of 1
- */
- private void nullParam()
- {
- throw wrapper.nullParam() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/IORInfoImpl.java b/src/share/classes/com/sun/corba/se/impl/interceptors/IORInfoImpl.java
deleted file mode 100644
index 6f0a106..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/IORInfoImpl.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import java.util.Iterator ;
-
-import org.omg.IOP.TaggedComponent;
-
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INV_POLICY;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.LocalObject;
-
-import org.omg.PortableInterceptor.IORInfo;
-import org.omg.PortableInterceptor.ObjectReferenceTemplate;
-import org.omg.PortableInterceptor.ObjectReferenceFactory;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter;
-
-import com.sun.corba.se.spi.legacy.interceptor.IORInfoExt;
-import com.sun.corba.se.spi.legacy.interceptor.UnknownType;
-
-import com.sun.corba.se.spi.ior.IORTemplate;
-import com.sun.corba.se.spi.ior.TaggedProfileTemplate;
-import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.logging.InterceptorsSystemException ;
-import com.sun.corba.se.impl.logging.OMGSystemException ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-/**
- * IORInfoImpl is the implementation of the IORInfo class, as described
- * in orbos/99-12-02, section 7.
- */
-public final class IORInfoImpl
- extends LocalObject
- implements IORInfo, IORInfoExt
-{
- // State values that determine which methods are allowed.
- // get_effective_policy, manager_id, and adapter_state are valid unless STATE_DONE
-
- // add_component, and add_component_to_profile are valid.
- private static final int STATE_INITIAL = 0 ;
-
- // adapter_template, and R/W to current_factory are valid
- private static final int STATE_ESTABLISHED = 1 ;
-
- // No methods are valid in this state
- private static final int STATE_DONE = 2 ;
-
- // The current state of this object
- private int state = STATE_INITIAL ;
-
- // The ObjectAdapter associated with this IORInfo object.
- private ObjectAdapter adapter;
-
- private ORB orb ;
-
- private ORBUtilSystemException orbutilWrapper ;
- private InterceptorsSystemException wrapper ;
- private OMGSystemException omgWrapper ;
-
- /**
- * Creates a new IORInfo implementation. This info object will establish
- * tagged components with the template for the provided IOR Template.
- */
- IORInfoImpl( ObjectAdapter adapter ) {
- this.orb = adapter.getORB() ;
-
- orbutilWrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- wrapper = InterceptorsSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- omgWrapper = OMGSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
-
- this.adapter = adapter;
- }
-
- /**
- * An ORB service implementation may determine what server side policy
- * of a particular type is in effect for an IOR being constructed by
- * calling the get_effective_policy operation. When the IOR being
- * constructed is for an object implemented using a POA, all Policy
- * objects passed to the PortableServer::POA::create_POA call that
- * created that POA are accessible via get_effective_policy.
- * <p>
- * If a policy for the given type is not known to the ORB, then this
- * operation will raise INV_POLICY with a standard minor code of 2.
- *
- * @param type The CORBA::PolicyType specifying the type of policy to
- * return.
- * @return The effective CORBA::Policy object of the requested type.
- * If the given policy type is known, but no policy of that tpye is
- * in effect, then this operation will return a nil object reference.
- */
- public Policy get_effective_policy (int type) {
- checkState( STATE_INITIAL, STATE_ESTABLISHED ) ;
-
- return adapter.getEffectivePolicy( type );
- }
-
- /**
- * A portable ORB service implementation calls this method from its
- * implementation of establish_components to add a tagged component to
- * the set which will be included when constructing IORs. The
- * components in this set will be included in all profiles.
- * <p>
- * Any number of components may exist with the same component ID.
- *
- * @param tagged_component The IOP::TaggedComponent to add
- */
- public void add_ior_component (TaggedComponent tagged_component) {
- checkState( STATE_INITIAL ) ;
-
- if( tagged_component == null ) nullParam();
- addIORComponentToProfileInternal( tagged_component,
- adapter.getIORTemplate().iterator());
- }
-
- /**
- * A portable ORB service implementation calls this method from its
- * implementation of establish_components to add a tagged component to
- * the set which will be included when constructing IORs. The
- * components in this set will be included in the specified profile.
- * <p>
- * Any number of components may exist with the same component ID.
- * <p>
- * If the given profile ID does not define a known profile or it is
- * impossible to add components to thgat profile, BAD_PARAM is raised
- * with a minor code of TBD_BP + 3.
- *
- * @param tagged_component The IOP::TaggedComponent to add.
- * @param profile_id The IOP::ProfileId tof the profile to which this
- * component will be added.
- */
- public void add_ior_component_to_profile (
- TaggedComponent tagged_component, int profile_id )
- {
- checkState( STATE_INITIAL ) ;
-
- if( tagged_component == null ) nullParam();
- addIORComponentToProfileInternal(
- tagged_component, adapter.getIORTemplate().iteratorById(
- profile_id ) );
- }
-
- /**
- * @param type The type of the server port
- * (see connection.ORBSocketFactory for discussion).
- * @return The listen port number for that type.
- * @throws UnknownType if no port of the given type is found.
- */
- public int getServerPort(String type)
- throws UnknownType
- {
- checkState( STATE_INITIAL, STATE_ESTABLISHED ) ;
-
- int port =
- orb.getLegacyServerSocketManager()
- .legacyGetTransientOrPersistentServerPort(type);
- if (port == -1) {
- throw new UnknownType();
- }
- return port;
- }
-
- public ObjectAdapter getObjectAdapter()
- {
- return adapter;
- }
-
- public int manager_id()
- {
- checkState( STATE_INITIAL, STATE_ESTABLISHED) ;
-
- return adapter.getManagerId() ;
- }
-
- public short state()
- {
- checkState( STATE_INITIAL, STATE_ESTABLISHED) ;
-
- return adapter.getState() ;
- }
-
- public ObjectReferenceTemplate adapter_template()
- {
- checkState( STATE_ESTABLISHED) ;
-
- // At this point, the iortemp must contain only a single
- // IIOPProfileTemplate. This is a restriction of our
- // implementation. Also, note the the ObjectReferenceTemplate
- // is called when a certain POA is created in a certain ORB
- // in a certain server, so the server_id, orb_id, and
- // poa_id operations must be well-defined no matter what
- // kind of implementation is used: e.g., if a POA creates
- // IORs with multiple profiles, they must still all agree
- // about this information. Thus, we are justified in
- // extracting the single IIOPProfileTemplate to create
- // an ObjectReferenceTemplate here.
-
- return adapter.getAdapterTemplate() ;
- }
-
- public ObjectReferenceFactory current_factory()
- {
- checkState( STATE_ESTABLISHED) ;
-
- return adapter.getCurrentFactory() ;
- }
-
- public void current_factory( ObjectReferenceFactory factory )
- {
- checkState( STATE_ESTABLISHED) ;
-
- adapter.setCurrentFactory( factory ) ;
- }
-
- /**
- * Internal utility method to add an IOR component to the set of profiles
- * present in the iterator.
- */
- private void addIORComponentToProfileInternal(
- TaggedComponent tagged_component, Iterator iterator )
- {
- // Convert the given IOP::TaggedComponent into the appropriate
- // type for the TaggedProfileTemplate
- TaggedComponentFactoryFinder finder =
- orb.getTaggedComponentFactoryFinder();
- Object newTaggedComponent = finder.create( orb, tagged_component );
-
- // Iterate through TaggedProfileTemplates and add the given tagged
- // component to the appropriate one(s).
- boolean found = false;
- while( iterator.hasNext() ) {
- found = true;
- TaggedProfileTemplate taggedProfileTemplate =
- (TaggedProfileTemplate)iterator.next();
- taggedProfileTemplate.add( newTaggedComponent );
- }
-
- // If no profile was found with the given id, throw a BAD_PARAM:
- // (See orbos/00-08-06, section 21.5.3.3.)
- if( !found ) {
- throw omgWrapper.invalidProfileId() ;
- }
- }
-
- /**
- * Called when an invalid null parameter was passed. Throws a
- * BAD_PARAM with a minor code of 1
- */
- private void nullParam()
- {
- throw orbutilWrapper.nullParam() ;
- }
-
- // REVISIT: add minor codes!
-
- private void checkState( int expectedState )
- {
- if (expectedState != state)
- throw wrapper.badState1( new Integer(expectedState), new Integer(state) ) ;
- }
-
- private void checkState( int expectedState1, int expectedState2 )
- {
- if ((expectedState1 != state) && (expectedState2 != state))
- throw wrapper.badState2( new Integer(expectedState1),
- new Integer(expectedState2), new Integer(state) ) ;
- }
-
- void makeStateEstablished()
- {
- checkState( STATE_INITIAL ) ;
-
- state = STATE_ESTABLISHED ;
- }
-
- void makeStateDone()
- {
- checkState( STATE_ESTABLISHED ) ;
-
- state = STATE_DONE ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/InterceptorInvoker.java b/src/share/classes/com/sun/corba/se/impl/interceptors/InterceptorInvoker.java
deleted file mode 100644
index 367ed23..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/InterceptorInvoker.java
+++ /dev/null
@@ -1,662 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.portable.Delegate;
-import org.omg.PortableInterceptor.LOCATION_FORWARD;
-import org.omg.PortableInterceptor.SUCCESSFUL;
-import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
-import org.omg.PortableInterceptor.TRANSPORT_RETRY;
-import org.omg.PortableInterceptor.USER_EXCEPTION;
-import org.omg.PortableInterceptor.ClientRequestInfo;
-import org.omg.PortableInterceptor.ClientRequestInterceptor;
-import org.omg.PortableInterceptor.ForwardRequest;
-import org.omg.PortableInterceptor.IORInterceptor;
-import org.omg.PortableInterceptor.IORInterceptor_3_0;
-import org.omg.PortableInterceptor.ServerRequestInfo;
-import org.omg.PortableInterceptor.ServerRequestInterceptor;
-import org.omg.PortableInterceptor.ObjectReferenceTemplate;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.oa.ObjectAdapter;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-
-/**
- * Handles invocation of interceptors. Has specific knowledge of how to
- * invoke IOR, ClientRequest, and ServerRequest interceptors.
- * Makes use of the InterceptorList to retrieve the list of interceptors to
- * be invoked. Most methods in this class are package scope so that they
- * may only be called from the PIHandlerImpl.
- */
-public class InterceptorInvoker {
-
- // The ORB
- private ORB orb;
-
- // The list of interceptors to be invoked
- private InterceptorList interceptorList;
-
- // True if interceptors are to be invoked, or false if not
- // Note: This is a global enable/disable flag, whereas the enable flag
- // in the RequestInfoStack in PIHandlerImpl is only for a particular Thread.
- private boolean enabled = false;
-
- // PICurrent variable.
- private PICurrent current;
-
- // NOTE: Be careful about adding additional attributes to this class.
- // Multiple threads may be calling methods on this invoker at the same
- // time.
-
- /**
- * Creates a new Interceptor Invoker. Constructor is package scope so
- * only the ORB can create it. The invoker is initially disabled, and
- * must be explicitly enabled using setEnabled().
- */
- InterceptorInvoker( ORB orb, InterceptorList interceptorList,
- PICurrent piCurrent )
- {
- this.orb = orb;
- this.interceptorList = interceptorList;
- this.enabled = false;
- this.current = piCurrent;
- }
-
- /**
- * Enables or disables the interceptor invoker
- */
- void setEnabled( boolean enabled ) {
- this.enabled = enabled;
- }
-
- /*
- **********************************************************************
- * IOR Interceptor invocation
- **********************************************************************/
-
- /**
- * Called when a new POA is created.
- *
- * @param oa The Object Adapter associated with the IOR interceptor.
- */
- void objectAdapterCreated( ObjectAdapter oa ) {
- // If invocation is not yet enabled, don't do anything.
- if( enabled ) {
- // Create IORInfo object to pass to IORInterceptors:
- IORInfoImpl info = new IORInfoImpl( oa );
-
- // Call each IORInterceptor:
- IORInterceptor[] iorInterceptors =
- (IORInterceptor[])interceptorList.getInterceptors(
- InterceptorList.INTERCEPTOR_TYPE_IOR );
- int size = iorInterceptors.length;
-
- // Implementation note:
- // This loop counts backwards for greater efficiency.
- // Benchmarks have shown that counting down is more efficient
- // than counting up in Java for loops, as a compare to zero is
- // faster than a subtract and compare to zero. In this case,
- // it doesn't really matter much, but it's simply a force of habit.
-
- for( int i = (size - 1); i >= 0; i-- ) {
- IORInterceptor interceptor = iorInterceptors[i];
- try {
- interceptor.establish_components( info );
- }
- catch( Exception e ) {
- // as per PI spec (orbos/99-12-02 sec 7.2.1), if
- // establish_components throws an exception, ignore it.
- }
- }
-
- // Change the state so that only template operations are valid
- info.makeStateEstablished() ;
-
- for( int i = (size - 1); i >= 0; i-- ) {
- IORInterceptor interceptor = iorInterceptors[i];
- if (interceptor instanceof IORInterceptor_3_0) {
- IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0)interceptor ;
- // Note that exceptions here are NOT ignored, as per the
- // ORT spec (orbos/01-01-04)
- interceptor30.components_established( info );
- }
- }
-
- // Change the state so that no operations are valid,
- // in case a reference to info escapes this scope.
- // This also completes the actions associated with the
- // template interceptors on this POA.
- info.makeStateDone() ;
- }
- }
-
- void adapterManagerStateChanged( int managerId, short newState )
- {
- if (enabled) {
- IORInterceptor[] interceptors =
- (IORInterceptor[])interceptorList.getInterceptors(
- InterceptorList.INTERCEPTOR_TYPE_IOR );
- int size = interceptors.length;
-
- for( int i = (size - 1); i >= 0; i-- ) {
- try {
- IORInterceptor interceptor = interceptors[i];
- if (interceptor instanceof IORInterceptor_3_0) {
- IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0)interceptor ;
- interceptor30.adapter_manager_state_changed( managerId,
- newState );
- }
- } catch (Exception exc) {
- // No-op: ignore exception in this case
- }
- }
- }
- }
-
- void adapterStateChanged( ObjectReferenceTemplate[] templates,
- short newState )
- {
- if (enabled) {
- IORInterceptor[] interceptors =
- (IORInterceptor[])interceptorList.getInterceptors(
- InterceptorList.INTERCEPTOR_TYPE_IOR );
- int size = interceptors.length;
-
- for( int i = (size - 1); i >= 0; i-- ) {
- try {
- IORInterceptor interceptor = interceptors[i];
- if (interceptor instanceof IORInterceptor_3_0) {
- IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0)interceptor ;
- interceptor30.adapter_state_changed( templates, newState );
- }
- } catch (Exception exc) {
- // No-op: ignore exception in this case
- }
- }
- }
- }
-
- /*
- **********************************************************************
- * Client Interceptor invocation
- **********************************************************************/
-
- /**
- * Invokes either send_request, or send_poll, depending on the value
- * of info.getStartingPointCall()
- */
- void invokeClientInterceptorStartingPoint( ClientRequestInfoImpl info ) {
- // If invocation is not yet enabled, don't do anything.
- if( enabled ) {
- try {
- // Make a a fresh slot table available to TSC in case
- // interceptors need to make out calls.
- // Client's TSC is now RSC via RequestInfo.
- current.pushSlotTable( );
- info.setPICurrentPushed( true );
- info.setCurrentExecutionPoint( info.EXECUTION_POINT_STARTING );
-
- // Get all ClientRequestInterceptors:
- ClientRequestInterceptor[] clientInterceptors =
- (ClientRequestInterceptor[])interceptorList.
- getInterceptors( InterceptorList.INTERCEPTOR_TYPE_CLIENT );
- int size = clientInterceptors.length;
-
- // We will assume that all interceptors returned successfully,
- // and adjust the flowStackIndex to the appropriate value if
- // we later discover otherwise.
- int flowStackIndex = size;
- boolean continueProcessing = true;
-
- // Determine whether we are calling send_request or send_poll:
- // (This is currently commented out because our ORB does not
- // yet support the Messaging specification, so send_poll will
- // never occur. Once we have implemented messaging, this may
- // be uncommented.)
- // int startingPointCall = info.getStartingPointCall();
- for( int i = 0; continueProcessing && (i < size); i++ ) {
- try {
- clientInterceptors[i].send_request( info );
-
- // Again, it is not necessary for a switch here, since
- // there is only one starting point call type (see
- // above comment).
-
- //switch( startingPointCall ) {
- //case ClientRequestInfoImpl.CALL_SEND_REQUEST:
- //clientInterceptors[i].send_request( info );
- //break;
- //case ClientRequestInfoImpl.CALL_SEND_POLL:
- //clientInterceptors[i].send_poll( info );
- //break;
- //}
-
- }
- catch( ForwardRequest e ) {
- // as per PI spec (orbos/99-12-02 sec 5.2.1.), if
- // interception point throws a ForwardRequest,
- // no other Interceptors' send_request operations are
- // called.
- flowStackIndex = i;
- info.setForwardRequest( e );
- info.setEndingPointCall(
- ClientRequestInfoImpl.CALL_RECEIVE_OTHER );
- info.setReplyStatus( LOCATION_FORWARD.value );
-
- updateClientRequestDispatcherForward( info );
-
- // For some reason, using break here causes the VM on
- // NT to lose track of the value of flowStackIndex
- // after exiting the for loop. I changed this to
- // check a boolean value instead and it seems to work
- // fine.
- continueProcessing = false;
- }
- catch( SystemException e ) {
- // as per PI spec (orbos/99-12-02 sec 5.2.1.), if
- // interception point throws a SystemException,
- // no other Interceptors' send_request operations are
- // called.
- flowStackIndex = i;
- info.setEndingPointCall(
- ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION );
- info.setReplyStatus( SYSTEM_EXCEPTION.value );
- info.setException( e );
-
- // For some reason, using break here causes the VM on
- // NT to lose track of the value of flowStackIndex
- // after exiting the for loop. I changed this to
- // check a boolean value instead and it seems to
- // work fine.
- continueProcessing = false;
- }
- }
-
- // Remember where we left off in the flow stack:
- info.setFlowStackIndex( flowStackIndex );
- }
- finally {
- // Make the SlotTable fresh for the next interception point.
- current.resetSlotTable( );
- }
- } // end enabled check
- }
-
- /**
- * Invokes either receive_reply, receive_exception, or receive_other,
- * depending on the value of info.getEndingPointCall()
- */
- void invokeClientInterceptorEndingPoint( ClientRequestInfoImpl info ) {
- // If invocation is not yet enabled, don't do anything.
- if( enabled ) {
- try {
- // NOTE: It is assumed someplace else prepared a
- // fresh TSC slot table.
-
- info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );
-
- // Get all ClientRequestInterceptors:
- ClientRequestInterceptor[] clientInterceptors =
- (ClientRequestInterceptor[])interceptorList.
- getInterceptors( InterceptorList.INTERCEPTOR_TYPE_CLIENT );
- int flowStackIndex = info.getFlowStackIndex();
-
- // Determine whether we are calling receive_reply,
- // receive_exception, or receive_other:
- int endingPointCall = info.getEndingPointCall();
-
- // If we would be calling RECEIVE_REPLY, but this is a
- // one-way call, override this and call receive_other:
- if( ( endingPointCall ==
- ClientRequestInfoImpl.CALL_RECEIVE_REPLY ) &&
- info.getIsOneWay() )
- {
- endingPointCall = ClientRequestInfoImpl.CALL_RECEIVE_OTHER;
- info.setEndingPointCall( endingPointCall );
- }
-
- // Only step through the interceptors whose starting points
- // have successfully returned.
- // Unlike the previous loop, this one counts backwards for a
- // reason - we must execute these in the reverse order of the
- // starting points.
- for( int i = (flowStackIndex - 1); i >= 0; i-- ) {
-
- try {
- switch( endingPointCall ) {
- case ClientRequestInfoImpl.CALL_RECEIVE_REPLY:
- clientInterceptors[i].receive_reply( info );
- break;
- case ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION:
- clientInterceptors[i].receive_exception( info );
- break;
- case ClientRequestInfoImpl.CALL_RECEIVE_OTHER:
- clientInterceptors[i].receive_other( info );
- break;
- }
- }
- catch( ForwardRequest e ) {
-
- // as per PI spec (orbos/99-12-02 sec 5.2.1.), if
- // interception point throws a ForwardException,
- // ending point call changes to receive_other.
- endingPointCall =
- ClientRequestInfoImpl.CALL_RECEIVE_OTHER;
- info.setEndingPointCall( endingPointCall );
- info.setReplyStatus( LOCATION_FORWARD.value );
- info.setForwardRequest( e );
- updateClientRequestDispatcherForward( info );
- }
- catch( SystemException e ) {
-
- // as per PI spec (orbos/99-12-02 sec 5.2.1.), if
- // interception point throws a SystemException,
- // ending point call changes to receive_exception.
- endingPointCall =
- ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION;
- info.setEndingPointCall( endingPointCall );
- info.setReplyStatus( SYSTEM_EXCEPTION.value );
- info.setException( e );
- }
- }
- }
- finally {
- // See doc for setPICurrentPushed as to why this is necessary.
- // Check info for null in case errors happen before initiate.
- if (info != null && info.isPICurrentPushed()) {
- current.popSlotTable( );
- // After the pop, original client's TSC slot table
- // remains avaiable via PICurrent.
- }
- }
- } // end enabled check
- }
-
- /*
- **********************************************************************
- * Server Interceptor invocation
- **********************************************************************/
-
- /**
- * Invokes receive_request_service_context interception points.
- */
- void invokeServerInterceptorStartingPoint( ServerRequestInfoImpl info ) {
- // If invocation is not yet enabled, don't do anything.
- if( enabled ) {
- try {
- // Make a fresh slot table for RSC.
- current.pushSlotTable();
- info.setSlotTable(current.getSlotTable());
-
- // Make a fresh slot table for TSC in case
- // interceptors need to make out calls.
- current.pushSlotTable( );
-
- info.setCurrentExecutionPoint( info.EXECUTION_POINT_STARTING );
-
- // Get all ServerRequestInterceptors:
- ServerRequestInterceptor[] serverInterceptors =
- (ServerRequestInterceptor[])interceptorList.
- getInterceptors( InterceptorList.INTERCEPTOR_TYPE_SERVER );
- int size = serverInterceptors.length;
-
- // We will assume that all interceptors returned successfully,
- // and adjust the flowStackIndex to the appropriate value if
- // we later discover otherwise.
- int flowStackIndex = size;
- boolean continueProcessing = true;
-
- // Currently, there is only one server-side starting point
- // interceptor called receive_request_service_contexts.
- for( int i = 0; continueProcessing && (i < size); i++ ) {
-
- try {
- serverInterceptors[i].
- receive_request_service_contexts( info );
- }
- catch( ForwardRequest e ) {
- // as per PI spec (orbos/99-12-02 sec 5.3.1.), if
- // interception point throws a ForwardRequest,
- // no other Interceptors' starting points are
- // called and send_other is called.
- flowStackIndex = i;
- info.setForwardRequest( e );
- info.setIntermediatePointCall(
- ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE );
- info.setEndingPointCall(
- ServerRequestInfoImpl.CALL_SEND_OTHER );
- info.setReplyStatus( LOCATION_FORWARD.value );
-
- // For some reason, using break here causes the VM on
- // NT to lose track of the value of flowStackIndex
- // after exiting the for loop. I changed this to
- // check a boolean value instead and it seems to work
- // fine.
- continueProcessing = false;
- }
- catch( SystemException e ) {
-
- // as per PI spec (orbos/99-12-02 sec 5.3.1.), if
- // interception point throws a SystemException,
- // no other Interceptors' starting points are
- // called.
- flowStackIndex = i;
- info.setException( e );
- info.setIntermediatePointCall(
- ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE );
- info.setEndingPointCall(
- ServerRequestInfoImpl.CALL_SEND_EXCEPTION );
- info.setReplyStatus( SYSTEM_EXCEPTION.value );
-
- // For some reason, using break here causes the VM on
- // NT to lose track of the value of flowStackIndex
- // after exiting the for loop. I changed this to
- // check a boolean value instead and it seems to
- // work fine.
- continueProcessing = false;
- }
-
- }
-
- // Remember where we left off in the flow stack:
- info.setFlowStackIndex( flowStackIndex );
- }
- finally {
- // The remaining points, ServantManager and Servant
- // all run in the same logical thread.
- current.popSlotTable( );
- // Now TSC and RSC are equivalent.
- }
- } // end enabled check
- }
-
- /**
- * Invokes receive_request interception points
- */
- void invokeServerInterceptorIntermediatePoint(
- ServerRequestInfoImpl info )
- {
- int intermediatePointCall = info.getIntermediatePointCall();
- // If invocation is not yet enabled, don't do anything.
- if( enabled && ( intermediatePointCall !=
- ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE ) )
- {
- // NOTE: do not touch the slotStack. The RSC and TSC are
- // equivalent at this point.
-
- info.setCurrentExecutionPoint( info.EXECUTION_POINT_INTERMEDIATE );
-
- // Get all ServerRequestInterceptors:
- ServerRequestInterceptor[] serverInterceptors =
- (ServerRequestInterceptor[])
- interceptorList.getInterceptors(
- InterceptorList.INTERCEPTOR_TYPE_SERVER );
- int size = serverInterceptors.length;
-
- // Currently, there is only one server-side intermediate point
- // interceptor called receive_request.
- for( int i = 0; i < size; i++ ) {
-
- try {
- serverInterceptors[i].receive_request( info );
- }
- catch( ForwardRequest e ) {
-
- // as per PI spec (orbos/99-12-02 sec 5.3.1.), if
- // interception point throws a ForwardRequest,
- // no other Interceptors' intermediate points are
- // called and send_other is called.
- info.setForwardRequest( e );
- info.setEndingPointCall(
- ServerRequestInfoImpl.CALL_SEND_OTHER );
- info.setReplyStatus( LOCATION_FORWARD.value );
- break;
- }
- catch( SystemException e ) {
-
- // as per PI spec (orbos/99-12-02 sec 5.3.1.), if
- // interception point throws a SystemException,
- // no other Interceptors' starting points are
- // called.
- info.setException( e );
- info.setEndingPointCall(
- ServerRequestInfoImpl.CALL_SEND_EXCEPTION );
- info.setReplyStatus( SYSTEM_EXCEPTION.value );
- break;
- }
- }
- } // end enabled check
- }
-
- /**
- * Invokes either send_reply, send_exception, or send_other,
- * depending on the value of info.getEndingPointCall()
- */
- void invokeServerInterceptorEndingPoint( ServerRequestInfoImpl info ) {
- // If invocation is not yet enabled, don't do anything.
- if( enabled ) {
- try {
- // NOTE: do not touch the slotStack. The RSC and TSC are
- // equivalent at this point.
-
- // REVISIT: This is moved out to PIHandlerImpl until dispatch
- // path is rearchitected. It must be there so that
- // it always gets executed so if an interceptor raises
- // an exception any service contexts added in earlier points
- // this point get put in the exception reply (via the SC Q).
- //info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );
-
- // Get all ServerRequestInterceptors:
- ServerRequestInterceptor[] serverInterceptors =
- (ServerRequestInterceptor[])interceptorList.
- getInterceptors( InterceptorList.INTERCEPTOR_TYPE_SERVER );
- int flowStackIndex = info.getFlowStackIndex();
-
- // Determine whether we are calling
- // send_exception, or send_other:
- int endingPointCall = info.getEndingPointCall();
-
- // Only step through the interceptors whose starting points
- // have successfully returned.
- for( int i = (flowStackIndex - 1); i >= 0; i-- ) {
- try {
- switch( endingPointCall ) {
- case ServerRequestInfoImpl.CALL_SEND_REPLY:
- serverInterceptors[i].send_reply( info );
- break;
- case ServerRequestInfoImpl.CALL_SEND_EXCEPTION:
- serverInterceptors[i].send_exception( info );
- break;
- case ServerRequestInfoImpl.CALL_SEND_OTHER:
- serverInterceptors[i].send_other( info );
- break;
- }
- }
- catch( ForwardRequest e ) {
- // as per PI spec (orbos/99-12-02 sec 5.3.1.), if
- // interception point throws a ForwardException,
- // ending point call changes to receive_other.
- endingPointCall =
- ServerRequestInfoImpl.CALL_SEND_OTHER;
- info.setEndingPointCall( endingPointCall );
- info.setForwardRequest( e );
- info.setReplyStatus( LOCATION_FORWARD.value );
- info.setForwardRequestRaisedInEnding();
- }
- catch( SystemException e ) {
- // as per PI spec (orbos/99-12-02 sec 5.3.1.), if
- // interception point throws a SystemException,
- // ending point call changes to send_exception.
- endingPointCall =
- ServerRequestInfoImpl.CALL_SEND_EXCEPTION;
- info.setEndingPointCall( endingPointCall );
- info.setException( e );
- info.setReplyStatus( SYSTEM_EXCEPTION.value );
- }
- }
-
- // Remember that all interceptors' starting and ending points
- // have already been executed so we need not do anything.
- info.setAlreadyExecuted( true );
- }
- finally {
- // Get rid of the Server side RSC.
- current.popSlotTable();
- }
- } // end enabled check
- }
-
- /*
- **********************************************************************
- * Private utility methods
- **********************************************************************/
-
- /**
- * Update the client delegate in the event of a ForwardRequest, given the
- * information in the passed-in info object.
- */
- private void updateClientRequestDispatcherForward(
- ClientRequestInfoImpl info )
- {
- ForwardRequest forwardRequest = info.getForwardRequestException();
-
- // ForwardRequest may be null if the forwarded IOR is set internal
- // to the ClientRequestDispatcher rather than explicitly through Portable
- // Interceptors. In this case, we need not update the client
- // delegate ForwardRequest object.
- if( forwardRequest != null ) {
- org.omg.CORBA.Object object = forwardRequest.forward;
-
- // Convert the forward object into an IOR:
- IOR ior = ORBUtility.getIOR( object ) ;
- info.setLocatedIOR( ior );
- }
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/InterceptorList.java b/src/share/classes/com/sun/corba/se/impl/interceptors/InterceptorList.java
deleted file mode 100644
index b8e6466..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/InterceptorList.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.PortableInterceptor.Interceptor;
-import org.omg.PortableInterceptor.ORBInitInfo;
-import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
-
-import org.omg.CORBA.INTERNAL;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.lang.reflect.Array;
-
-import com.sun.corba.se.impl.logging.InterceptorsSystemException ;
-
-/**
- * Provides a repository of registered Portable Interceptors, organized
- * by type. This list is designed to be accessed as efficiently as
- * possible during runtime, with the expense of added complexity during
- * initialization and interceptor registration. The class is designed
- * to easily allow for the addition of new interceptor types.
- */
-public class InterceptorList {
-
- // Interceptor type list. If additional interceptors are needed,
- // add additional types in numerical order (do not skip numbers),
- // and update NUM_INTERCEPTOR_TYPES and classTypes accordingly.
- // NUM_INTERCEPTOR_TYPES represents the number of interceptor
- // types, so we know how many lists to maintain.
- static final int INTERCEPTOR_TYPE_CLIENT = 0;
- static final int INTERCEPTOR_TYPE_SERVER = 1;
- static final int INTERCEPTOR_TYPE_IOR = 2;
-
- static final int NUM_INTERCEPTOR_TYPES = 3;
-
- // Array of class types for interceptors. This is used to create the
- // appropriate array type for each interceptor type. These must
- // match the indices of the constants declared above.
- static final Class[] classTypes = {
- org.omg.PortableInterceptor.ClientRequestInterceptor.class,
- org.omg.PortableInterceptor.ServerRequestInterceptor.class,
- org.omg.PortableInterceptor.IORInterceptor.class
- };
-
- // True if no further interceptors may be registered with this list.
- private boolean locked = false;
- private InterceptorsSystemException wrapper ;
-
- // List of interceptors currently registered. There are
- // NUM_INTERCEPTOR_TYPES lists of registered interceptors.
- // For example, interceptors[INTERCEPTOR_TYPE_CLIENT] contains an array
- // of objects of type ClientRequestInterceptor.
- private Interceptor[][] interceptors =
- new Interceptor[NUM_INTERCEPTOR_TYPES][];
-
- /**
- * Creates a new Interceptor List. Constructor is package scope so
- * only the ORB can create it.
- */
- InterceptorList( InterceptorsSystemException wrapper ) {
- this.wrapper = wrapper ;
- // Create empty interceptors arrays for each type:
- initInterceptorArrays();
- }
-
- /**
- * Registers an interceptor of the given type into the interceptor list.
- * The type is one of:
- * <ul>
- * <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
- * <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
- * <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
- * </ul>
- *
- * @exception DuplicateName Thrown if an interceptor of the given
- * name already exists for the given type.
- */
- void register_interceptor( Interceptor interceptor, int type )
- throws DuplicateName
- {
- // If locked, deny any further addition of interceptors.
- if( locked ) {
- throw wrapper.interceptorListLocked() ;
- }
-
- // Cache interceptor name:
- String interceptorName = interceptor.name();
- boolean anonymous = interceptorName.equals( "" );
- boolean foundDuplicate = false;
- Interceptor[] interceptorList = interceptors[type];
-
- // If this is not an anonymous interceptor,
- // search for an interceptor of the same name in this category:
- if( !anonymous ) {
- int size = interceptorList.length;
-
- // An O(n) search will suffice because register_interceptor is not
- // likely to be called often.
- for( int i = 0; i < size; i++ ) {
- Interceptor in = (Interceptor)interceptorList[i];
- if( in.name().equals( interceptorName ) ) {
- foundDuplicate = true;
- break;
- }
- }
- }
-
- if( !foundDuplicate ) {
- growInterceptorArray( type );
- interceptors[type][interceptors[type].length-1] = interceptor;
- }
- else {
- throw new DuplicateName( interceptorName );
- }
- }
-
- /**
- * Locks this interceptor list so that no more interceptors may be
- * registered. This method is called after all interceptors are
- * registered for security reasons.
- */
- void lock() {
- locked = true;
- }
-
- /**
- * Retrieves an array of interceptors of the given type. For efficiency,
- * the type parameter is assumed to be valid.
- */
- Interceptor[] getInterceptors( int type ) {
- return interceptors[type];
- }
-
- /**
- * Returns true if there is at least one interceptor of the given type,
- * or false if not.
- */
- boolean hasInterceptorsOfType( int type ) {
- return interceptors[type].length > 0;
- }
-
- /**
- * Initializes all interceptors arrays to zero-length arrays of the
- * correct type, based on the classTypes list.
- */
- private void initInterceptorArrays() {
- for( int type = 0; type < NUM_INTERCEPTOR_TYPES; type++ ) {
- Class classType = classTypes[type];
-
- // Create a zero-length array for each type:
- interceptors[type] =
- (Interceptor[])Array.newInstance( classType, 0 );
- }
- }
-
- /**
- * Grows the given interceptor array by one:
- */
- private void growInterceptorArray( int type ) {
- Class classType = classTypes[type];
- int currentLength = interceptors[type].length;
- Interceptor[] replacementArray;
-
- // Create new array to replace the old one. The new array will be
- // one element larger but have the same type as the old one.
- replacementArray = (Interceptor[])
- Array.newInstance( classType, currentLength + 1 );
- System.arraycopy( interceptors[type], 0,
- replacementArray, 0, currentLength );
- interceptors[type] = replacementArray;
- }
-
- /**
- * Destroys all interceptors in this list by invoking their destroy()
- * method.
- */
- void destroyAll() {
- int numTypes = interceptors.length;
-
- for( int i = 0; i < numTypes; i++ ) {
- int numInterceptors = interceptors[i].length;
- for( int j = 0; j < numInterceptors; j++ ) {
- interceptors[i][j].destroy();
- }
- }
- }
-
- /**
- * Sort interceptors.
- */
- void sortInterceptors() {
- List sorted = null;
- List unsorted = null;
-
- int numTypes = interceptors.length;
-
- for( int i = 0; i < numTypes; i++ ) {
- int numInterceptors = interceptors[i].length;
- if (numInterceptors > 0) {
- // Get fresh sorting bins for each non empty type.
- sorted = new ArrayList(); // not synchronized like we want.
- unsorted = new ArrayList();
- }
- for( int j = 0; j < numInterceptors; j++ ) {
- Interceptor interceptor = interceptors[i][j];
- if (interceptor instanceof Comparable) {
- sorted.add(interceptor);
- } else {
- unsorted.add(interceptor);
- }
- }
- if (numInterceptors > 0 && sorted.size() > 0) {
- // Let the RuntimeExceptions thrown by sort
- // (i.e., ClassCastException and UnsupportedOperationException)
- // flow back to the user.
- Collections.sort(sorted);
- Iterator sortedIterator = sorted.iterator();
- Iterator unsortedIterator = unsorted.iterator();
- for( int j = 0; j < numInterceptors; j++ ) {
- if (sortedIterator.hasNext()) {
- interceptors[i][j] =
- (Interceptor) sortedIterator.next();
- } else if (unsortedIterator.hasNext()) {
- interceptors[i][j] =
- (Interceptor) unsortedIterator.next();
- } else {
- throw wrapper.sortSizeMismatch() ;
- }
- }
- }
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/ORBInitInfoImpl.java b/src/share/classes/com/sun/corba/se/impl/interceptors/ORBInitInfoImpl.java
deleted file mode 100644
index f8ac397..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/ORBInitInfoImpl.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.OBJECT_NOT_EXIST;
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.PolicyError;
-import org.omg.IOP.CodecFactory;
-import org.omg.PortableInterceptor.ORBInitInfo;
-import org.omg.PortableInterceptor.ClientRequestInterceptor;
-import org.omg.PortableInterceptor.IORInterceptor;
-import org.omg.PortableInterceptor.PolicyFactory;
-import org.omg.PortableInterceptor.ServerRequestInterceptor;
-import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
-import org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.legacy.interceptor.ORBInitInfoExt ;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-
-import com.sun.corba.se.impl.logging.InterceptorsSystemException;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-
-/**
- * ORBInitInfoImpl is the implementation of the ORBInitInfo class to be
- * passed to ORBInitializers, as described in orbos/99-12-02.
- */
-public final class ORBInitInfoImpl
- extends org.omg.CORBA.LocalObject
- implements ORBInitInfo, ORBInitInfoExt
-{
- // The ORB we are initializing
- private ORB orb;
-
- private InterceptorsSystemException wrapper ;
- private ORBUtilSystemException orbutilWrapper ;
- private OMGSystemException omgWrapper ;
-
- // The arguments passed to ORB_init
- private String[] args;
-
- // The ID of the ORB being initialized
- private String orbId;
-
- // The CodecFactory
- private CodecFactory codecFactory;
-
- // The current stage of initialization
- private int stage = STAGE_PRE_INIT;
-
- // The pre-initialization stage (pre_init() being called)
- public static final int STAGE_PRE_INIT = 0;
-
- // The post-initialization stage (post_init() being called)
- public static final int STAGE_POST_INIT = 1;
-
- // Reject all calls - this object should no longer be around.
- public static final int STAGE_CLOSED = 2;
-
- // The description for the OBJECT_NOT_EXIST exception in STAGE_CLOSED
- private static final String MESSAGE_ORBINITINFO_INVALID =
- "ORBInitInfo object is only valid during ORB_init";
-
- /**
- * Creates a new ORBInitInfoImpl object (scoped to package)
- *
- * @param args The arguments passed to ORB_init.
- */
- ORBInitInfoImpl( ORB orb, String[] args,
- String orbId, CodecFactory codecFactory )
- {
- this.orb = orb;
-
- wrapper = InterceptorsSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- orbutilWrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- omgWrapper = OMGSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
-
- this.args = args;
- this.orbId = orbId;
- this.codecFactory = codecFactory;
- }
-
- /** Return the ORB behind this ORBInitInfo. This is defined in the
- * ORBInitInfoExt interface.
- */
- public ORB getORB()
- {
- return orb ;
- }
-
- /**
- * Sets the current stage we are in. This limits access to certain
- * functionality.
- */
- void setStage( int stage ) {
- this.stage = stage;
- }
-
- /**
- * Throws an exception if the current stage is STAGE_CLOSED.
- * This is called before any method is invoked to ensure that
- * no method invocations are attempted after all calls to post_init()
- * are completed.
- */
- private void checkStage() {
- if( stage == STAGE_CLOSED ) {
- throw wrapper.orbinitinfoInvalid() ;
- }
- }
-
- /*
- *******************************************************************
- * The following are implementations of the ORBInitInfo operations.
- *******************************************************************/
-
- /**
- * This attribute contains the arguments passed to ORB_init. They may
- * or may not contain the ORB's arguments
- */
- public String[] arguments () {
- checkStage();
- return args;
- }
-
- /**
- * This attribute is the ID of the ORB being initialized
- */
- public String orb_id () {
- checkStage();
- return orbId;
- }
-
- /**
- * This attribute is the IOP::CodecFactory. The CodecFactory is normally
- * obtained via a call to ORB::resolve_initial_references( "CodecFactory" )
- * but since the ORB is not yet available and Interceptors, particularly
- * when processing service contexts, will require a Codec, a means of
- * obtaining a Codec is necessary during ORB intialization.
- */
- public CodecFactory codec_factory () {
- checkStage();
- return codecFactory;
- }
-
- /**
- * See orbos/99-12-02, Chapter 11, Dynamic Initial References on page
- * 11-81. This operation is identical to ORB::register_initial_reference
- * described there. This same functionality exists here because the ORB,
- * not yet fully initialized, is not yet available but initial references
- * may need to be registered as part of Interceptor registration.
- * <p>
- * This method may not be called during post_init.
- */
- public void register_initial_reference( String id,
- org.omg.CORBA.Object obj )
- throws InvalidName
- {
- checkStage();
- if( id == null ) nullParam();
-
- // As per CORBA 3.0 section 21.8.1,
- // if null is passed as the obj parameter,
- // throw BAD_PARAM with minor code OMGSystemException.RIR_WITH_NULL_OBJECT.
- // Though the spec is talking about IDL null, we will address both
- // Java null and IDL null:
- // Note: Local Objects can never be nil!
- if( obj == null ) {
- throw omgWrapper.rirWithNullObject() ;
- }
-
- // This check was made to determine that the objref is a
- // non-local objref that is fully
- // initialized: this was called only for its side-effects of
- // possibly throwing exceptions. However, registering
- // local objects should be permitted!
- // XXX/Revisit?
- // IOR ior = ORBUtility.getIOR( obj ) ;
-
- // Delegate to ORB. If ORB version throws InvalidName, convert to
- // equivalent Portable Interceptors InvalidName.
- try {
- orb.register_initial_reference( id, obj );
- } catch( org.omg.CORBA.ORBPackage.InvalidName e ) {
- InvalidName exc = new InvalidName( e.getMessage() );
- exc.initCause( e ) ;
- throw exc ;
- }
- }
-
- /**
- * This operation is only valid during post_init. It is identical to
- * ORB::resolve_initial_references. This same functionality exists here
- * because the ORB, not yet fully initialized, is not yet available,
- * but initial references may be required from the ORB as part
- * of Interceptor registration.
- * <p>
- * (incorporates changes from errata in orbos/00-01-01)
- * <p>
- * This method may not be called during pre_init.
- */
- public org.omg.CORBA.Object resolve_initial_references (String id)
- throws InvalidName
- {
- checkStage();
- if( id == null ) nullParam();
-
- if( stage == STAGE_PRE_INIT ) {
- // Initializer is not allowed to invoke this method during
- // this stage.
-
- // _REVISIT_ Spec issue: What exception should really be
- // thrown here?
- throw wrapper.rirInvalidPreInit() ;
- }
-
- org.omg.CORBA.Object objRef = null;
-
- try {
- objRef = orb.resolve_initial_references( id );
- }
- catch( org.omg.CORBA.ORBPackage.InvalidName e ) {
- // Convert PIDL to IDL exception:
- throw new InvalidName();
- }
-
- return objRef;
- }
-
- // New method from CORBA 3.1
- public void add_client_request_interceptor_with_policy (
- ClientRequestInterceptor interceptor, Policy[] policies )
- throws DuplicateName
- {
- // XXX ignore policies for now
- add_client_request_interceptor( interceptor ) ;
- }
-
- /**
- * This operation is used to add a client-side request Interceptor to
- * the list of client-side request Interceptors.
- * <p>
- * If a client-side request Interceptor has already been registered
- * with this Interceptor's name, DuplicateName is raised.
- */
- public void add_client_request_interceptor (
- ClientRequestInterceptor interceptor)
- throws DuplicateName
- {
- checkStage();
- if( interceptor == null ) nullParam();
-
- orb.getPIHandler().register_interceptor( interceptor,
- InterceptorList.INTERCEPTOR_TYPE_CLIENT );
- }
-
- // New method from CORBA 3.1
- public void add_server_request_interceptor_with_policy (
- ServerRequestInterceptor interceptor, Policy[] policies )
- throws DuplicateName, PolicyError
- {
- // XXX ignore policies for now
- add_server_request_interceptor( interceptor ) ;
- }
-
- /**
- * This operation is used to add a server-side request Interceptor to
- * the list of server-side request Interceptors.
- * <p>
- * If a server-side request Interceptor has already been registered
- * with this Interceptor's name, DuplicateName is raised.
- */
- public void add_server_request_interceptor (
- ServerRequestInterceptor interceptor)
- throws DuplicateName
- {
- checkStage();
- if( interceptor == null ) nullParam();
-
- orb.getPIHandler().register_interceptor( interceptor,
- InterceptorList.INTERCEPTOR_TYPE_SERVER );
- }
-
- // New method from CORBA 3.1
- public void add_ior_interceptor_with_policy (
- IORInterceptor interceptor, Policy[] policies )
- throws DuplicateName, PolicyError
- {
- // XXX ignore policies for now
- add_ior_interceptor( interceptor ) ;
- }
-
- /**
- * This operation is used to add an IOR Interceptor to
- * the list of IOR Interceptors.
- * <p>
- * If an IOR Interceptor has already been registered
- * with this Interceptor's name, DuplicateName is raised.
- */
- public void add_ior_interceptor (
- IORInterceptor interceptor )
- throws DuplicateName
- {
- checkStage();
- if( interceptor == null ) nullParam();
-
- orb.getPIHandler().register_interceptor( interceptor,
- InterceptorList.INTERCEPTOR_TYPE_IOR );
- }
-
- /**
- * A service calls allocate_slot_id to allocate a slot on
- * PortableInterceptor::Current.
- *
- * @return The index to the slot which has been allocated.
- */
- public int allocate_slot_id () {
- checkStage();
-
- return ((PICurrent)orb.getPIHandler().getPICurrent()).allocateSlotId( );
-
- }
-
- /**
- * Register a PolicyFactory for the given PolicyType.
- * <p>
- * If a PolicyFactory already exists for the given PolicyType,
- * BAD_INV_ORDER is raised with a minor code of TBD_BIO+2.
- */
- public void register_policy_factory( int type,
- PolicyFactory policy_factory )
- {
- checkStage();
- if( policy_factory == null ) nullParam();
- orb.getPIHandler().registerPolicyFactory( type, policy_factory );
- }
-
-
- /**
- * Called when an invalid null parameter was passed. Throws a
- * BAD_PARAM with a minor code of 1
- */
- private void nullParam()
- throws BAD_PARAM
- {
- throw orbutilWrapper.nullParam() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/PICurrent.java b/src/share/classes/com/sun/corba/se/impl/interceptors/PICurrent.java
deleted file mode 100644
index 5502be3..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/PICurrent.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import com.sun.corba.se.spi.orb.ORB;
-import org.omg.PortableInterceptor.Current;
-import org.omg.PortableInterceptor.InvalidSlot;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.OMGSystemException ;
-
-/**
- * PICurrent is the implementation of Current as specified in the Portable
- * Interceptors Spec orbos/99-12-02.
- * IMPORTANT: PICurrent is implemented with the assumption that get_slot()
- * or set_slot() will not be called in ORBInitializer.pre_init() and
- * post_init().
- */
-public class PICurrent extends org.omg.CORBA.LocalObject
- implements Current
-{
- // slotCounter is used to keep track of ORBInitInfo.allocate_slot_id()
- private int slotCounter;
-
- // The ORB associated with this PICurrent object.
- private ORB myORB;
-
- private OMGSystemException wrapper ;
-
- // True if the orb is still initialzing and get_slot and set_slot are not
- // to be called.
- private boolean orbInitializing;
-
- // ThreadLocal contains a stack of SlotTable which are used
- // for resolve_initial_references( "PICurrent" );
- private ThreadLocal threadLocalSlotTable
- = new ThreadLocal( ) {
- protected Object initialValue( ) {
- SlotTable table = new SlotTable( myORB, slotCounter );
- return new SlotTableStack( myORB, table );
- }
- };
-
- /**
- * PICurrent constructor which will be called for every ORB
- * initialization.
- */
- PICurrent( ORB myORB ) {
- this.myORB = myORB;
- wrapper = OMGSystemException.get( myORB,
- CORBALogDomains.RPC_PROTOCOL ) ;
- this.orbInitializing = true;
- slotCounter = 0;
- }
-
-
- /**
- * This method will be called from ORBInitInfo.allocate_slot_id( ).
- * simply returns a slot id by incrementing slotCounter.
- */
- int allocateSlotId( ) {
- int slotId = slotCounter;
- slotCounter = slotCounter + 1;
- return slotId;
- }
-
-
- /**
- * This method gets the SlotTable which is on the top of the
- * ThreadLocalStack.
- */
- SlotTable getSlotTable( ) {
- SlotTable table = (SlotTable)
- ((SlotTableStack)threadLocalSlotTable.get()).peekSlotTable();
- return table;
- }
-
- /**
- * This method pushes a SlotTable on the SlotTableStack. When there is
- * a resolve_initial_references("PICurrent") after this call. The new
- * PICurrent will be returned.
- */
- void pushSlotTable( ) {
- SlotTableStack st = (SlotTableStack)threadLocalSlotTable.get();
- st.pushSlotTable( );
- }
-
-
- /**
- * This method pops a SlotTable on the SlotTableStack.
- */
- void popSlotTable( ) {
- SlotTableStack st = (SlotTableStack)threadLocalSlotTable.get();
- st.popSlotTable( );
- }
-
- /**
- * This method sets the slot data at the given slot id (index) in the
- * Slot Table which is on the top of the SlotTableStack.
- */
- public void set_slot( int id, Any data ) throws InvalidSlot
- {
- if( orbInitializing ) {
- // As per ptc/00-08-06 if the ORB is still initializing, disallow
- // calls to get_slot and set_slot. If an attempt is made to call,
- // throw a BAD_INV_ORDER.
- throw wrapper.invalidPiCall3() ;
- }
-
- getSlotTable().set_slot( id, data );
- }
-
- /**
- * This method gets the slot data at the given slot id (index) from the
- * Slot Table which is on the top of the SlotTableStack.
- */
- public Any get_slot( int id ) throws InvalidSlot
- {
- if( orbInitializing ) {
- // As per ptc/00-08-06 if the ORB is still initializing, disallow
- // calls to get_slot and set_slot. If an attempt is made to call,
- // throw a BAD_INV_ORDER.
- throw wrapper.invalidPiCall4() ;
- }
-
- return getSlotTable().get_slot( id );
- }
-
- /**
- * This method resets all the slot data to null in the
- * Slot Table which is on the top of SlotTableStack.
- */
- void resetSlotTable( ) {
- getSlotTable().resetSlots();
- }
-
- /**
- * Called from ORB when the ORBInitializers are about to start
- * initializing.
- */
- void setORBInitializing( boolean init ) {
- this.orbInitializing = init;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java b/src/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java
deleted file mode 100644
index 9ad417e..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java
+++ /dev/null
@@ -1,992 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-package com.sun.corba.se.impl.interceptors;
-
-import java.util.*;
-import java.io.IOException;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.BAD_POLICY;
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.COMM_FAILURE;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.OBJECT_NOT_EXIST;
-import org.omg.CORBA.ORBPackage.InvalidName;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.UNKNOWN;
-
-import org.omg.CORBA.portable.ApplicationException;
-import org.omg.CORBA.portable.RemarshalException;
-
-import org.omg.IOP.CodecFactory;
-
-import org.omg.PortableInterceptor.ForwardRequest;
-import org.omg.PortableInterceptor.Current;
-import org.omg.PortableInterceptor.Interceptor;
-import org.omg.PortableInterceptor.LOCATION_FORWARD;
-import org.omg.PortableInterceptor.ORBInitializer;
-import org.omg.PortableInterceptor.ORBInitInfo;
-import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
-import org.omg.PortableInterceptor.SUCCESSFUL;
-import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
-import org.omg.PortableInterceptor.TRANSPORT_RETRY;
-import org.omg.PortableInterceptor.USER_EXCEPTION;
-import org.omg.PortableInterceptor.PolicyFactory;
-import org.omg.PortableInterceptor.ObjectReferenceTemplate;
-
-import com.sun.corba.se.pept.encoding.OutputObject;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
-import com.sun.corba.se.spi.oa.ObjectAdapter;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orbutil.closure.ClosureFactory;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-import com.sun.corba.se.spi.protocol.ForwardException;
-import com.sun.corba.se.spi.protocol.PIHandler;
-import com.sun.corba.se.spi.protocol.RetryType;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.logging.InterceptorsSystemException;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-import com.sun.corba.se.impl.corba.RequestImpl;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.orbutil.StackImpl;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
-
-/**
- * Provides portable interceptor functionality.
- */
-public class PIHandlerImpl implements PIHandler
-{
- // REVISIT - delete these after framework merging.
- boolean printPushPopEnabled = false;
- int pushLevel = 0;
- private void printPush()
- {
- if (! printPushPopEnabled) return;
- printSpaces(pushLevel);
- pushLevel++;
- System.out.println("PUSH");
- }
- private void printPop()
- {
- if (! printPushPopEnabled) return;
- pushLevel--;
- printSpaces(pushLevel);
- System.out.println("POP");
- }
- private void printSpaces(int n)
- {
- for (int i = 0; i < n; i++) {
- System.out.print(" ");
- }
- }
-
- private ORB orb;
- InterceptorsSystemException wrapper;
- ORBUtilSystemException orbutilWrapper;
- OMGSystemException omgWrapper;
-
- // A unique id used in ServerRequestInfo.
- // This does not correspond to the GIOP request id.
- private int serverRequestIdCounter = 0;
-
- // Stores the codec factory for producing codecs
- CodecFactory codecFactory = null;
-
- // The arguments passed to the application's main method. May be null.
- // This is used for ORBInitializers and set from set_parameters.
- String[] arguments = null;
-
- // The list of portable interceptors, organized by type:
- private InterceptorList interceptorList;
-
- // Cached information for optimization - do we have any interceptors
- // registered of the given types? Set during ORB initialization.
- private boolean hasIORInterceptors;
- private boolean hasClientInterceptors; // temp always true
- private boolean hasServerInterceptors;
-
- // The class responsible for invoking interceptors
- private InterceptorInvoker interceptorInvoker;
-
- // There will be one PICurrent instantiated for every ORB.
- private PICurrent current;
-
- // This table contains a list of PolicyFactories registered using
- // ORBInitInfo.registerPolicyFactory() method.
- // Key for the table is PolicyType which is an Integer
- // Value is PolicyFactory.
- private HashMap policyFactoryTable;
-
- // Table to convert from a ReplyMessage.? to a PI replyStatus short.
- // Note that this table relies on the order and constants of
- // ReplyMessage not to change.
- private final static short REPLY_MESSAGE_TO_PI_REPLY_STATUS[] = {
- SUCCESSFUL.value, // = ReplyMessage.NO_EXCEPTION
- USER_EXCEPTION.value, // = ReplyMessage.USER_EXCEPTION
- SYSTEM_EXCEPTION.value, // = ReplyMessage.SYSTEM_EXCEPTION
- LOCATION_FORWARD.value, // = ReplyMessage.LOCATION_FORWARD
- LOCATION_FORWARD.value, // = ReplyMessage.LOCATION_FORWARD_PERM
- TRANSPORT_RETRY.value // = ReplyMessage.NEEDS_ADDRESSING_MODE
- };
-
- // ThreadLocal containing a stack to store client request info objects
- // and a disable count.
- private ThreadLocal threadLocalClientRequestInfoStack =
- new ThreadLocal() {
- protected Object initialValue() {
- return new RequestInfoStack();
- }
- };
-
- // ThreadLocal containing the current server request info object.
- private ThreadLocal threadLocalServerRequestInfoStack =
- new ThreadLocal() {
- protected Object initialValue() {
- return new RequestInfoStack();
- }
- };
-
- public void close() {
- orb = null;
- wrapper = null;
- orbutilWrapper = null;
- omgWrapper = null;
- codecFactory = null;
- arguments = null;
- interceptorList = null;
- interceptorInvoker = null;
- current = null;
- policyFactoryTable = null;
- threadLocalClientRequestInfoStack = null;
- threadLocalServerRequestInfoStack = null;
- }
-
- // Class to contain all ThreadLocal data for ClientRequestInfo
- // maintenance.
- //
- // We use an ArrayList instead since it is not thread-safe.
- // RequestInfoStack is used quite frequently.
- private final class RequestInfoStack extends Stack {
- // Number of times a request has been made to disable interceptors.
- // When this reaches 0, interception hooks are disabled. Any higher
- // value indicates they are enabled.
- // NOTE: The is only currently used on the client side.
- public int disableCount = 0;
- }
-
- public PIHandlerImpl( ORB orb, String[] args ) {
- this.orb = orb ;
- wrapper = InterceptorsSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- orbutilWrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- omgWrapper = OMGSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- arguments = args ;
-
- // Create codec factory:
- codecFactory = new CodecFactoryImpl( orb );
-
- // Create new interceptor list:
- interceptorList = new InterceptorList( wrapper );
-
- // Create a new PICurrent.
- current = new PICurrent( orb );
-
- // Create new interceptor invoker, initially disabled:
- interceptorInvoker = new InterceptorInvoker( orb, interceptorList,
- current );
-
- // Register the PI current and Codec factory objects
- orb.getLocalResolver().register( ORBConstants.PI_CURRENT_NAME,
- ClosureFactory.makeConstant( current ) ) ;
- orb.getLocalResolver().register( ORBConstants.CODEC_FACTORY_NAME,
- ClosureFactory.makeConstant( codecFactory ) ) ;
- }
-
- public void initialize() {
- // If we have any orb initializers, make use of them:
- if( orb.getORBData().getORBInitializers() != null ) {
- // Create the ORBInitInfo object to pass to ORB intializers:
- ORBInitInfoImpl orbInitInfo = createORBInitInfo();
-
- // Make sure get_slot and set_slot are not called from within
- // ORB initializers:
- current.setORBInitializing( true );
-
- // Call pre_init on all ORB initializers:
- preInitORBInitializers( orbInitInfo );
-
- // Call post_init on all ORB initializers:
- postInitORBInitializers( orbInitInfo );
-
- // Proprietary: sort interceptors:
- interceptorList.sortInterceptors();
-
- // Re-enable get_slot and set_slot to be called from within
- // ORB initializers:
- current.setORBInitializing( false );
-
- // Ensure nobody makes any more calls on this object.
- orbInitInfo.setStage( ORBInitInfoImpl.STAGE_CLOSED );
-
- // Set cached flags indicating whether we have interceptors
- // registered of a given type.
- hasIORInterceptors = interceptorList.hasInterceptorsOfType(
- InterceptorList.INTERCEPTOR_TYPE_IOR );
- // XXX This must always be true, so that using the new generic
- // RPC framework can pass info between the PI stack and the
- // framework invocation stack. Temporary until Harold fixes
- // this. Note that this must never be true until after the
- // ORBInitializer instances complete executing.
- //hasClientInterceptors = interceptorList.hasInterceptorsOfType(
- //InterceptorList.INTERCEPTOR_TYPE_CLIENT );
- hasClientInterceptors = true;
- hasServerInterceptors = interceptorList.hasInterceptorsOfType(
- InterceptorList.INTERCEPTOR_TYPE_SERVER );
-
- // Enable interceptor invoker (not necessary if no interceptors
- // are registered). This should be the last stage of ORB
- // initialization.
- interceptorInvoker.setEnabled( true );
- }
- }
-
- /**
- * ptc/00-08-06 p 205: "When an application calls ORB::destroy, the ORB
- * 1) waits for all requests in progress to complete
- * 2) calls the Interceptor::destroy operation for each interceptor
- * 3) completes destruction of the ORB"
- *
- * This must be called at the end of ORB.destroy. Note that this is not
- * part of the PIHandler interface, since ORBImpl implements the ORB interface.
- */
- public void destroyInterceptors() {
- interceptorList.destroyAll();
- }
-
- public void objectAdapterCreated( ObjectAdapter oa )
- {
- if (!hasIORInterceptors)
- return ;
-
- interceptorInvoker.objectAdapterCreated( oa ) ;
- }
-
- public void adapterManagerStateChanged( int managerId,
- short newState )
- {
- if (!hasIORInterceptors)
- return ;
-
- interceptorInvoker.adapterManagerStateChanged( managerId, newState ) ;
- }
-
- public void adapterStateChanged( ObjectReferenceTemplate[]
- templates, short newState )
- {
- if (!hasIORInterceptors)
- return ;
-
- interceptorInvoker.adapterStateChanged( templates, newState ) ;
- }
-
- /*
- *****************
- * Client PI hooks
- *****************/
-
- public void disableInterceptorsThisThread() {
- if( !hasClientInterceptors ) return;
-
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalClientRequestInfoStack.get();
- infoStack.disableCount++;
- }
-
- public void enableInterceptorsThisThread() {
- if( !hasClientInterceptors ) return;
-
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalClientRequestInfoStack.get();
- infoStack.disableCount--;
- }
-
- public void invokeClientPIStartingPoint()
- throws RemarshalException
- {
- if( !hasClientInterceptors ) return;
- if( !isClientPIEnabledForThisThread() ) return;
-
- // Invoke the starting interception points and record exception
- // and reply status info in the info object:
- ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
- interceptorInvoker.invokeClientInterceptorStartingPoint( info );
-
- // Check reply status. If we will not have another chance later
- // to invoke the client ending points, do it now.
- short replyStatus = info.getReplyStatus();
- if( (replyStatus == SYSTEM_EXCEPTION.value) ||
- (replyStatus == LOCATION_FORWARD.value) )
- {
- // Note: Transport retry cannot happen here since this happens
- // before the request hits the wire.
-
- Exception exception = invokeClientPIEndingPoint(
- convertPIReplyStatusToReplyMessage( replyStatus ),
- info.getException() );
- if( exception == null ) {
- // Do not throw anything. Otherwise, it must be a
- // SystemException, UserException or RemarshalException.
- } if( exception instanceof SystemException ) {
- throw (SystemException)exception;
- } else if( exception instanceof RemarshalException ) {
- throw (RemarshalException)exception;
- } else if( (exception instanceof UserException) ||
- (exception instanceof ApplicationException) ) {
- // It should not be possible for an interceptor to throw
- // a UserException. By asserting instead of throwing the
- // UserException, we need not declare anything but
- // RemarshalException in the throws clause.
- throw wrapper.exceptionInvalid() ;
- }
- }
- else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
- throw wrapper.replyStatusNotInit() ;
- }
- }
-
- // Needed when an error forces a retry AFTER initiateClientPIRequest
- // but BEFORE invokeClientPIStartingPoint.
- public Exception makeCompletedClientRequest( int replyStatus,
- Exception exception ) {
-
- // 6763340
- return handleClientPIEndingPoint( replyStatus, exception, false ) ;
- }
-
- public Exception invokeClientPIEndingPoint( int replyStatus,
- Exception exception ) {
-
- // 6763340
- return handleClientPIEndingPoint( replyStatus, exception, true ) ;
- }
-
- public Exception handleClientPIEndingPoint(
- int replyStatus, Exception exception, boolean invokeEndingPoint ) {
- if( !hasClientInterceptors ) return exception;
- if( !isClientPIEnabledForThisThread() ) return exception;
-
- // Translate ReplyMessage.replyStatus into PI replyStatus:
- // Note: this is also an assertion to make sure a valid replyStatus
- // is passed in (IndexOutOfBoundsException will be thrown otherwise)
- short piReplyStatus = REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];
-
- // Invoke the ending interception points and record exception
- // and reply status info in the info object:
- ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
- info.setReplyStatus( piReplyStatus );
- info.setException( exception );
-
- if (invokeEndingPoint) {
- // 6763340
- interceptorInvoker.invokeClientInterceptorEndingPoint( info );
- piReplyStatus = info.getReplyStatus();
- }
-
- // Check reply status:
- if( (piReplyStatus == LOCATION_FORWARD.value) ||
- (piReplyStatus == TRANSPORT_RETRY.value) ) {
- // If this is a forward or a retry, reset and reuse
- // info object:
- info.reset();
-
- // fix for 6763340:
- if (invokeEndingPoint) {
- info.setRetryRequest( RetryType.AFTER_RESPONSE ) ;
- } else {
- info.setRetryRequest( RetryType.BEFORE_RESPONSE ) ;
- }
-
- // ... and return a RemarshalException so the orb internals know
- exception = new RemarshalException();
- } else if( (piReplyStatus == SYSTEM_EXCEPTION.value) ||
- (piReplyStatus == USER_EXCEPTION.value) ) {
- exception = info.getException();
- }
-
- return exception;
- }
-
- public void initiateClientPIRequest( boolean diiRequest ) {
- if( !hasClientInterceptors ) return;
- if( !isClientPIEnabledForThisThread() ) return;
-
- // Get the most recent info object from the thread local
- // ClientRequestInfoImpl stack:
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalClientRequestInfoStack.get();
- ClientRequestInfoImpl info = null;
-
- if (!infoStack.empty() ) {
- info = (ClientRequestInfoImpl)infoStack.peek();
- }
-
- if (!diiRequest && (info != null) && info.isDIIInitiate() ) {
- // In RequestImpl.doInvocation we already called
- // initiateClientPIRequest( true ), so ignore this initiate.
- info.setDIIInitiate( false );
- } else {
- // If there is no info object or if we are not retrying a request,
- // push a new ClientRequestInfoImpl on the stack:
-
- // 6763340: don't push unless this is not a retry
- if( (info == null) || !info.getRetryRequest().isRetry() ) {
- info = new ClientRequestInfoImpl( orb );
- infoStack.push( info );
- printPush();
- // Note: the entry count is automatically initialized to 0.
- }
-
- // Reset the retry request flag so that recursive calls will
- // push a new info object, and bump up entry count so we know
- // when to pop this info object:
- info.setRetryRequest( RetryType.NONE );
- info.incrementEntryCount();
-
- // KMC 6763340: I don't know why this wasn't set earlier,
- // but we do not want a retry to pick up the previous
- // reply status, so clear it here. Most likely a new
- // info was pushed before, so that this was not a problem.
- info.setReplyStatus( RequestInfoImpl.UNINITIALIZED ) ;
-
- // If this is a DII request, make sure we ignore the next initiate.
- if( diiRequest ) {
- info.setDIIInitiate( true );
- }
- }
- }
-
- public void cleanupClientPIRequest() {
- if( !hasClientInterceptors ) return;
- if( !isClientPIEnabledForThisThread() ) return;
-
- ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
- RetryType rt = info.getRetryRequest() ;
-
- // fix for 6763340
- if (!rt.equals( RetryType.BEFORE_RESPONSE )) {
-
- // If the replyStatus has not yet been set, this is an indication
- // that the ORB threw an exception before we had a chance to
- // invoke the client interceptor ending points.
- //
- // _REVISIT_ We cannot handle any exceptions or ForwardRequests
- // flagged by the ending points here because there is no way
- // to gracefully handle this in any of the calling code.
- // This is a rare corner case, so we will ignore this for now.
- short replyStatus = info.getReplyStatus();
- if (replyStatus == info.UNINITIALIZED ) {
- invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION,
- wrapper.unknownRequestInvoke(
- CompletionStatus.COMPLETED_MAYBE ) ) ;
- }
- }
-
- // Decrement entry count, and if it is zero, pop it from the stack.
- info.decrementEntryCount();
-
- // fix for 6763340, and probably other cases (non-recursive retry)
- if (info.getEntryCount() == 0 && !info.getRetryRequest().isRetry()) {
- // RequestInfoStack<ClientRequestInfoImpl> infoStack =
- // threadLocalClientRequestInfoStack.get();
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalClientRequestInfoStack.get();
- infoStack.pop();
- printPop();
- }
- }
-
- public void setClientPIInfo(CorbaMessageMediator messageMediator)
- {
- if( !hasClientInterceptors ) return;
- if( !isClientPIEnabledForThisThread() ) return;
-
- peekClientRequestInfoImplStack().setInfo(messageMediator);
- }
-
- public void setClientPIInfo( RequestImpl requestImpl ) {
- if( !hasClientInterceptors ) return;
- if( !isClientPIEnabledForThisThread() ) return;
-
- peekClientRequestInfoImplStack().setDIIRequest( requestImpl );
- }
-
- /*
- *****************
- * Server PI hooks
- *****************/
-
- public void invokeServerPIStartingPoint()
- {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- interceptorInvoker.invokeServerInterceptorStartingPoint( info );
-
- // Handle SystemException or ForwardRequest:
- serverPIHandleExceptions( info );
- }
-
- public void invokeServerPIIntermediatePoint()
- {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- interceptorInvoker.invokeServerInterceptorIntermediatePoint( info );
-
- // Clear servant from info object so that the user has control over
- // its lifetime:
- info.releaseServant();
-
- // Handle SystemException or ForwardRequest:
- serverPIHandleExceptions( info );
- }
-
- public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
- {
- if( !hasServerInterceptors ) return;
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
-
- // REVISIT: This needs to be done "early" for the following workaround.
- info.setReplyMessage( replyMessage );
-
- // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
- // but needs to be here for now. See comment in that method for why.
- info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );
-
- // It is possible we might have entered this method more than
- // once (e.g. if an ending point threw a SystemException, then
- // a new ServerResponseImpl is created).
- if( !info.getAlreadyExecuted() ) {
- int replyStatus = replyMessage.getReplyStatus();
-
- // Translate ReplyMessage.replyStatus into PI replyStatus:
- // Note: this is also an assertion to make sure a valid
- // replyStatus is passed in (IndexOutOfBoundsException will be
- // thrown otherwise)
- short piReplyStatus =
- REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];
-
- // Make forwarded IOR available to interceptors, if applicable:
- if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
- ( piReplyStatus == TRANSPORT_RETRY.value ) )
- {
- info.setForwardRequest( replyMessage.getIOR() );
- }
-
- // REVISIT: Do early above for now.
- // Make reply message available to interceptors:
- //info.setReplyMessage( replyMessage );
-
- // Remember exception so we can tell if an interceptor changed it.
- Exception prevException = info.getException();
-
- // _REVISIT_ We do not have access to the User Exception at
- // this point, so treat it as an UNKNOWN for now.
- // Note that if this is a DSI call, we do have the user exception.
- if( !info.isDynamic() &&
- (piReplyStatus == USER_EXCEPTION.value) )
- {
- info.setException( omgWrapper.unknownUserException(
- CompletionStatus.COMPLETED_MAYBE ) ) ;
- }
-
- // Invoke the ending interception points:
- info.setReplyStatus( piReplyStatus );
- interceptorInvoker.invokeServerInterceptorEndingPoint( info );
- short newPIReplyStatus = info.getReplyStatus();
- Exception newException = info.getException();
-
- // Check reply status. If an interceptor threw a SystemException
- // and it is different than the one that we came in with,
- // rethrow it so the proper response can be constructed:
- if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
- ( newException != prevException ) )
- {
- throw (SystemException)newException;
- }
-
- // If we are to forward the location:
- if( newPIReplyStatus == LOCATION_FORWARD.value ) {
- if( piReplyStatus != LOCATION_FORWARD.value ) {
- // Treat a ForwardRequest as a ForwardException.
- IOR ior = info.getForwardRequestIOR();
- throw new ForwardException( orb, ior ) ;
- }
- else if( info.isForwardRequestRaisedInEnding() ) {
- // Treat a ForwardRequest by changing the IOR.
- replyMessage.setIOR( info.getForwardRequestIOR() );
- }
- }
- }
- }
-
- public void setServerPIInfo( Exception exception ) {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- info.setException( exception );
- }
-
- public void setServerPIInfo( NVList arguments )
- {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- info.setDSIArguments( arguments );
- }
-
- public void setServerPIExceptionInfo( Any exception )
- {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- info.setDSIException( exception );
- }
-
- public void setServerPIInfo( Any result )
- {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- info.setDSIResult( result );
- }
-
- public void initializeServerPIInfo( CorbaMessageMediator request,
- ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp )
- {
- if( !hasServerInterceptors ) return;
-
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalServerRequestInfoStack.get();
- ServerRequestInfoImpl info = new ServerRequestInfoImpl( orb );
- infoStack.push( info );
- printPush();
-
- // Notify request object that once response is constructed, make
- // sure we execute ending points.
- request.setExecutePIInResponseConstructor( true );
-
- info.setInfo( request, oa, objectId, oktemp );
- }
-
- public void setServerPIInfo( java.lang.Object servant,
- String targetMostDerivedInterface )
- {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- info.setInfo( servant, targetMostDerivedInterface );
- }
-
- public void cleanupServerPIRequest() {
- if( !hasServerInterceptors ) return;
-
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalServerRequestInfoStack.get();
- infoStack.pop();
- printPop();
- }
-
- /*
- **********************************************************************
- * The following methods are private utility methods.
- ************************************************************************/
-
- /**
- * Handles exceptions for the starting and intermediate points for
- * server request interceptors. This is common code that has been
- * factored out into this utility method.
- * <p>
- * This method will NOT work for ending points.
- */
- private void serverPIHandleExceptions( ServerRequestInfoImpl info )
- {
- int endingPointCall = info.getEndingPointCall();
- if(endingPointCall == ServerRequestInfoImpl.CALL_SEND_EXCEPTION) {
- // If a system exception was thrown, throw it to caller:
- throw (SystemException)info.getException();
- }
- else if( (endingPointCall == ServerRequestInfoImpl.CALL_SEND_OTHER) &&
- (info.getForwardRequestException() != null) )
- {
- // If an interceptor throws a forward request, convert it
- // into a ForwardException for easier handling:
- IOR ior = info.getForwardRequestIOR();
- throw new ForwardException( orb, ior );
- }
- }
-
- /**
- * Utility method to convert a PI reply status short to a ReplyMessage
- * constant. This is a reverse lookup on the table defined in
- * REPLY_MESSAGE_TO_PI_REPLY_STATUS. The reverse lookup need not be
- * performed as quickly since it is only executed in exception
- * conditions.
- */
- private int convertPIReplyStatusToReplyMessage( short replyStatus ) {
- int result = 0;
- for( int i = 0; i < REPLY_MESSAGE_TO_PI_REPLY_STATUS.length; i++ ) {
- if( REPLY_MESSAGE_TO_PI_REPLY_STATUS[i] == replyStatus ) {
- result = i;
- break;
- }
- }
- return result;
- }
-
- /**
- * Convenience method to get the ClientRequestInfoImpl object off the
- * top of the ThreadLocal stack. Throws an INTERNAL exception if
- * the Info stack is empty.
- */
- private ClientRequestInfoImpl peekClientRequestInfoImplStack() {
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalClientRequestInfoStack.get();
- ClientRequestInfoImpl info = null;
- if( !infoStack.empty() ) {
- info = (ClientRequestInfoImpl)infoStack.peek();
- } else {
- throw wrapper.clientInfoStackNull() ;
- }
-
- return info;
- }
-
- /**
- * Convenience method to get the ServerRequestInfoImpl object off the
- * top of the ThreadLocal stack. Returns null if there are none.
- */
- private ServerRequestInfoImpl peekServerRequestInfoImplStack() {
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalServerRequestInfoStack.get();
- ServerRequestInfoImpl info = null;
-
- if( !infoStack.empty() ) {
- info = (ServerRequestInfoImpl)infoStack.peek();
- } else {
- throw wrapper.serverInfoStackNull() ;
- }
-
- return info;
- }
-
- /**
- * Convenience method to determine whether Client PI is enabled
- * for requests on this thread.
- */
- private boolean isClientPIEnabledForThisThread() {
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalClientRequestInfoStack.get();
- return (infoStack.disableCount == 0);
- }
-
- /**
- * Call pre_init on all ORB initializers
- */
- private void preInitORBInitializers( ORBInitInfoImpl info ) {
-
- // Inform ORBInitInfo we are in pre_init stage
- info.setStage( ORBInitInfoImpl.STAGE_PRE_INIT );
-
- // Step through each initializer instantiation and call its
- // pre_init. Ignore any exceptions.
- for( int i = 0; i < orb.getORBData().getORBInitializers().length;
- i++ ) {
- ORBInitializer init = orb.getORBData().getORBInitializers()[i];
- if( init != null ) {
- try {
- init.pre_init( info );
- }
- catch( Exception e ) {
- // As per orbos/99-12-02, section 9.3.1.2, "If there are
- // any exceptions, the ORB shall ignore them and proceed."
- }
- }
- }
- }
-
- /**
- * Call post_init on all ORB initializers
- */
- private void postInitORBInitializers( ORBInitInfoImpl info ) {
-
- // Inform ORBInitInfo we are in post_init stage
- info.setStage( ORBInitInfoImpl.STAGE_POST_INIT );
-
- // Step through each initializer instantiation and call its post_init.
- // Ignore any exceptions.
- for( int i = 0; i < orb.getORBData().getORBInitializers().length;
- i++ ) {
- ORBInitializer init = orb.getORBData().getORBInitializers()[i];
- if( init != null ) {
- try {
- init.post_init( info );
- }
- catch( Exception e ) {
- // As per orbos/99-12-02, section 9.3.1.2, "If there are
- // any exceptions, the ORB shall ignore them and proceed."
- }
- }
- }
- }
-
- /**
- * Creates the ORBInitInfo object to be passed to ORB intializers'
- * pre_init and post_init methods
- */
- private ORBInitInfoImpl createORBInitInfo() {
- ORBInitInfoImpl result = null;
-
- // arguments comes from set_parameters. May be null.
-
- // _REVISIT_ The spec does not specify which ID this is to be.
- // We currently get this from the corba.ORB, which reads it from
- // the ORB_ID_PROPERTY property.
- String orbId = orb.getORBData().getORBId() ;
-
- result = new ORBInitInfoImpl( orb, arguments, orbId, codecFactory );
-
- return result;
- }
-
- /**
- * Called by ORBInitInfo when an interceptor needs to be registered.
- * The type is one of:
- * <ul>
- * <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
- * <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
- * <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
- * </ul>
- *
- * @exception DuplicateName Thrown if an interceptor of the given
- * name already exists for the given type.
- */
- public void register_interceptor( Interceptor interceptor, int type )
- throws DuplicateName
- {
- // We will assume interceptor is not null, since it is called
- // internally.
- if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) {
- throw wrapper.typeOutOfRange( new Integer( type ) ) ;
- }
-
- String interceptorName = interceptor.name();
-
- if( interceptorName == null ) {
- throw wrapper.nameNull() ;
- }
-
- // Register with interceptor list:
- interceptorList.register_interceptor( interceptor, type );
- }
-
- public Current getPICurrent( ) {
- return current;
- }
-
- /**
- * Called when an invalid null parameter was passed. Throws a
- * BAD_PARAM with a minor code of 1
- */
- private void nullParam()
- throws BAD_PARAM
- {
- throw orbutilWrapper.nullParam() ;
- }
-
- /** This is the implementation of standard API defined in org.omg.CORBA.ORB
- * class. This method finds the Policy Factory for the given Policy Type
- * and instantiates the Policy object from the Factory. It will throw
- * PolicyError exception, If the PolicyFactory for the given type is
- * not registered.
- * _REVISIT_, Once Policy Framework work is completed, Reorganize
- * this method to com.sun.corba.se.spi.orb.ORB.
- */
- public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val)
- throws org.omg.CORBA.PolicyError
- {
- if( val == null ) {
- nullParam( );
- }
- if( policyFactoryTable == null ) {
- throw new org.omg.CORBA.PolicyError(
- "There is no PolicyFactory Registered for type " + type,
- BAD_POLICY.value );
- }
- PolicyFactory factory = (PolicyFactory)policyFactoryTable.get(
- new Integer(type) );
- if( factory == null ) {
- throw new org.omg.CORBA.PolicyError(
- " Could Not Find PolicyFactory for the Type " + type,
- BAD_POLICY.value);
- }
- org.omg.CORBA.Policy policy = factory.create_policy( type, val );
- return policy;
- }
-
- /** This method registers the Policy Factory in the policyFactoryTable,
- * which is a HashMap. This method is made package private, because
- * it is used internally by the Interceptors.
- */
- public void registerPolicyFactory( int type, PolicyFactory factory ) {
- if( policyFactoryTable == null ) {
- policyFactoryTable = new HashMap();
- }
- Integer key = new Integer( type );
- java.lang.Object val = policyFactoryTable.get( key );
- if( val == null ) {
- policyFactoryTable.put( key, factory );
- }
- else {
- throw omgWrapper.policyFactoryRegFailed( new Integer( type ) ) ;
- }
- }
-
- public synchronized int allocateServerRequestId ()
- {
- return serverRequestIdCounter++;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java b/src/share/classes/com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java
deleted file mode 100644
index 93c047b..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import java.io.IOException;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.NVList;
-
-import org.omg.IOP.CodecFactory;
-
-import org.omg.CORBA.portable.RemarshalException;
-
-import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
-import org.omg.PortableInterceptor.ForwardRequest;
-import org.omg.PortableInterceptor.Interceptor;
-import org.omg.PortableInterceptor.PolicyFactory;
-import org.omg.PortableInterceptor.Current;
-
-import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName ;
-
-import com.sun.corba.se.pept.encoding.OutputObject;
-
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.spi.protocol.PIHandler;
-import com.sun.corba.se.spi.protocol.ForwardException;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import com.sun.corba.se.impl.corba.RequestImpl;
-
-import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
-
-/**
- * This is No-Op implementation of PIHandler. It is used in ORBConfigurator
- * to initialize a piHandler before the Persistent Server Activation. This
- * PIHandler implementation will be replaced by the real PIHandler in
- * ORB.postInit( ) call.
- */
-public class PINoOpHandlerImpl implements PIHandler
-{
- public PINoOpHandlerImpl( ) {
- }
-
- public void close() {
- }
-
- public void initialize() {
- }
-
- public void destroyInterceptors() {
- }
-
- public void objectAdapterCreated( ObjectAdapter oa )
- {
- }
-
- public void adapterManagerStateChanged( int managerId,
- short newState )
- {
- }
-
- public void adapterStateChanged( ObjectReferenceTemplate[]
- templates, short newState )
- {
- }
-
-
- public void disableInterceptorsThisThread() {
- }
-
- public void enableInterceptorsThisThread() {
- }
-
- public void invokeClientPIStartingPoint()
- throws RemarshalException
- {
- }
-
- public Exception invokeClientPIEndingPoint(
- int replyStatus, Exception exception )
- {
- return null;
- }
-
- public Exception makeCompletedClientRequest(
- int replyStatus, Exception exception ) {
- return null;
- }
-
- public void initiateClientPIRequest( boolean diiRequest ) {
- }
-
- public void cleanupClientPIRequest() {
- }
-
- public void setClientPIInfo(CorbaMessageMediator messageMediator)
- {
- }
-
- public void setClientPIInfo( RequestImpl requestImpl )
- {
- }
-
- final public void sendCancelRequestIfFinalFragmentNotSent()
- {
- }
-
-
- public void invokeServerPIStartingPoint()
- {
- }
-
- public void invokeServerPIIntermediatePoint()
- {
- }
-
- public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
- {
- }
-
- public void setServerPIInfo( Exception exception ) {
- }
-
- public void setServerPIInfo( NVList arguments )
- {
- }
-
- public void setServerPIExceptionInfo( Any exception )
- {
- }
-
- public void setServerPIInfo( Any result )
- {
- }
-
- public void initializeServerPIInfo( CorbaMessageMediator request,
- ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp )
- {
- }
-
- public void setServerPIInfo( java.lang.Object servant,
- String targetMostDerivedInterface )
- {
- }
-
- public void cleanupServerPIRequest() {
- }
-
- public void register_interceptor( Interceptor interceptor, int type )
- throws DuplicateName
- {
- }
-
- public Current getPICurrent( ) {
- return null;
- }
-
- public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val)
- throws org.omg.CORBA.PolicyError
- {
- return null;
- }
-
- public void registerPolicyFactory( int type, PolicyFactory factory ) {
- }
-
- public int allocateServerRequestId ()
- {
- return 0;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java b/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java
deleted file mode 100644
index 52e457f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java
+++ /dev/null
@@ -1,929 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-package com.sun.corba.se.impl.interceptors;
-
-import java.io.IOException ;
-
-import java.lang.reflect.Method ;
-import java.lang.reflect.InvocationTargetException ;
-
-import java.util.HashMap ;
-
-import org.omg.PortableInterceptor.ForwardRequest;
-import org.omg.PortableInterceptor.InvalidSlot;
-import org.omg.PortableInterceptor.RequestInfo;
-import org.omg.PortableInterceptor.LOCATION_FORWARD;
-import org.omg.IOP.TaggedProfile;
-import org.omg.IOP.TaggedComponent;
-import org.omg.IOP.ServiceContextHelper;
-import org.omg.Messaging.SYNC_WITH_TRANSPORT;
-import org.omg.CORBA.ParameterMode;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.CTX_RESTRICT_SCOPE;
-import org.omg.CORBA.ExceptionList;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.NamedValue;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.NO_RESOURCES;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.UNKNOWN;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.portable.ApplicationException;
-import org.omg.CORBA.portable.Delegate;
-import org.omg.CORBA.portable.InputStream;
-
-import org.omg.Dynamic.Parameter;
-
-import com.sun.corba.se.spi.legacy.connection.Connection;
-
-import com.sun.corba.se.spi.legacy.interceptor.RequestInfoExt;
-
-import com.sun.corba.se.spi.ior.IOR;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.spi.servicecontext.ServiceContexts;
-import com.sun.corba.se.spi.servicecontext.UnknownServiceContext;
-
-import com.sun.corba.se.impl.encoding.CDRInputStream_1_0;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-
-import com.sun.corba.se.impl.util.RepositoryId;
-
-import com.sun.corba.se.impl.logging.InterceptorsSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-
-import sun.corba.SharedSecrets;
-
-/**
- * Implementation of the RequestInfo interface as specified in
- * orbos/99-12-02 section 5.4.1.
- */
-public abstract class RequestInfoImpl
- extends LocalObject
- implements RequestInfo, RequestInfoExt
-{
- //////////////////////////////////////////////////////////////////////
- //
- // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
- //
- //////////////////////////////////////////////////////////////////////
-
- // The ORB from which to get PICurrent and other info
- protected ORB myORB;
- protected InterceptorsSystemException wrapper ;
- protected OMGSystemException stdWrapper ;
-
- // The number of interceptors actually invoked for this client request.
- // See setFlowStackIndex for a detailed description.
- protected int flowStackIndex = 0;
-
- // The type of starting point call to make to the interceptors
- // See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of
- // appropriate constants.
- protected int startingPointCall;
-
- // The type of intermediate point call to make to the interceptors
- // See ServerRequestInfoImpl for a list of appropriate constants.
- // This does not currently apply to client request interceptors but is
- // here in case intermediate points are introduced in the future.
- protected int intermediatePointCall;
-
- // The type of ending point call to make to the interceptors
- // See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of
- // appropriate constants.
- protected int endingPointCall;
-
- // The reply status to return in reply_status. This is initialized
- // to UNINITIALIZED so that we can tell if this has been set or not.
- protected short replyStatus = UNINITIALIZED;
-
- // Constant for an uninitizlied reply status.
- protected static final short UNINITIALIZED = -1;
-
- // Which points we are currently executing (so we can implement the
- // validity table).
- protected int currentExecutionPoint;
- protected static final int EXECUTION_POINT_STARTING = 0;
- protected static final int EXECUTION_POINT_INTERMEDIATE = 1;
- protected static final int EXECUTION_POINT_ENDING = 2;
-
- // Set to true if all interceptors have had all their points
- // executed.
- protected boolean alreadyExecuted;
-
- // Sources of request information
- protected Connection connection;
- protected ServiceContexts serviceContexts;
-
- // The ForwardRequest object if this request is being forwarded.
- // Either the forwardRequest or the forwardRequestIOR field is set.
- // When set, the other field is set to null initially. If the other
- // field is queried, it is lazily calculated and cached. These
- // two attributes are always kept in sync.
- protected ForwardRequest forwardRequest;
- protected IOR forwardRequestIOR;
-
- // PICurrent's SlotTable
- protected SlotTable slotTable;
-
- // The exception to be returned by received_exception and
- // received_exception_id
- protected Exception exception;
-
- //////////////////////////////////////////////////////////////////////
- //
- // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
- //
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Reset the info object so that it can be reused for a retry,
- * for example.
- */
- void reset() {
-
- // Please keep these in the same order as declared above.
-
- flowStackIndex = 0;
- startingPointCall = 0;
- intermediatePointCall = 0;
- endingPointCall = 0;
- // 6763340
- setReplyStatus( UNINITIALIZED ) ;
- currentExecutionPoint = EXECUTION_POINT_STARTING;
- alreadyExecuted = false;
- connection = null;
- serviceContexts = null;
- forwardRequest = null;
- forwardRequestIOR = null;
- exception = null;
-
- // We don't need to reset the Slots because they are
- // already in the clean state after recieve_<point> interceptor
- // are called.
- }
-
- /*
- **********************************************************************
- * Access protection
- **********************************************************************/
-
- // Method IDs for all methods in RequestInfo. This allows for a
- // convenient O(1) lookup for checkAccess().
- protected static final int MID_REQUEST_ID = 0;
- protected static final int MID_OPERATION = 1;
- protected static final int MID_ARGUMENTS = 2;
- protected static final int MID_EXCEPTIONS = 3;
- protected static final int MID_CONTEXTS = 4;
- protected static final int MID_OPERATION_CONTEXT = 5;
- protected static final int MID_RESULT = 6;
- protected static final int MID_RESPONSE_EXPECTED = 7;
- protected static final int MID_SYNC_SCOPE = 8;
- protected static final int MID_REPLY_STATUS = 9;
- protected static final int MID_FORWARD_REFERENCE = 10;
- protected static final int MID_GET_SLOT = 11;
- protected static final int MID_GET_REQUEST_SERVICE_CONTEXT = 12;
- protected static final int MID_GET_REPLY_SERVICE_CONTEXT = 13;
- // The last value from RequestInfo (be sure to update this):
- protected static final int MID_RI_LAST = 13;
-
- /*
- **********************************************************************
- * Public interfaces
- **********************************************************************/
-
- /**
- * Creates a new RequestInfoImpl object.
- */
- public RequestInfoImpl( ORB myORB ) {
- super();
-
- this.myORB = myORB;
- wrapper = InterceptorsSystemException.get( myORB,
- CORBALogDomains.RPC_PROTOCOL ) ;
- stdWrapper = OMGSystemException.get( myORB,
- CORBALogDomains.RPC_PROTOCOL ) ;
-
- // Capture the current TSC and make it the RSC of this request.
- PICurrent current = (PICurrent)(myORB.getPIHandler().getPICurrent());
- slotTable = current.getSlotTable( );
- }
-
- /**
- * Implementation for request_id() differs for client and server
- * implementations.
- *
- * Uniquely identifies an active request/reply sequence. Once a
- * request/reply sequence is concluded this ID may be reused. (this
- * is NOT necessarily the same as the GIOP request_id).
- */
- abstract public int request_id ();
-
- /**
- * Implementation for operation() differs for client and server
- * implementations.
- *
- * The name of the operation being invoked.
- */
- abstract public String operation ();
-
-
- /**
- * This method returns the list of arguments for the operation that was
- * invoked. It raises NO_RESOURCES exception if the operation is not invoked
- * by using DII mechanism.
- */
- abstract public Parameter[] arguments ();
-
- /**
- * This method returns the list of exceptios that was raised when the
- * operation was invoked. It raises NO_RESOURCES exception if the operation
- * is not invoked by using DII mechanism.
- */
- abstract public TypeCode[] exceptions ();
-
- /**
- * This method returns the list of contexts for the DII operation.
- * It raises NO_RESOURCES exception if the operation is not invoked by
- * using DII mechanism.
- */
- abstract public String[] contexts ();
-
- /**
- * This method returns the list of operation_context for the DII operation.
- * It raises NO_RESOURCES exception if the operation is not invoked by
- * using DII mechanism.
- */
- abstract public String[] operation_context ();
-
- /**
- * This method returns the result from the invoked DII operation.
- * It raises NO_RESOURCES exception if the operation is not invoked by
- * using DII mechanism.
- */
- abstract public Any result ();
-
- /**
- * Implementation for response_expected() differs for client and server
- * implementations.
- *
- * Indicates whether a response is expected. On the client, a reply is
- * not returned when response_expected is false, so receive_reply cannot
- * be called. receive_other is called unless an exception occurs, in
- * which case receive_exception is called. On the client, within
- * send_poll, this attribute is true.
- */
- abstract public boolean response_expected ();
-
- /**
- * Defined in the Messaging specification. Pertinent only when
- * response_expected is false. If response_expected is true, the value
- * of sync_scope is undefined. It defines how far the request shall
- * progress before control is returned to the client. This attribute may
- * have one of the follwing values:
- * <ul>
- * <li>Messaging::SYNC_NONE</li>
- * <li>Messaging::SYNC_WITH_TRANSPORT</li>
- * <li>Messaging::SYNC_WITH_SERVER</li>
- * <li>Messaging::SYNC_WITH_TARGET</li>
- * </ul>
- */
- public short sync_scope (){
- checkAccess( MID_SYNC_SCOPE );
- return SYNC_WITH_TRANSPORT.value; // REVISIT - get from MessageMediator
- }
-
- /**
- * Describes the state of the result of the operation invocation. Its
- * value can be one of the following:
- * <ul>
- * <li>PortableInterceptor::SUCCESSFUL</li>
- * <li>PortableInterceptor::SYSTEM_EXCEPTION</li>
- * <li>PortableInterceptor::USER_EXCEPTION</li>
- * <li>PortableInterceptor::LOCATION_FORWARD</li>
- * <li>PortableInterceptor::TRANSPORT_RETRY</li>
- * </ul>
- */
- public short reply_status (){
- checkAccess( MID_REPLY_STATUS );
- return replyStatus;
- }
-
- /**
- * Implementation for forward_reference() differs for client and server
- * implementations.
- *
- * If the reply_status attribute is LOCATION_FORWARD
- * then this attribute will contain the object
- * to which the request will be forwarded. It is indeterminate whether a
- * forwarded request will actually occur.
- */
- abstract public Object forward_reference ();
-
-
- /**
- * Returns the data from the given slot of the PortableInterceptor::Current
- * that is in the scope of the request.
- * <p>
- * If the given slot has not been set, then an any containing a type code
- * with a TCKind value of tk_null is returned.
- * <p>
- * If the ID does not define an allocated slot, InvalidSlot is raised.
- */
- public Any get_slot (int id)
- throws InvalidSlot
- {
- // access is currently valid for all states:
- //checkAccess( MID_GET_SLOT );
- // Delegate the call to the slotTable which was set when RequestInfo was
- // created.
- return slotTable.get_slot( id );
- }
-
- /**
- * Implementation for get_request_service_context() differs for client
- * and server implementations.
- *
- * This operation returns a copy of the service context with the given ID
- * that is associated with the request. If the request's service context
- * does not contain an etry for that ID, BAD_PARAM with a minor code of
- * TBD_BP is raised.
- */
- abstract public org.omg.IOP.ServiceContext
- get_request_service_context(int id);
-
- /**
- * Implementation for get_reply_service_context() differs for client
- * and server implementations.
- *
- * This operation returns a copy of the service context with the given ID
- * that is associated with the reply. IF the request's service context
- * does not contain an entry for that ID, BAD_PARAM with a minor code of
- * TBD_BP is raised.
- */
- abstract public org.omg.IOP.ServiceContext
- get_reply_service_context (int id);
-
-
- // NOTE: When adding a method, be sure to:
- // 1. Add a MID_* constant for that method
- // 2. Call checkAccess at the start of the method
- // 3. Define entries in the validCall[][] table for interception points
- // in both ClientRequestInfoImpl and ServerRequestInfoImpl.
-
-
-
- /*
- **********************************************************************
- * Proprietary methods
- **********************************************************************/
-
- /**
- * @return The connection on which the request is made.
- *
- * Note: we store the connection as an internal type but
- * expose it here as an external type.
- */
- public com.sun.corba.se.spi.legacy.connection.Connection connection()
- {
- return connection;
- }
-
- /*
- **********************************************************************
- * Private utility methods
- **********************************************************************/
-
- /**
- * Inserts the UserException inside the given ApplicationException
- * into the given Any. Throws an UNKNOWN with minor code
- * OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper class could not be
- * found to insert it with.
- */
- private void insertApplicationException( ApplicationException appException,
- Any result )
- throws UNKNOWN
- {
- try {
- // Extract the UserException from the ApplicationException.
- // Look up class name from repository id:
- RepositoryId repId = RepositoryId.cache.getId(
- appException.getId() );
- String className = repId.getClassName();
-
- // Find the read method on the helper class:
- String helperClassName = className + "Helper";
- Class<?> helperClass =
- SharedSecrets.getJavaCorbaAccess().loadClass( helperClassName );
- Class[] readParams = new Class[1];
- readParams[0] = org.omg.CORBA.portable.InputStream.class;
- Method readMethod = helperClass.getMethod( "read", readParams );
-
- // Invoke the read method, passing in the input stream to
- // retrieve the user exception. Mark and reset the stream
- // as to not disturb it.
- InputStream ueInputStream = appException.getInputStream();
- ueInputStream.mark( 0 );
- UserException userException = null;
- try {
- java.lang.Object[] readArguments = new java.lang.Object[1];
- readArguments[0] = ueInputStream;
- userException = (UserException)readMethod.invoke(
- null, readArguments );
- }
- finally {
- try {
- ueInputStream.reset();
- }
- catch( IOException e ) {
- throw wrapper.markAndResetFailed( e ) ;
- }
- }
-
- // Insert this UserException into the provided Any using the
- // helper class.
- insertUserException( userException, result );
- } catch( ClassNotFoundException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
- } catch( NoSuchMethodException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
- } catch( SecurityException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
- } catch( IllegalAccessException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
- } catch( IllegalArgumentException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
- } catch( InvocationTargetException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
- }
- }
-
- /**
- * Inserts the UserException into the given Any.
- * Throws an UNKNOWN with minor code
- * OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper class could not be
- * found to insert it with.
- */
- private void insertUserException( UserException userException, Any result )
- throws UNKNOWN
- {
- try {
- // Insert this UserException into the provided Any using the
- // helper class.
- if( userException != null ) {
- Class exceptionClass = userException.getClass();
- String className = exceptionClass.getName();
- String helperClassName = className + "Helper";
- Class<?> helperClass =
- SharedSecrets.getJavaCorbaAccess().loadClass( helperClassName );
-
- // Find insert( Any, class ) method
- Class[] insertMethodParams = new Class[2];
- insertMethodParams[0] = org.omg.CORBA.Any.class;
- insertMethodParams[1] = exceptionClass;
- Method insertMethod = helperClass.getMethod(
- "insert", insertMethodParams );
-
- // Call helper.insert( result, userException ):
- java.lang.Object[] insertMethodArguments =
- new java.lang.Object[2];
- insertMethodArguments[0] = result;
- insertMethodArguments[1] = userException;
- insertMethod.invoke( null, insertMethodArguments );
- }
- } catch( ClassNotFoundException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
- } catch( NoSuchMethodException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
- } catch( SecurityException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
- } catch( IllegalAccessException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
- } catch( IllegalArgumentException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
- } catch( InvocationTargetException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
- }
- }
-
- /*
- **********************************************************************
- * Protected utility methods
- **********************************************************************/
-
- /**
- * Internal utility method to convert an NVList into a PI Parameter[]
- */
- protected Parameter[] nvListToParameterArray( NVList parNVList ) {
-
- // _REVISIT_ This utility method should probably be doing a deep
- // copy so interceptor can't accidentally change the arguments.
-
- int count = parNVList.count();
- Parameter[] plist = new Parameter[count];
- try {
- for( int i = 0; i < count; i++ ) {
- Parameter p = new Parameter();
- plist[i] = p;
- NamedValue nv = parNVList.item( i );
- plist[i].argument = nv.value();
- // ParameterMode spec can be found in 99-10-07.pdf
- // Section:10.5.22
- // nv.flags spec can be found in 99-10-07.pdf
- // Section 7.1.1
- // nv.flags has ARG_IN as 1, ARG_OUT as 2 and ARG_INOUT as 3
- // To convert this into enum PARAM_IN, PARAM_OUT and
- // PARAM_INOUT the value is subtracted by 1.
- plist[i].mode = ParameterMode.from_int( nv.flags() - 1 );
- }
- } catch ( Exception e ) {
- throw wrapper.exceptionInArguments( e ) ;
- }
-
- return plist;
- }
-
- /**
- * Utility to wrap the given Exception in an Any object and return it.
- * If the exception is a UserException which cannot be inserted into
- * an any, then this returns an Any containing the system exception
- * UNKNOWN.
- */
- protected Any exceptionToAny( Exception exception ){
- Any result = myORB.create_any();
-
- if( exception == null ) {
- // Note: exception should never be null here since we will throw
- // a BAD_INV_ORDER if this is not called from receive_exception.
- throw wrapper.exceptionWasNull2() ;
- } else if( exception instanceof SystemException ) {
- ORBUtility.insertSystemException(
- (SystemException)exception, result );
- } else if( exception instanceof ApplicationException ) {
- // Use the Helper class for this exception to insert it into an
- // Any.
- try {
- // Insert the user exception inside the application exception
- // into the Any result:
- ApplicationException appException =
- (ApplicationException)exception;
- insertApplicationException( appException, result );
- } catch( UNKNOWN e ) {
- // As per ptc/00-08-06, 21.3.13.4. if we cannot find the
- // appropriate class, then return an any containing UNKNOWN,
- // with a minor code of 1. This is conveniently the same
- // exception that is returned from the
- // insertApplicationException utility method.
- ORBUtility.insertSystemException( e, result );
- }
- } else if( exception instanceof UserException ) {
- try {
- UserException userException = (UserException)exception;
- insertUserException( userException, result );
- } catch( UNKNOWN e ) {
- ORBUtility.insertSystemException( e, result );
- }
- }
-
-
- return result;
- }
-
- /**
- * Utility method to look up a service context with the given id and
- * convert it to an IOP.ServiceContext. Uses the given HashMap as
- * a cache. If not found in cache, the result is inserted in the cache.
- */
- protected org.omg.IOP.ServiceContext
- getServiceContext ( HashMap cachedServiceContexts,
- ServiceContexts serviceContexts, int id )
- {
- org.omg.IOP.ServiceContext result = null;
- Integer integerId = new Integer( id );
-
- // Search cache first:
- result = (org.omg.IOP.ServiceContext)
- cachedServiceContexts.get( integerId );
-
- // null could normally mean that either we cached the value null
- // or it's not in the cache. However, there is no way for us to
- // cache the value null in the following code.
- if( result == null ) {
- // Not in cache. Find it and put in cache.
- // Get the desired "core" service context.
- com.sun.corba.se.spi.servicecontext.ServiceContext context =
- serviceContexts.get( id );
- if (context == null)
- throw stdWrapper.invalidServiceContextId() ;
-
- // Convert the "core" service context to an
- // "IOP" ServiceContext by writing it to a
- // CDROutputStream and reading it back.
- EncapsOutputStream out =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB);
-
- context.write( out, GIOPVersion.V1_2 );
- InputStream inputStream = out.create_input_stream();
- result = ServiceContextHelper.read( inputStream );
-
- cachedServiceContexts.put( integerId, result );
- }
-
- // Good citizen: For increased efficiency, we assume that interceptors
- // will not modify the returned ServiceContext. Otherwise, we would
- // have to make a deep copy.
-
- return result;
- }
-
-
- /**
- * Utility method to add an IOP.ServiceContext to a core.ServiceContexts
- * object. If replace is true, any service context with the given id
- * is replaced.
- * <p>
- * Raises BAD_INV_ORDER if replace is false and a service context with
- * the given id already exists.
- * <p>
- * Uses the given HashMap as a cache. If a service context is placed
- * in the container, it goes in the HashMap as well.
- */
- protected void addServiceContext(
- HashMap cachedServiceContexts,
- ServiceContexts serviceContexts,
- org.omg.IOP.ServiceContext service_context,
- boolean replace )
- {
- int id = 0 ;
- // Convert IOP.service_context to core.ServiceContext:
- EncapsOutputStream outputStream =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB);
- InputStream inputStream = null;
- UnknownServiceContext coreServiceContext = null;
- ServiceContextHelper.write( outputStream, service_context );
- inputStream = outputStream.create_input_stream();
-
- // Constructor expects id to already have been read from stream.
- coreServiceContext = new UnknownServiceContext(
- inputStream.read_long(),
- (org.omg.CORBA_2_3.portable.InputStream)inputStream );
-
- id = coreServiceContext.getId();
-
- if (serviceContexts.get(id) != null)
- if (replace)
- serviceContexts.delete( id );
- else
- throw stdWrapper.serviceContextAddFailed( new Integer(id) ) ;
-
- serviceContexts.put( coreServiceContext );
-
- // Place IOP.ServiceContext in cache as well:
- cachedServiceContexts.put( new Integer( id ), service_context );
- }
-
- /**
- * Sets the number of interceptors whose starting interception
- * points were successfully invoked on this client call. As specified
- * in orbos/99-12-02, section 5.2.1., not all interceptors will
- * be invoked if a ForwardRequest exception or a system exception
- * is raised. This keeps track of how many were successfully executed
- * so we know not to execute the corresponding ending interception
- * points for the interceptors whose starting interception points
- * were not completed. This simulates the "Flow Stack Visual Model"
- * presented in section 5.1.3.*/
- protected void setFlowStackIndex(int num ) {
- this.flowStackIndex = num;
- }
-
- /**
- * Returns the number of interceptors whose starting interception
- * points were actually invoked on this client request. See
- * setFlowStackIndex for more details.
- */
- protected int getFlowStackIndex() {
- return this.flowStackIndex;
- }
-
- /**
- * Sets which ending interception point should be called
- * for each interceptor in the virtual flow stack.
- */
- protected void setEndingPointCall( int call ) {
- this.endingPointCall = call;
- }
-
- /**
- * Retrieves the current ending point call type (see
- * setEndingPointCall for more details).
- */
- protected int getEndingPointCall() {
- return this.endingPointCall;
- }
-
- /**
- * Sets which intermediate interception point should be called
- * for each interceptor in the virtual flow stack.
- */
- protected void setIntermediatePointCall( int call ) {
- this.intermediatePointCall = call;
- }
-
- /**
- * Retrieves the current intermediate point call type (see
- * setEndingPointCall for more details).
- */
- protected int getIntermediatePointCall() {
- return this.intermediatePointCall;
- }
-
- /**
- * Sets which starting interception point should be called
- * for each interceptor in the virtual flow stack.
- */
- protected void setStartingPointCall( int call ) {
- this.startingPointCall = call;
- }
-
- /**
- * Retrieves the current starting point call type (see
- * setStartingPointCall for more details).
- */
- protected int getStartingPointCall() {
- return this.startingPointCall;
- }
-
- /**
- * Returns true if all interceptors' starting and ending points
- * have already executed to completion, or false if not yet.
- */
- protected boolean getAlreadyExecuted() {
- return this.alreadyExecuted;
- }
-
- /**
- * Sets whether all interceotrs' starting and ending points
- * have already been executed to completion.
- */
- protected void setAlreadyExecuted( boolean alreadyExecuted ) {
- this.alreadyExecuted = alreadyExecuted;
- }
-
- /**
- * Sets the value to be returned by reply_status
- */
- protected void setReplyStatus( short replyStatus ) {
- this.replyStatus = replyStatus;
- }
-
- /**
- * Gets the current reply_status without doing an access check
- * (available only to package and subclasses)
- */
- protected short getReplyStatus() {
- return this.replyStatus;
- }
-
- /**
- * Stores the given ForwardRequest object for later analysis.
- * This version supplements setForwardRequest( IOR );
- */
- protected void setForwardRequest( ForwardRequest forwardRequest ) {
- this.forwardRequest = forwardRequest;
- this.forwardRequestIOR = null;
- }
-
- /**
- * Stores the given IOR for later forward request analysis.
- * This version supplements setForwardRequest( ForwardRequest );
- */
- protected void setForwardRequest( IOR ior ) {
- this.forwardRequestIOR = ior;
- this.forwardRequest = null;
- }
-
- /**
- * Retrieves the ForwardRequest object as a ForwardRequest exception.
- */
- protected ForwardRequest getForwardRequestException() {
- if( this.forwardRequest == null ) {
- if( this.forwardRequestIOR != null ) {
- // Convert the internal IOR to a forward request exception
- // by creating an object reference.
- org.omg.CORBA.Object obj = iorToObject(this.forwardRequestIOR);
- this.forwardRequest = new ForwardRequest( obj );
- }
- }
-
- return this.forwardRequest;
- }
-
- /**
- * Retrieves the IOR of the ForwardRequest exception.
- */
- protected IOR getForwardRequestIOR() {
- if( this.forwardRequestIOR == null ) {
- if( this.forwardRequest != null ) {
- this.forwardRequestIOR = ORBUtility.getIOR(
- this.forwardRequest.forward ) ;
- }
- }
-
- return this.forwardRequestIOR;
- }
-
- /**
- * Sets the exception to be returned by received_exception and
- * received_exception_id.
- */
- protected void setException( Exception exception ) {
- this.exception = exception;
- }
-
- /**
- * Returns the exception to be returned by received_exception and
- * received_exception_id.
- */
- Exception getException() {
- return this.exception;
- }
-
- /**
- * Sets the execution point that we are currently executing
- * (starting points, intermediate points, or ending points).
- * This allows us to enforce the validity table.
- */
- protected void setCurrentExecutionPoint( int executionPoint ) {
- this.currentExecutionPoint = executionPoint;
- }
-
- /**
- * Check whether the caller is allowed to access this method at
- * this particular time. This is overridden in subclasses to implement
- * the validity table specified in ptc/00-04-05, table 21-1 and 21-2.
- * The currentExecutionPoint attribute is checked, and if access is
- * forbidden at this time, BAD_INV_ORDER is raised with a minor code of
- * TBD_BIO.
- *
- * @param methodID The ID of this method, one of the MID_* constants.
- * This allows us to easily look up the method access in a table.
- * Note that method ids may overlap between subclasses.
- */
- protected abstract void checkAccess( int methodID )
- throws BAD_INV_ORDER;
-
- /**
- * The server side does an explicit set rather than taking the
- * current PICurrent table as is done in the general RequestInfoImpl
- * constructor.
- */
- void setSlotTable(SlotTable slotTable)
- {
- this.slotTable = slotTable;
- }
-
- protected org.omg.CORBA.Object iorToObject( IOR ior )
- {
- return ORBUtility.makeObjectReference( ior ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java b/src/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java
deleted file mode 100644
index ecea44c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java
+++ /dev/null
@@ -1,907 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.NO_RESOURCES;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.TypeCode;
-
-import org.omg.PortableServer.Servant;
-
-import org.omg.IOP.TaggedProfile;
-import org.omg.IOP.ServiceContext;
-
-import org.omg.Dynamic.Parameter;
-
-import org.omg.PortableInterceptor.InvalidSlot;
-import org.omg.PortableInterceptor.ServerRequestInfo;
-import org.omg.PortableInterceptor.LOCATION_FORWARD;
-import org.omg.PortableInterceptor.SUCCESSFUL;
-import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
-import org.omg.PortableInterceptor.TRANSPORT_RETRY;
-import org.omg.PortableInterceptor.USER_EXCEPTION;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-
-import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
-
-import com.sun.corba.se.spi.servicecontext.ServiceContexts;
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import java.util.*;
-
-/**
- * Implementation of the ServerRequestInfo interface as specified in
- * orbos/99-12-02 section 5.4.3.
- */
-public final class ServerRequestInfoImpl
- extends RequestInfoImpl
- implements ServerRequestInfo
-{
- // The available constants for startingPointCall
- static final int CALL_RECEIVE_REQUEST_SERVICE_CONTEXT = 0;
-
- // The available constants for intermediatePointCall. The default (0)
- // is receive_request, but can be set to none on demand.
- static final int CALL_RECEIVE_REQUEST = 0;
- static final int CALL_INTERMEDIATE_NONE = 1;
-
- // The available constants for endingPointCall
- static final int CALL_SEND_REPLY = 0;
- static final int CALL_SEND_EXCEPTION = 1;
- static final int CALL_SEND_OTHER = 2;
-
- //////////////////////////////////////////////////////////////////////
- //
- // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
- //
- //////////////////////////////////////////////////////////////////////
-
- // Set to true if the server ending point raised ForwardRequest at some
- // point in the ending point.
- private boolean forwardRequestRaisedInEnding;
-
- // Sources of server request information:
- private CorbaMessageMediator request;
- private java.lang.Object servant;
- private byte[] objectId;
- private ObjectKeyTemplate oktemp ;
-
- // Information cached from calls to oktemp
- private byte[] adapterId;
- private String[] adapterName;
-
- private ArrayList addReplyServiceContextQueue;
- private ReplyMessage replyMessage;
- private String targetMostDerivedInterface;
- private NVList dsiArguments;
- private Any dsiResult;
- private Any dsiException;
- private boolean isDynamic;
- private ObjectAdapter objectAdapter;
- private int serverRequestId;
-
- // Cached information:
- private Parameter[] cachedArguments;
- private Any cachedSendingException;
- // key = Integer, value = IOP.ServiceContext.
- private HashMap cachedRequestServiceContexts;
- // key = Integer, value = IOP.ServiceContext.
- private HashMap cachedReplyServiceContexts;
-
- //////////////////////////////////////////////////////////////////////
- //
- // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
- //
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * Reset the info object so that it can be reused for a retry,
- * for example.
- */
- void reset() {
- super.reset();
-
- // Please keep these in the same order as declared above.
-
- forwardRequestRaisedInEnding = false;
-
- request = null;
- servant = null;
- objectId = null;
- oktemp = null;
-
- adapterId = null;
- adapterName = null;
-
- addReplyServiceContextQueue = null;
- replyMessage = null;
- targetMostDerivedInterface = null;
- dsiArguments = null;
- dsiResult = null;
- dsiException = null;
- isDynamic = false;
- objectAdapter = null;
- serverRequestId = myORB.getPIHandler().allocateServerRequestId();
-
- // reset cached attributes:
- cachedArguments = null;
- cachedSendingException = null;
- cachedRequestServiceContexts = null;
- cachedReplyServiceContexts = null;
-
- startingPointCall = CALL_RECEIVE_REQUEST_SERVICE_CONTEXT;
- intermediatePointCall = CALL_RECEIVE_REQUEST;
- endingPointCall = CALL_SEND_REPLY;
- }
-
- /*
- **********************************************************************
- * Access protection
- **********************************************************************/
-
- // Method IDs for all methods in ServerRequestInfo. This allows for a
- // convenient O(1) lookup for checkAccess().
- protected static final int MID_SENDING_EXCEPTION = MID_RI_LAST + 1;
- protected static final int MID_OBJECT_ID = MID_RI_LAST + 2;
- protected static final int MID_ADAPTER_ID = MID_RI_LAST + 3;
- protected static final int MID_TARGET_MOST_DERIVED_INTERFACE
- = MID_RI_LAST + 4;
- protected static final int MID_GET_SERVER_POLICY = MID_RI_LAST + 5;
- protected static final int MID_SET_SLOT = MID_RI_LAST + 6;
- protected static final int MID_TARGET_IS_A = MID_RI_LAST + 7;
- protected static final int MID_ADD_REPLY_SERVICE_CONTEXT
- = MID_RI_LAST + 8;
- protected static final int MID_SERVER_ID = MID_RI_LAST + 9;
- protected static final int MID_ORB_ID = MID_RI_LAST + 10;
- protected static final int MID_ADAPTER_NAME = MID_RI_LAST + 11;
-
- // ServerRequestInfo validity table (see ptc/00-08-06 table 21-2).
- // Note: These must be in the same order as specified in contants.
- private static final boolean validCall[][] = {
- // LEGEND:
- // r_rsc = receive_request_service_contexts
- // r_req = receive_request
- // s_rep = send_reply
- // s_exc = send_exception
- // s_oth = send_other
- //
- // A true value indicates call is valid at specified point.
- // A false value indicates the call is invalid.
- //
- // NOTE: If the order or number of columns change, update
- // checkAccess() accordingly.
- //
- // { r_rsc, r_req, s_rep, s_exc, s_oth }
- // RequestInfo methods:
- /*request_id*/ { true , true , true , true , true },
- /*operation*/ { true , true , true , true , true },
- /*arguments*/ { false, true , true , false, false },
- /*exceptions*/ { false, true , true , true , true },
- /*contexts*/ { false, true , true , true , true },
- /*operation_context*/ { false, true , true , false, false },
- /*result*/ { false, false, true , false, false },
- /*response_expected*/ { true , true , true , true , true },
- /*sync_scope*/ { true , true , true , true , true },
- /*reply_status*/ { false, false, true , true , true },
- /*forward_reference*/ { false, false, false, false, true },
- /*get_slot*/ { true , true , true , true , true },
- /*get_request_service_context*/ { true , true , true , true , true },
- /*get_reply_service_context*/ { false, false, true , true , true },
- //
- // ServerRequestInfo methods::
- /*sending_exception*/ { false, false, false, true , false },
- /*object_id*/ { false, true , true , true , true },
- /*adapter_id*/ { false, true , true , true , true },
- /*target_most_derived_inte...*/ { false, true , false, false, false },
- /*get_server_policy*/ { true , true , true , true , true },
- /*set_slot*/ { true , true , true , true , true },
- /*target_is_a*/ { false, true , false, false, false },
- /*add_reply_service_context*/ { true , true , true , true , true },
- /*orb_id*/ { false, true , true , true , true },
- /*server_id*/ { false, true , true , true , true },
- /*adapter_name*/ { false, true , true , true , true }
- };
-
- /*
- **********************************************************************
- * Public interfaces
- **********************************************************************/
-
- /**
- * Creates a new ServerRequestInfo implementation.
- * The constructor is package scope since no other package need create
- * an instance of this class.
- */
- ServerRequestInfoImpl( ORB myORB ) {
- super( myORB );
- startingPointCall = CALL_RECEIVE_REQUEST_SERVICE_CONTEXT;
- intermediatePointCall = CALL_RECEIVE_REQUEST;
- endingPointCall = CALL_SEND_REPLY;
- serverRequestId = myORB.getPIHandler().allocateServerRequestId();
- }
-
- /**
- * Any containing the exception to be returned to the client.
- */
- public Any sending_exception () {
- checkAccess( MID_SENDING_EXCEPTION );
-
- if( cachedSendingException == null ) {
- Any result = null ;
-
- if( dsiException != null ) {
- result = dsiException;
- } else if( exception != null ) {
- result = exceptionToAny( exception );
- } else {
- // sending_exception should not be callable if both dsiException
- // and exception are null.
- throw wrapper.exceptionUnavailable() ;
- }
-
- cachedSendingException = result;
- }
-
- return cachedSendingException;
- }
-
- /**
- * The opaque object_id describing the target of the operation invocation.
- */
- public byte[] object_id () {
- checkAccess( MID_OBJECT_ID );
-
- if( objectId == null ) {
- // For some reason, we never set object id. This could be
- // because a servant locator caused a location forward or
- // raised an exception. As per ptc/00-08-06, section 21.3.14,
- // we throw NO_RESOURCES
- throw stdWrapper.piOperationNotSupported6() ;
- }
-
- // Good citizen: In the interest of efficiency, we will assume
- // interceptors will not change the resulting byte[] array.
- // Otherwise, we would need to make a clone of this array.
-
- return objectId;
- }
-
- private void checkForNullTemplate()
- {
- if (oktemp == null) {
- // For some reason, we never set the ObjectKeyTemplate
- // because a servant locator caused a location forward or
- // raised an exception. As per ptc/00-08-06, section 21.3.14,
- // we throw NO_RESOURCES
- throw stdWrapper.piOperationNotSupported7() ;
- }
- }
-
- public String server_id()
- {
- checkAccess( MID_SERVER_ID ) ;
- checkForNullTemplate() ;
-
- // Good citizen: In the interest of efficiency, we will assume
- // interceptors will not change the resulting byte[] array.
- // Otherwise, we would need to make a clone of this array.
-
- return Integer.toString( oktemp.getServerId() ) ;
- }
-
- public String orb_id()
- {
- checkAccess( MID_ORB_ID ) ;
-
- return myORB.getORBData().getORBId() ;
- }
-
- synchronized public String[] adapter_name()
- {
- checkAccess( MID_ADAPTER_NAME ) ;
-
- if (adapterName == null) {
- checkForNullTemplate() ;
-
- ObjectAdapterId oaid = oktemp.getObjectAdapterId() ;
- adapterName = oaid.getAdapterName() ;
- }
-
- return adapterName ;
- }
-
- /**
- * The opaque identifier for the object adapter.
- */
- synchronized public byte[] adapter_id ()
- {
- checkAccess( MID_ADAPTER_ID );
-
- if( adapterId == null ) {
- checkForNullTemplate() ;
- adapterId = oktemp.getAdapterId() ;
- }
-
- return adapterId;
- }
-
- /**
- * The RepositoryID for the most derived interface of the servant.
- */
- public String target_most_derived_interface () {
- checkAccess( MID_TARGET_MOST_DERIVED_INTERFACE );
- return targetMostDerivedInterface;
- }
-
- /**
- * Returns the policy in effect for this operation for the given policy
- * type.
- */
- public Policy get_server_policy (int type) {
- // access is currently valid for all states:
- //checkAccess( MID_GET_SERVER_POLICY );
-
- Policy result = null;
-
- if( objectAdapter != null ) {
- result = objectAdapter.getEffectivePolicy( type );
- }
-
- // _REVISIT_ RTF Issue: get_server_policy spec not in sync with
- // get_effective_policy spec.
-
- return result;
- }
-
- /**
- * Allows an Interceptor to set a slot in the Current that is in the scope
- * of the request. If data already exists in that slot, it will be
- * overwritten. If the ID does not define an allocated slot, InvalidSlot
- * is raised.
- */
- public void set_slot (int id, Any data) throws InvalidSlot {
- // access is currently valid for all states:
- //checkAccess( MID_SET_SLOT );
-
- slotTable.set_slot( id, data );
- }
-
- /**
- * Returns true if the servant is the given RepositoryId, false if it is
- * not.
- */
- public boolean target_is_a (String id) {
- checkAccess( MID_TARGET_IS_A );
-
- boolean result = false ;
- if( servant instanceof Servant ) {
- result = ((Servant)servant)._is_a( id );
- } else if (StubAdapter.isStub( servant )) {
- result = ((org.omg.CORBA.Object)servant)._is_a( id );
- } else {
- throw wrapper.servantInvalid() ;
- }
-
- return result;
- }
-
- /**
- * Allows Interceptors to add service contexts to the request.
- */
- public void add_reply_service_context ( ServiceContext service_context,
- boolean replace )
- {
- // access is currently valid for all states:
- //checkAccess( MID_ADD_REPLY_SERVICE_CONTEXT );
-
- if( currentExecutionPoint == EXECUTION_POINT_ENDING ) {
- ServiceContexts scs = replyMessage.getServiceContexts();
-
- // May be null. If this is null, create a new one in its place.
- if( scs == null ) {
- scs = new ServiceContexts( myORB );
- replyMessage.setServiceContexts( scs );
- }
-
- if( cachedReplyServiceContexts == null ) {
- cachedReplyServiceContexts = new HashMap();
- }
-
- // This is during and ending point, so we now have enough
- // information to add the reply service context.
- addServiceContext( cachedReplyServiceContexts, scs,
- service_context, replace );
- }
-
- // We enqueue all adds for the following reasons:
- //
- // If we are not in the ending point then we do not yet have a
- // pointer to the ServiceContexts object so we cannot access the
- // service contexts until we get to the ending point.
- // So we enqueue this add reply service context request.
- // It is added when we do have a handle on the service contexts object.
- //
- // If we are in the ending point and we just add directly to the
- // SC container but then an interceptor raises a SystemException
- // then that add will be lost since a new container is created
- // for the SystemException response.
- //
- // Therefore we always enqueue and never dequeue (per request) so
- // that all adds will be completed.
-
- AddReplyServiceContextCommand addReply =
- new AddReplyServiceContextCommand();
- addReply.service_context = service_context;
- addReply.replace = replace;
-
- if( addReplyServiceContextQueue == null ) {
- addReplyServiceContextQueue = new ArrayList();
- }
-
- // REVISIT: this does not add to the cache.
- enqueue( addReply );
- }
-
- // NOTE: When adding a method, be sure to:
- // 1. Add a MID_* constant for that method
- // 2. Call checkAccess at the start of the method
- // 3. Define entries in the validCall[][] table for interception points.
-
- /*
- **********************************************************************
- * Public RequestInfo interfaces
- *
- * These are implemented here because they have differing
- * implementations depending on whether this is a client or a server
- * request info object.
- **********************************************************************/
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public int request_id (){
- // access is currently valid for all states:
- //checkAccess( MID_REQUEST_ID );
- /*
- * NOTE: The request id in server interceptors is NOT the
- * same as the GIOP request id. The ORB may be servicing several
- * connections, each with possibly overlapping sets of request ids.
- * Therefore we create a request id specific to interceptors.
- */
- return serverRequestId;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public String operation (){
- // access is currently valid for all states:
- //checkAccess( MID_OPERATION );
- return request.getOperationName();
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public Parameter[] arguments (){
- checkAccess( MID_ARGUMENTS );
-
- if( cachedArguments == null ) {
- if( !isDynamic ) {
- throw stdWrapper.piOperationNotSupported1() ;
- }
-
- if( dsiArguments == null ) {
- throw stdWrapper.piOperationNotSupported8() ;
- }
-
- // If it is a DSI request then get the arguments from the DSI req
- // and convert that into parameters.
- cachedArguments = nvListToParameterArray( dsiArguments );
- }
-
- // Good citizen: In the interest of efficiency, we assume
- // interceptors will be "good citizens" in that they will not
- // modify the contents of the Parameter[] array. We also assume
- // they will not change the values of the containing Anys.
-
- return cachedArguments;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public TypeCode[] exceptions (){
- checkAccess( MID_EXCEPTIONS );
-
- // _REVISIT_ PI RTF Issue: No exception list on server side.
-
- throw stdWrapper.piOperationNotSupported2() ;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public String[] contexts (){
- checkAccess( MID_CONTEXTS );
-
- // We do not support this because our ORB does not send contexts.
-
- throw stdWrapper.piOperationNotSupported3() ;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public String[] operation_context (){
- checkAccess( MID_OPERATION_CONTEXT );
-
- // We do not support this because our ORB does not send
- // operation_context.
-
- throw stdWrapper.piOperationNotSupported4() ;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public Any result (){
- checkAccess( MID_RESULT );
-
- if( !isDynamic ) {
- throw stdWrapper.piOperationNotSupported5() ;
- }
-
- if( dsiResult == null ) {
- throw wrapper.piDsiResultIsNull() ;
- }
-
- // Good citizen: In the interest of efficiency, we assume that
- // interceptors will not modify the contents of the result Any.
- // Otherwise, we would need to create a deep copy of the Any.
-
- return dsiResult;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public boolean response_expected (){
- // access is currently valid for all states:
- //checkAccess( MID_RESPONSE_EXPECTED );
- return !request.isOneWay();
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public Object forward_reference (){
- checkAccess( MID_FORWARD_REFERENCE );
- // Check to make sure we are in LOCATION_FORWARD
- // state as per ptc/00-08-06, table 21-2
- // footnote 2.
- if( replyStatus != LOCATION_FORWARD.value ) {
- throw stdWrapper.invalidPiCall1() ;
- }
-
- return getForwardRequestException().forward;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public org.omg.IOP.ServiceContext get_request_service_context( int id ) {
- checkAccess( MID_GET_REQUEST_SERVICE_CONTEXT );
-
- if( cachedRequestServiceContexts == null ) {
- cachedRequestServiceContexts = new HashMap();
- }
-
- return getServiceContext( cachedRequestServiceContexts,
- request.getRequestServiceContexts(), id );
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public org.omg.IOP.ServiceContext get_reply_service_context( int id ) {
- checkAccess( MID_GET_REPLY_SERVICE_CONTEXT );
-
- if( cachedReplyServiceContexts == null ) {
- cachedReplyServiceContexts = new HashMap();
- }
-
- return getServiceContext( cachedReplyServiceContexts,
- replyMessage.getServiceContexts(), id );
- }
-
- /*
- **********************************************************************
- * Private-scope classes and methods
- **********************************************************************/
-
- // A command encapsulating a request to add a reply service context.
- // These commands are enqueued until we have a handle on the actual
- // reply service context, at which point they are executed.
- private class AddReplyServiceContextCommand {
- ServiceContext service_context;
- boolean replace;
- }
-
- // Adds the given add reply service context command to the queue of
- // such commands. If a command is detected to have the same id as
- // the service context in this command, and replace is false,
- // BAD_INV_ORDER is thrown. If replace is true, the original command
- // in the queue is replaced by this command.
- private void enqueue( AddReplyServiceContextCommand addReply ) {
- int size = addReplyServiceContextQueue.size();
- boolean found = false;
-
- for( int i = 0; i < size; i++ ) {
- AddReplyServiceContextCommand cmd =
- (AddReplyServiceContextCommand)
- addReplyServiceContextQueue.get( i );
-
- if( cmd.service_context.context_id ==
- addReply.service_context.context_id )
- {
- found = true;
- if( addReply.replace ) {
- addReplyServiceContextQueue.set( i, addReply );
- } else {
- throw stdWrapper.serviceContextAddFailed(
- new Integer( cmd.service_context.context_id ) ) ;
- }
- break;
- }
- }
-
- if( !found ) {
- addReplyServiceContextQueue.add( addReply );
- }
- }
-
- /*
- **********************************************************************
- * Package and protected-scope methods
- **********************************************************************/
-
- /**
- * Overridden from RequestInfoImpl. This version calls the super
- * and then, if we are changing to ending points, executes all
- * enqueued AddReplyServiceContextCommands.
- */
- protected void setCurrentExecutionPoint( int executionPoint ) {
- super.setCurrentExecutionPoint( executionPoint );
-
- // If we are transitioning to ending point, we will now have a pointer
- // to the reply service contexts, so we can execute all queued
- // add reply service context requests.
- if( (executionPoint == EXECUTION_POINT_ENDING) &&
- (addReplyServiceContextQueue != null) )
- {
- int size = addReplyServiceContextQueue.size();
- for( int i = 0; i < size; i++ ) {
- AddReplyServiceContextCommand addReply =
- (AddReplyServiceContextCommand)
- addReplyServiceContextQueue.get( i );
- try {
- add_reply_service_context( addReply.service_context,
- addReply.replace );
- }
- catch( BAD_INV_ORDER e ) {
- // _REVISIT_ The only way this can happen is if during
- // rrsc or rr, the interceptor tried to add with
- // replace=false to a service context that is present in
- // the reply message. At that time there was no way for
- // us to check for this, so the best we can do is ignore
- // the original request.
- }
- }
-
- // We specifically do not empty the SC queue so that if
- // the interceptor raises an exception the queued service contexts
- // will be put in the exception response.
- }
- }
-
- /**
- * Stores the various sources of information used for this info object.
- */
- protected void setInfo( CorbaMessageMediator request, ObjectAdapter oa,
- byte[] objectId, ObjectKeyTemplate oktemp )
- {
- this.request = request;
- this.objectId = objectId;
- this.oktemp = oktemp;
- this.objectAdapter = oa ;
- this.connection = (com.sun.corba.se.spi.legacy.connection.Connection)
- request.getConnection();
- }
-
- /**
- * Stores the various sources of information used for this info object.
- */
- protected void setDSIArguments( NVList arguments ) {
- this.dsiArguments = arguments;
- }
-
- /**
- * Stores the various sources of information used for this info object.
- */
- protected void setDSIException( Any exception ) {
- this.dsiException = exception;
-
- // Clear cached exception value:
- cachedSendingException = null;
- }
-
- /**
- * Stores the various sources of information used for this info object.
- */
- protected void setDSIResult( Any result ) {
- this.dsiResult = result;
- }
-
- /**
- * Sets the exception to be returned by received_exception and
- * received_exception_id.
- */
- protected void setException( Exception exception ) {
- super.setException( exception );
-
- // Make sure DSIException is null because this is the more recent one.
- this.dsiException = null;
-
- // Clear cached exception value:
- cachedSendingException = null;
- }
-
- /**
- * Stores the various sources of information used for this info object.
- */
- protected void setInfo( java.lang.Object servant,
- String targetMostDerivedInterface )
- {
- this.servant = servant;
- this.targetMostDerivedInterface = targetMostDerivedInterface;
- this.isDynamic =
- (servant instanceof
- org.omg.PortableServer.DynamicImplementation) ||
- (servant instanceof org.omg.CORBA.DynamicImplementation);
- }
-
- /**
- * Set reply message
- */
- void setReplyMessage( ReplyMessage replyMessage ) {
- this.replyMessage = replyMessage;
- }
-
- /**
- * Overridden from RequestInfoImpl. Calls the super class, then
- * sets the ending point call depending on the reply status.
- */
- protected void setReplyStatus( short replyStatus ) {
- super.setReplyStatus( replyStatus );
- switch( replyStatus ) {
- case SUCCESSFUL.value:
- endingPointCall = CALL_SEND_REPLY;
- break;
- case SYSTEM_EXCEPTION.value:
- case USER_EXCEPTION.value:
- endingPointCall = CALL_SEND_EXCEPTION;
- break;
- case LOCATION_FORWARD.value:
- case TRANSPORT_RETRY.value:
- endingPointCall = CALL_SEND_OTHER;
- break;
- }
- }
-
- /**
- * Release the servant object so the user has control over its lifetime.
- * Called after receive_request is finished executing.
- */
- void releaseServant() {
- this.servant = null;
- }
-
- /**
- * Sets the forwardRequestRaisedInEnding flag to true, indicating that
- * a server ending point has raised location forward at some point.
- */
- void setForwardRequestRaisedInEnding() {
- this.forwardRequestRaisedInEnding = true;
- }
-
- /**
- * Returns true if ForwardRequest was raised by a server ending point
- * or false otherwise.
- */
- boolean isForwardRequestRaisedInEnding() {
- return this.forwardRequestRaisedInEnding;
- }
-
- /**
- * Returns true if this is a dynamic invocation, or false if not
- */
- boolean isDynamic() {
- return this.isDynamic;
- }
-
- /**
- * See description for RequestInfoImpl.checkAccess
- */
- protected void checkAccess( int methodID )
- {
- // Make sure currentPoint matches the appropriate index in the
- // validCall table:
- int validCallIndex = 0;
- switch( currentExecutionPoint ) {
- case EXECUTION_POINT_STARTING:
- validCallIndex = 0;
- break;
- case EXECUTION_POINT_INTERMEDIATE:
- validCallIndex = 1;
- break;
- case EXECUTION_POINT_ENDING:
- switch( endingPointCall ) {
- case CALL_SEND_REPLY:
- validCallIndex = 2;
- break;
- case CALL_SEND_EXCEPTION:
- validCallIndex = 3;
- break;
- case CALL_SEND_OTHER:
- validCallIndex = 4;
- break;
- }
- break;
- }
-
- // Check the validCall table:
- if( !validCall[methodID][validCallIndex] ) {
- throw stdWrapper.invalidPiCall2() ;
- }
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/SlotTable.java b/src/share/classes/com/sun/corba/se/impl/interceptors/SlotTable.java
deleted file mode 100644
index 93908fd..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/SlotTable.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import com.sun.corba.se.impl.corba.AnyImpl;
-import com.sun.corba.se.spi.orb.ORB;
-import org.omg.PortableInterceptor.Current;
-import org.omg.PortableInterceptor.InvalidSlot;
-import org.omg.CORBA.Any;
-
-/**
- * SlotTable is used internally by PICurrent to store the slot information.
- */
-public class SlotTable {
- // The vector where all the slot data for the current thread is stored
- private Any[] theSlotData;
-
- // Required for instantiating Any object.
- private ORB orb;
-
- // The flag to check whether there are any updates in the current SlotTable.
- // The slots will be reset to null, only if this flag is set.
- private boolean dirtyFlag;
-
- /**
- * The constructor instantiates an Array of Any[] of size given by slotSize
- * parameter.
- */
- SlotTable( ORB orb, int slotSize ) {
- dirtyFlag = false;
- this.orb = orb;
- theSlotData = new Any[slotSize];
- }
-
- /**
- * This method sets the slot data at the given slot id (index).
- */
- public void set_slot( int id, Any data ) throws InvalidSlot
- {
- // First check whether the slot is allocated
- // If not, raise the invalid slot exception
- if( id >= theSlotData.length ) {
- throw new InvalidSlot();
- }
- dirtyFlag = true;
- theSlotData[id] = data;
- }
-
- /**
- * This method get the slot data for the given slot id (index).
- */
- public Any get_slot( int id ) throws InvalidSlot
- {
- // First check whether the slot is allocated
- // If not, raise the invalid slot exception
- if( id >= theSlotData.length ) {
- throw new InvalidSlot();
- }
- if( theSlotData[id] == null ) {
- theSlotData [id] = new AnyImpl(orb);
- }
- return theSlotData[ id ];
- }
-
-
- /**
- * This method resets all the slot data to null if dirtyFlag is set.
- */
- void resetSlots( ) {
- if( dirtyFlag == true ) {
- for( int i = 0; i < theSlotData.length; i++ ) {
- theSlotData[i] = null;
- }
- }
- }
-
- /**
- * This method returns the size of the allocated slots.
- */
- int getSize( ) {
- return theSlotData.length;
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/interceptors/SlotTableStack.java b/src/share/classes/com/sun/corba/se/impl/interceptors/SlotTableStack.java
deleted file mode 100644
index c19a384..0000000
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/SlotTableStack.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INTERNAL;
-import org.omg.PortableInterceptor.Current;
-import org.omg.PortableInterceptor.InvalidSlot;
-
-import com.sun.corba.se.impl.corba.AnyImpl;
-
-import com.sun.corba.se.impl.logging.InterceptorsSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-/**
- * SlotTableStack is the container of SlotTable instances for each thread
- */
-public class SlotTableStack
-{
- // SlotTablePool is the container for reusable SlotTables'
- private class SlotTablePool {
-
- // Contains a list of reusable SlotTable
- private SlotTable[] pool;
-
- // High water mark for the pool
- // If the pool size reaches this limit then putSlotTable will
- // not put SlotTable to the pool.
- private final int HIGH_WATER_MARK = 5;
-
- // currentIndex points to the last SlotTable in the list
- private int currentIndex;
-
- SlotTablePool( ) {
- pool = new SlotTable[HIGH_WATER_MARK];
- currentIndex = 0;
- }
-
- /**
- * Puts SlotTable to the re-usable pool.
- */
- void putSlotTable( SlotTable table ) {
- // If there are enough SlotTables in the pool, then don't add
- // this table to the pool.
- if( currentIndex >= HIGH_WATER_MARK ) {
- // Let the garbage collector collect it.
- return;
- }
- pool[currentIndex] = table;
- currentIndex++;
- }
-
- /**
- * Gets SlotTable from the re-usable pool.
- */
- SlotTable getSlotTable( ) {
- // If there are no entries in the pool then return null
- if( currentIndex == 0 ) {
- return null;
- }
- // Works like a stack, Gets the last one added first
- currentIndex--;
- return pool[currentIndex];
- }
- }
-
- // Contains all the active SlotTables for each thread.
- // The List is made to behave like a stack.
- private java.util.List tableContainer;
-
- // Keeps track of number of PICurrents in the stack.
- private int currentIndex;
-
- // For Every Thread there will be a pool of re-usable SlotTables'
- // stored in SlotTablePool
- private SlotTablePool tablePool;
-
- // The ORB associated with this slot table stack
- private ORB orb;
-
- private InterceptorsSystemException wrapper ;
-
- /**
- * Constructs the stack and and SlotTablePool
- */
- SlotTableStack( ORB orb, SlotTable table ) {
- this.orb = orb;
- wrapper = InterceptorsSystemException.get( orb, CORBALogDomains.RPC_PROTOCOL ) ;
-
- currentIndex = 0;
- tableContainer = new java.util.ArrayList( );
- tablePool = new SlotTablePool( );
- // SlotTableStack will be created with one SlotTable on the stack.
- // This table is used as the reference to query for number of
- // allocated slots to create other slottables.
- tableContainer.add( currentIndex, table );
- currentIndex++;
- }
-
-
- /**
- * pushSlotTable pushes a fresh Slot Table on to the stack by doing the
- * following,
- * 1: Checks to see if there is any SlotTable in SlotTablePool
- * If present then use that instance to push into the SlotTableStack
- *
- * 2: If there is no SlotTable in the pool, then creates a new one and
- * pushes that into the SlotTableStack
- */
- void pushSlotTable( ) {
- SlotTable table = tablePool.getSlotTable( );
- if( table == null ) {
- // get an existing PICurrent to get the slotSize
- SlotTable tableTemp = peekSlotTable();
- table = new SlotTable( orb, tableTemp.getSize( ));
- }
- // NOTE: Very important not to always "add" - otherwise a memory leak.
- if (currentIndex == tableContainer.size()) {
- // Add will cause the table to grow.
- tableContainer.add( currentIndex, table );
- } else if (currentIndex > tableContainer.size()) {
- throw wrapper.slotTableInvariant( new Integer( currentIndex ),
- new Integer( tableContainer.size() ) ) ;
- } else {
- // Set will override unused slots.
- tableContainer.set( currentIndex, table );
- }
- currentIndex++;
- }
-
- /**
- * popSlotTable does the following
- * 1: pops the top SlotTable in the SlotTableStack
- *
- * 2: resets the slots in the SlotTable which resets the slotvalues to
- * null if there are any previous sets.
- *
- * 3: puts the reset SlotTable into the SlotTablePool to reuse
- */
- void popSlotTable( ) {
- if( currentIndex <= 1 ) {
- // Do not pop the SlotTable, If there is only one.
- // This should not happen, But an extra check for safety.
- throw wrapper.cantPopOnlyPicurrent() ;
- }
- currentIndex--;
- SlotTable table = (SlotTable)tableContainer.get( currentIndex );
- tableContainer.set( currentIndex, null ); // Do not leak memory.
- table.resetSlots( );
- tablePool.putSlotTable( table );
- }
-
- /**
- * peekSlotTable gets the top SlotTable from the SlotTableStack without
- * popping.
- */
- SlotTable peekSlotTable( ) {
- return (SlotTable) tableContainer.get( currentIndex - 1);
- }
-
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java b/src/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java
deleted file mode 100644
index c69fb42..0000000
--- a/src/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 1999, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import org.omg.CORBA.ORB;
-import java.util.Properties;
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandler;
-import java.util.Hashtable;
-import java.util.Stack;
-
-import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
-import com.sun.org.omg.SendingContext._CodeBaseImplBase;
-import com.sun.org.omg.SendingContext.CodeBase;
-import com.sun.org.omg.SendingContext.CodeBaseHelper;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.ORB;
-
-import com.sun.corba.se.impl.logging.OMGSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-/**
- * This class acts as the remote interface to receivers wishing to retrieve
- * the information of a remote Class.
- */
-public class FVDCodeBaseImpl extends _CodeBaseImplBase
-{
- // Contains rep. ids as keys to FullValueDescriptions
- private static Hashtable fvds = new Hashtable();
-
- // Private ORBSingleton used when we need an ORB while not
- // having a delegate set.
- private transient ORB orb = null;
-
- private transient OMGSystemException wrapper = OMGSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- // backward compatability so that appropriate rep-id calculations
- // can take place
- // this needs to be transient to prevent serialization during
- // marshalling/unmarshalling
- private transient ValueHandlerImpl vhandler = null;
-
- void setValueHandler(ValueHandler vh)
- {
- vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
- }
-
- // Operation to obtain the IR from the sending context
- public com.sun.org.omg.CORBA.Repository get_ir (){
- return null;
- }
-
- // Operations to obtain a URL to the implementation code
- public String implementation (String x){
- try{
- // default to using the current ORB version in case the
- // vhandler is not set
- if (vhandler == null) {
- vhandler = ValueHandlerImpl.getInstance(false);
- }
-
- // Util.getCodebase may return null which would
- // cause a BAD_PARAM exception.
- String result = Util.getCodebase(vhandler.getClassFromType(x));
- if (result == null)
- return "";
- else
- return result;
- } catch(ClassNotFoundException cnfe){
- throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE,
- cnfe ) ;
- }
- }
-
- public String[] implementations (String[] x){
- String result[] = new String[x.length];
-
- for (int i = 0; i < x.length; i++)
- result[i] = implementation(x[i]);
-
- return result;
- }
-
- // the same information
- public FullValueDescription meta (String x){
- try{
- FullValueDescription result = (FullValueDescription)fvds.get(x);
-
- if (result == null) {
- // default to using the current ORB version in case the
- // vhandler is not set
- if (vhandler == null) {
- vhandler = ValueHandlerImpl.getInstance(false);
- }
-
- try{
- result = ValueUtility.translate(_orb(),
- ObjectStreamClass.lookup(vhandler.getAnyClassFromType(x)), vhandler);
- } catch(Throwable t){
- if (orb == null)
- orb = ORB.init(); //d11638
- result = ValueUtility.translate(orb,
- ObjectStreamClass.lookup(vhandler.getAnyClassFromType(x)), vhandler);
- }
-
- if (result != null){
- fvds.put(x, result);
- } else {
- throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE);
- }
- }
-
- return result;
- } catch(Throwable t){
- throw wrapper.incompatibleValueImpl(CompletionStatus.COMPLETED_MAYBE,t);
- }
- }
-
- public FullValueDescription[] metas (String[] x){
- FullValueDescription descriptions[] = new FullValueDescription[x.length];
-
- for (int i = 0; i < x.length; i++)
- descriptions[i] = meta(x[i]);
-
- return descriptions;
- }
-
- // information
- public String[] bases (String x){
- try {
- // default to using the current ORB version in case the
- // vhandler is not set
- if (vhandler == null) {
- vhandler = ValueHandlerImpl.getInstance(false);
- }
-
- Stack repIds = new Stack();
- Class parent = ObjectStreamClass.lookup(vhandler.getClassFromType(x)).forClass().getSuperclass();
-
- while (!parent.equals(java.lang.Object.class)) {
- repIds.push(vhandler.createForAnyType(parent));
- parent = parent.getSuperclass();
- }
-
- String result[] = new String[repIds.size()];
- for (int i = result.length - 1; i >= 0; i++)
- result[i] = (String)repIds.pop();
-
- return result;
- } catch (Throwable t) {
- throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE, t );
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java b/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
deleted file mode 100644
index 7eff7c3..0000000
--- a/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
+++ /dev/null
@@ -1,2896 +0,0 @@
-/*
- * Copyright (c) 1998, 2015, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.StreamCorruptedException;
-import java.io.ObjectInputValidation;
-import java.io.NotActiveException;
-import java.io.InvalidObjectException;
-import java.io.InvalidClassException;
-import java.io.DataInputStream;
-import java.io.OptionalDataException;
-import java.io.WriteAbortedException;
-import java.io.Externalizable;
-import java.io.EOFException;
-import java.lang.reflect.*;
-import java.util.Vector;
-import java.util.Stack;
-import java.util.Hashtable;
-import java.util.Enumeration;
-
-import sun.corba.Bridge ;
-
-import java.security.AccessController ;
-import java.security.PrivilegedAction ;
-
-import com.sun.corba.se.impl.io.ObjectStreamClass;
-import com.sun.corba.se.impl.util.Utility;
-
-import org.omg.CORBA.portable.ValueInputStream;
-
-import org.omg.CORBA.ValueMember;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.portable.IndirectionException;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.TypeCode;
-
-import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
-import com.sun.org.omg.SendingContext.CodeBase;
-
-import javax.rmi.PortableRemoteObject;
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandler;
-
-import java.security.*;
-import java.util.*;
-
-import com.sun.corba.se.impl.orbutil.ObjectUtility ;
-import com.sun.corba.se.impl.logging.OMGSystemException ;
-import com.sun.corba.se.impl.logging.UtilSystemException ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-/**
- * IIOPInputStream is used by the ValueHandlerImpl to handle Java serialization
- * input semantics.
- *
- * @author Stephen Lewallen
- * @since JDK1.1.6
- */
-
-public class IIOPInputStream
- extends com.sun.corba.se.impl.io.InputStreamHook
-{
- private static Bridge bridge =
- (Bridge)AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
- return Bridge.get() ;
- }
- }
- ) ;
-
- private static OMGSystemException omgWrapper = OMGSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
- private static UtilSystemException utilWrapper = UtilSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- // Necessary to pass the appropriate fields into the
- // defaultReadObjectDelegate method (which takes no
- // parameters since it's called from
- // java.io.ObjectInpuStream defaultReadObject()
- // which we can't change).
- //
- // This is only used in the case where the fields had
- // to be obtained remotely because of a serializable
- // version difference. Set in inputObjectUsingFVD.
- // Part of serialization evolution fixes for Ladybird,
- // bug 4365188.
- private ValueMember defaultReadObjectFVDMembers[] = null;
-
- private org.omg.CORBA_2_3.portable.InputStream orbStream;
-
- private CodeBase cbSender;
-
- private ValueHandlerImpl vhandler; //d4365188
-
- private Object currentObject = null;
-
- private ObjectStreamClass currentClassDesc = null;
-
- private Class currentClass = null;
-
- private int recursionDepth = 0;
-
- private int simpleReadDepth = 0;
-
- // The ActiveRecursionManager replaces the old RecursionManager which
- // used to record how many recursions were made, and resolve them after
- // an object was completely deserialized.
- //
- // That created problems (as in bug 4414154) because when custom
- // unmarshaling in readObject, there can be recursive references
- // to one of the objects currently being unmarshaled, and the
- // passive recursion system failed.
- ActiveRecursionManager activeRecursionMgr = new ActiveRecursionManager();
-
- private IOException abortIOException = null;
-
- /* Remember the first exception that stopped this stream. */
- private ClassNotFoundException abortClassNotFoundException = null;
-
- /* Vector of validation callback objects
- * The vector is created as needed. The vector is maintained in
- * order of highest (first) priority to lowest
- */
- private Vector callbacks;
-
- // Serialization machinery fields
- /* Arrays used to keep track of classes and ObjectStreamClasses
- * as they are being merged; used in inputObject.
- * spClass is the stack pointer for both. */
- ObjectStreamClass[] classdesc;
- Class[] classes;
- int spClass;
-
- private static final String kEmptyStr = "";
-
- // TCKind TypeCodes used in FVD inputClassFields
- //public static final TypeCode kRemoteTypeCode = new TypeCodeImpl(TCKind._tk_objref);
- //public static final TypeCode kValueTypeCode = new TypeCodeImpl(TCKind._tk_value);
- // removed TypeCodeImpl dependency
- public static final TypeCode kRemoteTypeCode = ORB.init().get_primitive_tc(TCKind.tk_objref);
- public static final TypeCode kValueTypeCode = ORB.init().get_primitive_tc(TCKind.tk_value);
-
- // TESTING CODE - useFVDOnly should be made final before FCS in order to
- // optimize out the check.
- private static final boolean useFVDOnly = false;
-
- private byte streamFormatVersion;
-
- // Since java.io.OptionalDataException's constructors are
- // package private, but we need to throw it in some special
- // cases, we try to do it by reflection.
- private static final Constructor OPT_DATA_EXCEPTION_CTOR;
-
- private Object[] readObjectArgList = { this } ;
-
- static {
- OPT_DATA_EXCEPTION_CTOR = getOptDataExceptionCtor();
- }
-
- // Grab the OptionalDataException boolean ctor and make
- // it accessible. Note that any exceptions
- // will be wrapped in ExceptionInInitializerErrors.
- private static Constructor getOptDataExceptionCtor() {
-
- try {
-
- Constructor result =
-
- (Constructor) AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public java.lang.Object run()
- throws NoSuchMethodException,
- SecurityException {
-
- Constructor boolCtor
- = OptionalDataException.class.getDeclaredConstructor(
- new Class[] {
- Boolean.TYPE });
-
- boolCtor.setAccessible(true);
-
- return boolCtor;
- }});
-
- if (result == null)
- // XXX I18N, logging needed.
- throw new Error("Unable to find OptionalDataException constructor");
-
- return result;
-
- } catch (Exception ex) {
- // XXX I18N, logging needed.
- throw new ExceptionInInitializerError(ex);
- }
- }
-
- // Create a new OptionalDataException with the EOF marker
- // set to true. See handleOptionalDataMarshalException.
- private OptionalDataException createOptionalDataException() {
- try {
- OptionalDataException result
- = (OptionalDataException)
- OPT_DATA_EXCEPTION_CTOR.newInstance(new Object[] {
- Boolean.TRUE });
-
- if (result == null)
- // XXX I18N, logging needed.
- throw new Error("Created null OptionalDataException");
-
- return result;
-
- } catch (Exception ex) {
- // XXX I18N, logging needed.
- throw new Error("Couldn't create OptionalDataException", ex);
- }
- }
-
- // Return the stream format version currently being used
- // to deserialize an object
- protected byte getStreamFormatVersion() {
- return streamFormatVersion;
- }
-
- // At the beginning of data sent by a writeObject or
- // writeExternal method there is a byte telling the
- // reader the stream format version.
- private void readFormatVersion() throws IOException {
-
- streamFormatVersion = orbStream.read_octet();
-
- if (streamFormatVersion < 1 ||
- streamFormatVersion > vhandler.getMaximumStreamFormatVersion()) {
- SystemException sysex = omgWrapper.unsupportedFormatVersion(
- CompletionStatus.COMPLETED_MAYBE);
- // XXX I18N? Logging for IOException?
- IOException result = new IOException("Unsupported format version: "
- + streamFormatVersion);
- result.initCause( sysex ) ;
- throw result ;
- }
-
- if (streamFormatVersion == 2) {
- if (!(orbStream instanceof ValueInputStream)) {
- SystemException sysex = omgWrapper.notAValueinputstream(
- CompletionStatus.COMPLETED_MAYBE);
- // XXX I18N? Logging for IOException?
- IOException result = new IOException("Not a ValueInputStream");
- result.initCause( sysex ) ;
- throw result;
- }
- }
- }
-
- public static void setTestFVDFlag(boolean val){
- // useFVDOnly = val;
- }
-
- /**
- * Dummy constructor; passes upper stream a dummy stream;
- **/
- public IIOPInputStream()
- throws java.io.IOException {
- super();
- resetStream();
- }
-
- final void setOrbStream(org.omg.CORBA_2_3.portable.InputStream os) {
- orbStream = os;
- }
-
- final org.omg.CORBA_2_3.portable.InputStream getOrbStream() {
- return orbStream;
- }
-
- //added setSender and getSender
- public final void setSender(CodeBase cb) {
- cbSender = cb;
- }
-
- public final CodeBase getSender() {
- return cbSender;
- }
-
- // 4365188 this is added to enable backward compatability w/ wrong
- // rep-ids
- public final void setValueHandler(ValueHandler vh) {
- vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
- }
-
- public final ValueHandler getValueHandler() {
- return (javax.rmi.CORBA.ValueHandler) vhandler;
- }
-
- final void increaseRecursionDepth(){
- recursionDepth++;
- }
-
- final int decreaseRecursionDepth(){
- return --recursionDepth;
- }
-
- /**
- * Override the actions of the final method "readObject()"
- * in ObjectInputStream.
- * @since JDK1.1.6
- *
- * Read an object from the ObjectInputStream.
- * The class of the object, the signature of the class, and the values
- * of the non-transient and non-static fields of the class and all
- * of its supertypes are read. Default deserializing for a class can be
- * overriden using the writeObject and readObject methods.
- * Objects referenced by this object are read transitively so
- * that a complete equivalent graph of objects is reconstructed by readObject. <p>
- *
- * The root object is completly restored when all of its fields
- * and the objects it references are completely restored. At this
- * point the object validation callbacks are executed in order
- * based on their registered priorities. The callbacks are
- * registered by objects (in the readObject special methods)
- * as they are individually restored.
- *
- * Exceptions are thrown for problems with the InputStream and for classes
- * that should not be deserialized. All exceptions are fatal to the
- * InputStream and leave it in an indeterminate state; it is up to the caller
- * to ignore or recover the stream state.
- * @exception java.lang.ClassNotFoundException Class of a serialized object
- * cannot be found.
- * @exception InvalidClassException Something is wrong with a class used by
- * serialization.
- * @exception StreamCorruptedException Control information in the
- * stream is inconsistent.
- * @exception OptionalDataException Primitive data was found in the
- * stream instead of objects.
- * @exception IOException Any of the usual Input/Output related exceptions.
- * @since JDK1.1
- */
- public final synchronized Object readObjectDelegate() throws IOException
- {
- try {
-
- readObjectState.readData(this);
-
- return orbStream.read_abstract_interface();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, true);
- throw marshalException;
- } catch(IndirectionException cdrie)
- {
- // The CDR stream had never seen the given offset before,
- // so check the recursion manager (it will throw an
- // IOException if it doesn't have a reference, either).
- return activeRecursionMgr.getObject(cdrie.offset);
- }
- }
-
- final synchronized Object simpleReadObject(Class clz,
- String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender,
- int offset)
- /* throws OptionalDataException, ClassNotFoundException, IOException */
- {
-
- /* Save the current state and get ready to read an object. */
- Object prevObject = currentObject;
- ObjectStreamClass prevClassDesc = currentClassDesc;
- Class prevClass = currentClass;
- byte oldStreamFormatVersion = streamFormatVersion;
-
- simpleReadDepth++; // Entering
- Object obj = null;
-
- /*
- * Check for reset, handle it before reading an object.
- */
- try {
- // d4365188: backward compatability
- if (vhandler.useFullValueDescription(clz, repositoryID)) {
- obj = inputObjectUsingFVD(clz, repositoryID, sender, offset);
- } else {
- obj = inputObject(clz, repositoryID, sender, offset);
- }
-
- obj = currentClassDesc.readResolve(obj);
- }
- catch(ClassNotFoundException cnfe)
- {
- bridge.throwException( cnfe ) ;
- return null;
- }
- catch(IOException ioe)
- {
- // System.out.println("CLZ = " + clz + "; " + ioe.toString());
- bridge.throwException(ioe) ;
- return null;
- }
- finally {
- simpleReadDepth --;
- currentObject = prevObject;
- currentClassDesc = prevClassDesc;
- currentClass = prevClass;
- streamFormatVersion = oldStreamFormatVersion;
- }
-
-
- /* Check for thrown exceptions and re-throw them, clearing them if
- * this is the last recursive call .
- */
- IOException exIOE = abortIOException;
- if (simpleReadDepth == 0)
- abortIOException = null;
- if (exIOE != null){
- bridge.throwException( exIOE ) ;
- return null;
- }
-
-
- ClassNotFoundException exCNF = abortClassNotFoundException;
- if (simpleReadDepth == 0)
- abortClassNotFoundException = null;
- if (exCNF != null) {
- bridge.throwException( exCNF ) ;
- return null;
- }
-
- return obj;
- }
-
- public final synchronized void simpleSkipObject(String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender)
- /* throws OptionalDataException, ClassNotFoundException, IOException */
- {
-
- /* Save the current state and get ready to read an object. */
- Object prevObject = currentObject;
- ObjectStreamClass prevClassDesc = currentClassDesc;
- Class prevClass = currentClass;
- byte oldStreamFormatVersion = streamFormatVersion;
-
- simpleReadDepth++; // Entering
- Object obj = null;
-
- /*
- * Check for reset, handle it before reading an object.
- */
- try {
- skipObjectUsingFVD(repositoryID, sender);
- }
- catch(ClassNotFoundException cnfe)
- {
- bridge.throwException( cnfe ) ;
- return;
- }
- catch(IOException ioe)
- {
- bridge.throwException( ioe ) ;
- return;
- }
- finally {
- simpleReadDepth --;
- streamFormatVersion = oldStreamFormatVersion;
- currentObject = prevObject;
- currentClassDesc = prevClassDesc;
- currentClass = prevClass;
- }
-
-
- /* Check for thrown exceptions and re-throw them, clearing them if
- * this is the last recursive call .
- */
- IOException exIOE = abortIOException;
- if (simpleReadDepth == 0)
- abortIOException = null;
- if (exIOE != null){
- bridge.throwException( exIOE ) ;
- return;
- }
-
-
- ClassNotFoundException exCNF = abortClassNotFoundException;
- if (simpleReadDepth == 0)
- abortClassNotFoundException = null;
- if (exCNF != null) {
- bridge.throwException( exCNF ) ;
- return;
- }
-
- return;
- }
- /////////////////
-
- /**
- * This method is called by trusted subclasses of ObjectOutputStream
- * that constructed ObjectOutputStream using the
- * protected no-arg constructor. The subclass is expected to provide
- * an override method with the modifier "final".
- *
- * @return the Object read from the stream.
- *
- * @see #ObjectInputStream()
- * @see #readObject
- * @since JDK 1.2
- */
- protected final Object readObjectOverride()
- throws OptionalDataException, ClassNotFoundException, IOException
- {
- return readObjectDelegate();
- }
-
- /**
- * Override the actions of the final method "defaultReadObject()"
- * in ObjectInputStream.
- * @since JDK1.1.6
- *
- * Read the non-static and non-transient fields of the current class
- * from this stream. This may only be called from the readObject method
- * of the class being deserialized. It will throw the NotActiveException
- * if it is called otherwise.
- *
- * @exception java.lang.ClassNotFoundException if the class of a serialized
- * object could not be found.
- * @exception IOException if an I/O error occurs.
- * @exception NotActiveException if the stream is not currently reading
- * objects.
- * @since JDK1.1
- */
- final synchronized void defaultReadObjectDelegate()
- /* throws IOException, ClassNotFoundException, NotActiveException */
- {
- try {
- if (currentObject == null || currentClassDesc == null)
- // XXX I18N, logging needed.
- throw new NotActiveException("defaultReadObjectDelegate");
-
- if (!currentClassDesc.forClass().isAssignableFrom(
- currentObject.getClass())) {
- throw new IOException("Object Type mismatch");
- }
-
- // The array will be null unless fields were retrieved
- // remotely because of a serializable version difference.
- // Bug fix for 4365188. See the definition of
- // defaultReadObjectFVDMembers for more information.
- if (defaultReadObjectFVDMembers != null &&
- defaultReadObjectFVDMembers.length > 0) {
-
- // WARNING: Be very careful! What if some of
- // these fields actually have to do this, too?
- // This works because the defaultReadObjectFVDMembers
- // reference is passed to inputClassFields, but
- // there is no guarantee that
- // defaultReadObjectFVDMembers will point to the
- // same array after calling inputClassFields.
-
- // Use the remote fields to unmarshal.
- inputClassFields(currentObject,
- currentClass,
- currentClassDesc,
- defaultReadObjectFVDMembers,
- cbSender);
-
- } else {
-
- // Use the local fields to unmarshal.
- ObjectStreamField[] fields =
- currentClassDesc.getFieldsNoCopy();
- if (fields.length > 0) {
- inputClassFields(currentObject, currentClass, fields, cbSender);
- }
- }
- }
- catch(NotActiveException nae)
- {
- bridge.throwException( nae ) ;
- }
- catch(IOException ioe)
- {
- bridge.throwException( ioe ) ;
- }
- catch(ClassNotFoundException cnfe)
- {
- bridge.throwException( cnfe ) ;
- }
-
- }
-
- /**
- * Override the actions of the final method "enableResolveObject()"
- * in ObjectInputStream.
- * @since JDK1.1.6
- *
- * Enable the stream to allow objects read from the stream to be replaced.
- * If the stream is a trusted class it is allowed to enable replacment.
- * Trusted classes are those classes with a classLoader equals null. <p>
- *
- * When enabled the resolveObject method is called for every object
- * being deserialized.
- *
- * @exception SecurityException The classloader of this stream object is non-null.
- * @since JDK1.1
- */
- public final boolean enableResolveObjectDelegate(boolean enable)
- /* throws SecurityException */
- {
- return false;
- }
-
- // The following three methods allow the implementing orbStream
- // to provide mark/reset behavior as defined in java.io.InputStream.
-
- public final void mark(int readAheadLimit) {
- orbStream.mark(readAheadLimit);
- }
-
- public final boolean markSupported() {
- return orbStream.markSupported();
- }
-
- public final void reset() throws IOException {
- try {
- orbStream.reset();
- } catch (Error e) {
- IOException err = new IOException(e.getMessage());
- err.initCause(e) ;
- throw err ;
- }
- }
-
- public final int available() throws IOException{
- return 0; // unreliable
- }
-
- public final void close() throws IOException{
- // no op
- }
-
- public final int read() throws IOException{
- try{
- readObjectState.readData(this);
-
- return (orbStream.read_octet() << 0) & 0x000000FF;
- } catch (MARSHAL marshalException) {
- if (marshalException.minor
- == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) {
- setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);
- return -1;
- }
-
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e) ;
- throw exc ;
- }
- }
-
- public final int read(byte data[], int offset, int length) throws IOException{
- try{
- readObjectState.readData(this);
-
- orbStream.read_octet_array(data, offset, length);
- return length;
- } catch (MARSHAL marshalException) {
- if (marshalException.minor
- == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) {
- setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);
- return -1;
- }
-
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e) ;
- throw exc ;
- }
-
- }
-
- public final boolean readBoolean() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_boolean();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
-
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final byte readByte() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_octet();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
-
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final char readChar() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_wchar();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
-
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final double readDouble() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_double();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final float readFloat() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_float();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final void readFully(byte data[]) throws IOException{
-// d11623 : implement readFully, required for serializing some core classes
-
- readFully(data, 0, data.length);
- }
-
- public final void readFully(byte data[], int offset, int size) throws IOException{
-// d11623 : implement readFully, required for serializing some core classes
- try{
- readObjectState.readData(this);
-
- orbStream.read_octet_array(data, offset, size);
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
-
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final int readInt() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_long();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final String readLine() throws IOException{
- // XXX I18N, logging needed.
- throw new IOException("Method readLine not supported");
- }
-
- public final long readLong() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_longlong();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final short readShort() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_short();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- protected final void readStreamHeader() throws IOException, StreamCorruptedException{
- // no op
- }
-
- public final int readUnsignedByte() throws IOException{
- try{
- readObjectState.readData(this);
-
- return (orbStream.read_octet() << 0) & 0x000000FF;
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final int readUnsignedShort() throws IOException{
- try{
- readObjectState.readData(this);
-
- return (orbStream.read_ushort() << 0) & 0x0000FFFF;
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- /**
- * Helper method for correcting the Kestrel bug 4367783 (dealing
- * with larger than 8-bit chars). The old behavior is preserved
- * in orbutil.IIOPInputStream_1_3 in order to interoperate with
- * our legacy ORBs.
- */
- protected String internalReadUTF(org.omg.CORBA.portable.InputStream stream)
- {
- return stream.read_wstring();
- }
-
- public final String readUTF() throws IOException{
- try{
- readObjectState.readData(this);
-
- return internalReadUTF(orbStream);
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- // If the ORB stream detects an incompatibility between what's
- // on the wire and what our Serializable's readObject wants,
- // it throws a MARSHAL exception with a specific minor code.
- // This is rethrown to the readObject as an OptionalDataException.
- // So far in RMI-IIOP, this process isn't specific enough to
- // tell the readObject how much data is available, so we always
- // set the OptionalDataException's EOF marker to true.
- private void handleOptionalDataMarshalException(MARSHAL marshalException,
- boolean objectRead)
- throws IOException {
-
- // Java Object Serialization spec 3.4: "If the readObject method
- // of the class attempts to read more data than is present in the
- // optional part of the stream for this class, the stream will
- // return -1 for bytewise reads, throw an EOFException for
- // primitive data reads, or throw an OptionalDataException
- // with the eof field set to true for object reads."
- if (marshalException.minor
- == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) {
-
- IOException result;
-
- if (!objectRead)
- result = new EOFException("No more optional data");
- else
- result = createOptionalDataException();
-
- result.initCause(marshalException);
-
- setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);
-
- throw result;
- }
- }
-
- public final synchronized void registerValidation(ObjectInputValidation obj,
- int prio)
- throws NotActiveException, InvalidObjectException{
- // XXX I18N, logging needed.
- throw new Error("Method registerValidation not supported");
- }
-
- protected final Class resolveClass(ObjectStreamClass v)
- throws IOException, ClassNotFoundException{
- // XXX I18N, logging needed.
- throw new IOException("Method resolveClass not supported");
- }
-
- protected final Object resolveObject(Object obj) throws IOException{
- // XXX I18N, logging needed.
- throw new IOException("Method resolveObject not supported");
- }
-
- public final int skipBytes(int len) throws IOException{
- try{
- readObjectState.readData(this);
-
- byte buf[] = new byte[len];
- orbStream.read_octet_array(buf, 0, len);
- return len;
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
-
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e) ;
- throw exc ;
- }
- }
-
- private synchronized Object inputObject(Class clz,
- String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender,
- int offset)
- throws IOException, ClassNotFoundException
- {
-
- /*
- * Get the descriptor and then class of the incoming object.
- */
-
- currentClassDesc = ObjectStreamClass.lookup(clz);
- currentClass = currentClassDesc.forClass();
- //currentClassDesc.setClass(currentClass);
- if (currentClass == null)
- // XXX I18N, logging needed.
- throw new ClassNotFoundException(currentClassDesc.getName());
-
- try {
- /* If Externalizable,
- * Create an instance and tell it to read its data.
- * else,
- * Handle it as a serializable class.
- */
- if (Enum.class.isAssignableFrom( clz )) {
- int ordinal = orbStream.read_long() ;
- String value = (String)orbStream.read_value( String.class ) ;
- return Enum.valueOf( clz, value ) ;
- } else if (currentClassDesc.isExternalizable()) {
- try {
- currentObject = (currentClass == null) ?
- null : currentClassDesc.newInstance();
- if (currentObject != null) {
-
- // Store this object and its beginning position
- // since there might be indirections to it while
- // it's been unmarshalled.
- activeRecursionMgr.addObject(offset, currentObject);
-
- // Read format version
- readFormatVersion();
-
- Externalizable ext = (Externalizable)currentObject;
- ext.readExternal(this);
- }
- } catch (InvocationTargetException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InvocationTargetException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (UnsupportedOperationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "UnsupportedOperationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (InstantiationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InstantiationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- }
- } // end : if (currentClassDesc.isExternalizable())
- else {
- /* Count number of classes and descriptors we might have
- * to work on.
- */
-
- ObjectStreamClass currdesc = currentClassDesc;
- Class currclass = currentClass;
-
- int spBase = spClass; // current top of stack
-
- if (currentClass.getName().equals("java.lang.String")) {
- return this.readUTF();
- }
- /* The object's classes should be processed from supertype to subtype
- * Push all the clases of the current object onto a stack.
- * Note that only the serializable classes are represented
- * in the descriptor list.
- *
- * Handle versioning where one or more supertypes of
- * have been inserted or removed. The stack will
- * contain pairs of descriptors and the corresponding
- * class. If the object has a class that did not occur in
- * the original the descriptor will be null. If the
- * original object had a descriptor for a class not
- * present in the local hierarchy of the object the class will be
- * null.
- *
- */
-
- /*
- * This is your basic diff pattern, made simpler
- * because reordering is not allowed.
- */
- // sun.4296963 ibm.11861
- // d11861 we should stop when we find the highest serializable class
- // We need this so that when we allocate the new object below, we
- // can call the constructor of the non-serializable superclass.
- // Note that in the JRMP variant of this code the
- // ObjectStreamClass.lookup() method handles this, but we've put
- // this fix here rather than change lookup because the new behaviour
- // is needed in other cases.
-
- for (currdesc = currentClassDesc, currclass = currentClass;
- currdesc != null && currdesc.isSerializable(); /*sun.4296963 ibm.11861*/
- currdesc = currdesc.getSuperclass()) {
-
- /*
- * Search the classes to see if the class of this
- * descriptor appears further up the hierarchy. Until
- * it's found assume its an inserted class. If it's
- * not found, its the descriptor's class that has been
- * removed.
- */
- Class cc = currdesc.forClass();
- Class cl;
- for (cl = currclass; cl != null; cl = cl.getSuperclass()) {
- if (cc == cl) {
- // found a superclass that matches this descriptor
- break;
- } else {
- /* Ignore a class that doesn't match. No
- * action is needed since it is already
- * initialized.
- */
- }
- } // end : for (cl = currclass; cl != null; cl = cl.getSuperclass())
- /* Test if there is room for this new entry.
- * If not, double the size of the arrays and copy the contents.
- */
- spClass++;
- if (spClass >= classes.length) {
- int newlen = classes.length * 2;
- Class[] newclasses = new Class[newlen];
- ObjectStreamClass[] newclassdesc = new ObjectStreamClass[newlen];
-
- System.arraycopy(classes, 0,
- newclasses, 0,
- classes.length);
- System.arraycopy(classdesc, 0,
- newclassdesc, 0,
- classes.length);
-
- classes = newclasses;
- classdesc = newclassdesc;
- }
-
- if (cl == null) {
- /* Class not found corresponding to this descriptor.
- * Pop off all the extra classes pushed.
- * Push the descriptor and a null class.
- */
- classdesc[spClass] = currdesc;
- classes[spClass] = null;
- } else {
- /* Current class descriptor matches current class.
- * Some classes may have been inserted.
- * Record the match and advance the class, continue
- * with the next descriptor.
- */
- classdesc[spClass] = currdesc;
- classes[spClass] = cl;
- currclass = cl.getSuperclass();
- }
- } // end : for (currdesc = currentClassDesc, currclass = currentClass;
-
- /* Allocate a new object. The object is only constructed
- * above the highest serializable class and is set to
- * default values for all more specialized classes.
- */
- try {
- currentObject = (currentClass == null) ?
- null : currentClassDesc.newInstance() ;
-
- // Store this object and its beginning position
- // since there might be indirections to it while
- // it's been unmarshalled.
- activeRecursionMgr.addObject(offset, currentObject);
- } catch (InvocationTargetException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InvocationTargetException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (UnsupportedOperationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "UnsupportedOperationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (InstantiationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InstantiationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- }
-
- /*
- * For all the pushed descriptors and classes.
- * if the class has its own writeObject and readObject methods
- * call the readObject method
- * else
- * invoke the defaultReadObject method
- */
- try {
- for (spClass = spClass; spClass > spBase; spClass--) {
- /*
- * Set current descriptor and corresponding class
- */
- currentClassDesc = classdesc[spClass];
- currentClass = classes[spClass];
- if (classes[spClass] != null) {
- /* Read the data from the stream described by the
- * descriptor and store into the matching class.
- */
-
- ReadObjectState oldState = readObjectState;
- setState(DEFAULT_STATE);
-
- try {
-
- // Changed since invokeObjectReader no longer does this.
- if (currentClassDesc.hasWriteObject()) {
-
- // Read format version
- readFormatVersion();
-
- // Read defaultWriteObject indicator
- boolean calledDefaultWriteObject = readBoolean();
-
- readObjectState.beginUnmarshalCustomValue(this,
- calledDefaultWriteObject,
- (currentClassDesc.readObjectMethod
- != null));
- } else {
- if (currentClassDesc.hasReadObject())
- setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED);
- }
-
- if (!invokeObjectReader(currentClassDesc, currentObject, currentClass) ||
- readObjectState == IN_READ_OBJECT_DEFAULTS_SENT) {
-
- // Error case of no readObject and didn't call
- // defaultWriteObject handled in default state
-
- ObjectStreamField[] fields =
- currentClassDesc.getFieldsNoCopy();
- if (fields.length > 0) {
- inputClassFields(currentObject, currentClass, fields, sender);
- }
- }
-
- if (currentClassDesc.hasWriteObject())
- readObjectState.endUnmarshalCustomValue(this);
-
- } finally {
- setState(oldState);
- }
-
- } else {
-
- // _REVISIT_ : Can we ever get here?
- /* No local class for this descriptor,
- * Skip over the data for this class.
- * like defaultReadObject with a null currentObject.
- * The code will read the values but discard them.
- */
- ObjectStreamField[] fields =
- currentClassDesc.getFieldsNoCopy();
- if (fields.length > 0) {
- inputClassFields(null, currentClass, fields, sender);
- }
-
- }
-
- }
- } finally {
- // Make sure we exit at the same stack level as when we started.
- spClass = spBase;
- }
- }
- } finally {
- // We've completed deserializing this object. Any
- // future indirections will be handled correctly at the
- // CDR level. The ActiveRecursionManager only deals with
- // objects currently being deserialized.
- activeRecursionMgr.removeObject(offset);
- }
-
- return currentObject;
- }
-
- // This retrieves a vector of FVD's for the hierarchy of serializable classes stemming from
- // repositoryID. It is assumed that the sender will not provide base_value id's for non-serializable
- // classes!
- private Vector getOrderedDescriptions(String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender) {
- Vector descs = new Vector();
-
- if (sender == null) {
- return descs;
- }
-
- FullValueDescription aFVD = sender.meta(repositoryID);
- while (aFVD != null) {
- descs.insertElementAt(aFVD, 0);
- if ((aFVD.base_value != null) && !kEmptyStr.equals(aFVD.base_value)) {
- aFVD = sender.meta(aFVD.base_value);
- }
- else return descs;
- }
-
- return descs;
- }
-
- /**
- * This input method uses FullValueDescriptions retrieved from the sender's runtime to
- * read in the data. This method is capable of throwing out data not applicable to client's fields.
- * This method handles instances where the reader has a class not sent by the sender, the sender sent
- * a class not present on the reader, and/or the reader's class does not match the sender's class.
- *
- * NOTE : If the local description indicates custom marshaling and the remote type's FVD also
- * indicates custom marsahling than the local type is used to read the data off the wire. However,
- * if either says custom while the other does not, a MARSHAL error is thrown. Externalizable is
- * a form of custom marshaling.
- *
- */
- private synchronized Object inputObjectUsingFVD(Class clz,
- String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender,
- int offset)
- throws IOException, ClassNotFoundException
- {
- int spBase = spClass; // current top of stack
- try{
-
- /*
- * Get the descriptor and then class of the incoming object.
- */
-
- ObjectStreamClass currdesc = currentClassDesc = ObjectStreamClass.lookup(clz);
- Class currclass = currentClass = clz;
-
- /* If Externalizable,
- * Create an instance and tell it to read its data.
- * else,
- * Handle it as a serializable class.
- */
- if (currentClassDesc.isExternalizable()) {
- try {
- currentObject = (currentClass == null) ?
- null : currentClassDesc.newInstance();
- if (currentObject != null) {
- // Store this object and its beginning position
- // since there might be indirections to it while
- // it's been unmarshalled.
- activeRecursionMgr.addObject(offset, currentObject);
-
- // Read format version
- readFormatVersion();
-
- Externalizable ext = (Externalizable)currentObject;
- ext.readExternal(this);
- }
- } catch (InvocationTargetException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InvocationTargetException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (UnsupportedOperationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "UnsupportedOperationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (InstantiationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InstantiationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- }
- } else {
- /*
- * This is your basic diff pattern, made simpler
- * because reordering is not allowed.
- */
- for (currdesc = currentClassDesc, currclass = currentClass;
- currdesc != null && currdesc.isSerializable(); /*sun.4296963 ibm.11861*/
-
- currdesc = currdesc.getSuperclass()) {
-
- /*
- * Search the classes to see if the class of this
- * descriptor appears further up the hierarchy. Until
- * it's found assume its an inserted class. If it's
- * not found, its the descriptor's class that has been
- * removed.
- */
- Class cc = currdesc.forClass();
- Class cl;
- for (cl = currclass; cl != null; cl = cl.getSuperclass()) {
- if (cc == cl) {
- // found a superclass that matches this descriptor
- break;
- } else {
- /* Ignore a class that doesn't match. No
- * action is needed since it is already
- * initialized.
- */
- }
- } // end : for (cl = currclass; cl != null; cl = cl.getSuperclass())
- /* Test if there is room for this new entry.
- * If not, double the size of the arrays and copy the contents.
- */
- spClass++;
- if (spClass >= classes.length) {
- int newlen = classes.length * 2;
- Class[] newclasses = new Class[newlen];
- ObjectStreamClass[] newclassdesc = new ObjectStreamClass[newlen];
-
- System.arraycopy(classes, 0,
- newclasses, 0,
- classes.length);
- System.arraycopy(classdesc, 0,
- newclassdesc, 0,
- classes.length);
-
- classes = newclasses;
- classdesc = newclassdesc;
- }
-
- if (cl == null) {
- /* Class not found corresponding to this descriptor.
- * Pop off all the extra classes pushed.
- * Push the descriptor and a null class.
- */
- classdesc[spClass] = currdesc;
- classes[spClass] = null;
- } else {
- /* Current class descriptor matches current class.
- * Some classes may have been inserted.
- * Record the match and advance the class, continue
- * with the next descriptor.
- */
- classdesc[spClass] = currdesc;
- classes[spClass] = cl;
- currclass = cl.getSuperclass();
- }
- } // end : for (currdesc = currentClassDesc, currclass = currentClass;
-
- /* Allocate a new object.
- */
- try {
- currentObject = (currentClass == null) ?
- null : currentClassDesc.newInstance();
-
- // Store this object and its beginning position
- // since there might be indirections to it while
- // it's been unmarshalled.
- activeRecursionMgr.addObject(offset, currentObject);
- } catch (InvocationTargetException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InvocationTargetException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (UnsupportedOperationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "UnsupportedOperationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (InstantiationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InstantiationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- }
-
- Enumeration fvdsList = getOrderedDescriptions(repositoryID, sender).elements();
-
- while((fvdsList.hasMoreElements()) && (spClass > spBase)) {
- FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement();
- // d4365188: backward compatability
- String repIDForFVD = vhandler.getClassName(fvd.id);
- String repIDForClass = vhandler.getClassName(vhandler.getRMIRepositoryID(currentClass));
-
- while ((spClass > spBase) &&
- (!repIDForFVD.equals(repIDForClass))) {
- int pos = findNextClass(repIDForFVD, classes, spClass, spBase);
- if (pos != -1) {
- spClass = pos;
- currclass = currentClass = classes[spClass];
- repIDForClass = vhandler.getClassName(vhandler.getRMIRepositoryID(currentClass));
- }
- else { // Read and throw away one level of the fvdslist
-
- // This seems to mean that the sender had a superclass that
- // we don't have
-
- if (fvd.is_custom) {
-
- readFormatVersion();
- boolean calledDefaultWriteObject = readBoolean();
-
- if (calledDefaultWriteObject)
- inputClassFields(null, null, null, fvd.members, sender);
-
- if (getStreamFormatVersion() == 2) {
-
- ((ValueInputStream)getOrbStream()).start_value();
- ((ValueInputStream)getOrbStream()).end_value();
- }
-
- // WARNING: If stream format version is 1 and there's
- // optional data, we'll get some form of exception down
- // the line or data corruption.
-
- } else {
-
- inputClassFields(null, currentClass, null, fvd.members, sender);
- }
-
- if (fvdsList.hasMoreElements()){
- fvd = (FullValueDescription)fvdsList.nextElement();
- repIDForFVD = vhandler.getClassName(fvd.id);
- }
- else return currentObject;
- }
- }
-
- currdesc = currentClassDesc = ObjectStreamClass.lookup(currentClass);
-
- if (!repIDForClass.equals("java.lang.Object")) {
-
- // If the sender used custom marshaling, then it should have put
- // the two bytes on the wire indicating stream format version
- // and whether or not the writeObject method called
- // defaultWriteObject/writeFields.
-
- ReadObjectState oldState = readObjectState;
- setState(DEFAULT_STATE);
-
- try {
-
- if (fvd.is_custom) {
-
- // Read format version
- readFormatVersion();
-
- // Read defaultWriteObject indicator
- boolean calledDefaultWriteObject = readBoolean();
-
- readObjectState.beginUnmarshalCustomValue(this,
- calledDefaultWriteObject,
- (currentClassDesc.readObjectMethod
- != null));
- }
-
- boolean usedReadObject = false;
-
- // Always use readObject if it exists, and fall back to default
- // unmarshaling if it doesn't.
- try {
-
- if (!fvd.is_custom && currentClassDesc.hasReadObject())
- setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED);
-
- // See the definition of defaultReadObjectFVDMembers
- // for more information. This concerns making sure
- // we use the remote FVD's members in defaultReadObject.
- defaultReadObjectFVDMembers = fvd.members;
- usedReadObject = invokeObjectReader(currentClassDesc,
- currentObject,
- currentClass);
-
- } finally {
- defaultReadObjectFVDMembers = null;
- }
-
- // Note that the !usedReadObject !calledDefaultWriteObject
- // case is handled by the beginUnmarshalCustomValue method
- // of the default state
- if (!usedReadObject || readObjectState == IN_READ_OBJECT_DEFAULTS_SENT)
- inputClassFields(currentObject, currentClass, currdesc, fvd.members, sender);
-
- if (fvd.is_custom)
- readObjectState.endUnmarshalCustomValue(this);
-
- } finally {
- setState(oldState);
- }
-
- currclass = currentClass = classes[--spClass];
-
- } else {
-
- // The remaining hierarchy of the local class does not match the sender's FVD.
- // So, use remaining FVDs to read data off wire. If any remaining FVDs indicate
- // custom marshaling, throw MARSHAL error.
- inputClassFields(null, currentClass, null, fvd.members, sender);
-
- while (fvdsList.hasMoreElements()){
- fvd = (FullValueDescription)fvdsList.nextElement();
-
- if (fvd.is_custom)
- skipCustomUsingFVD(fvd.members, sender);
- else
- inputClassFields(null, currentClass, null, fvd.members, sender);
- }
-
- }
-
- } // end : while(fvdsList.hasMoreElements())
- while (fvdsList.hasMoreElements()){
-
- FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement();
- if (fvd.is_custom)
- skipCustomUsingFVD(fvd.members, sender);
- else
- throwAwayData(fvd.members, sender);
- }
- }
-
- return currentObject;
- }
- finally {
- // Make sure we exit at the same stack level as when we started.
- spClass = spBase;
-
- // We've completed deserializing this object. Any
- // future indirections will be handled correctly at the
- // CDR level. The ActiveRecursionManager only deals with
- // objects currently being deserialized.
- activeRecursionMgr.removeObject(offset);
- }
-
- }
-
- /**
- * This input method uses FullValueDescriptions retrieved from the sender's runtime to
- * read in the data. This method is capable of throwing out data not applicable to client's fields.
- *
- * NOTE : If the local description indicates custom marshaling and the remote type's FVD also
- * indicates custom marsahling than the local type is used to read the data off the wire. However,
- * if either says custom while the other does not, a MARSHAL error is thrown. Externalizable is
- * a form of custom marshaling.
- *
- */
- private Object skipObjectUsingFVD(String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender)
- throws IOException, ClassNotFoundException
- {
-
- Enumeration fvdsList = getOrderedDescriptions(repositoryID, sender).elements();
-
- while(fvdsList.hasMoreElements()) {
- FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement();
- String repIDForFVD = vhandler.getClassName(fvd.id);
-
- if (!repIDForFVD.equals("java.lang.Object")) {
- if (fvd.is_custom) {
-
- readFormatVersion();
-
- boolean calledDefaultWriteObject = readBoolean();
-
- if (calledDefaultWriteObject)
- inputClassFields(null, null, null, fvd.members, sender);
-
- if (getStreamFormatVersion() == 2) {
-
- ((ValueInputStream)getOrbStream()).start_value();
- ((ValueInputStream)getOrbStream()).end_value();
- }
-
- // WARNING: If stream format version is 1 and there's
- // optional data, we'll get some form of exception down
- // the line.
-
- } else {
- // Use default marshaling
- inputClassFields(null, null, null, fvd.members, sender);
- }
- }
-
- } // end : while(fvdsList.hasMoreElements())
- return null;
-
- }
-
- ///////////////////
-
- private int findNextClass(String classname, Class classes[], int _spClass, int _spBase){
-
- for (int i = _spClass; i > _spBase; i--){
- if (classname.equals(classes[i].getName())) {
- return i;
- }
- }
-
- return -1;
- }
-
- /*
- * Invoke the readObject method if present. Assumes that in the case of custom
- * marshaling, the format version and defaultWriteObject indicator were already
- * removed.
- */
- private boolean invokeObjectReader(ObjectStreamClass osc, Object obj, Class aclass)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException
- {
- if (osc.readObjectMethod == null) {
- return false;
- }
-
- try {
- osc.readObjectMethod.invoke( obj, readObjectArgList ) ;
- return true;
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof ClassNotFoundException)
- throw (ClassNotFoundException)t;
- else if (t instanceof IOException)
- throw (IOException)t;
- else if (t instanceof RuntimeException)
- throw (RuntimeException) t;
- else if (t instanceof Error)
- throw (Error) t;
- else
- // XXX I18N, logging needed.
- throw new Error("internal error");
- } catch (IllegalAccessException e) {
- return false;
- }
- }
-
- /*
- * Reset the stream to be just like it was after the constructor.
- */
- private void resetStream() throws IOException {
-
- if (classes == null)
- classes = new Class[20];
- else {
- for (int i = 0; i < classes.length; i++)
- classes[i] = null;
- }
- if (classdesc == null)
- classdesc = new ObjectStreamClass[20];
- else {
- for (int i = 0; i < classdesc.length; i++)
- classdesc[i] = null;
- }
- spClass = 0;
-
- if (callbacks != null)
- callbacks.setSize(0); // discard any pending callbacks
- }
-
- /**
- * Factored out of inputClassFields This reads a primitive value and sets it
- * in the field of o described by the ObjectStreamField field.
- *
- * Note that reflection cannot be used here, because reflection cannot be used
- * to set final fields.
- */
- private void inputPrimitiveField(Object o, Class cl, ObjectStreamField field)
- throws InvalidClassException, IOException {
-
- try {
- switch (field.getTypeCode()) {
- case 'B':
- byte byteValue = orbStream.read_octet();
- if (field.getField() != null) {
- bridge.putByte( o, field.getFieldID(), byteValue ) ;
- //reflective code: field.getField().setByte( o, byteValue ) ;
- }
- break;
- case 'Z':
- boolean booleanValue = orbStream.read_boolean();
- if (field.getField() != null) {
- bridge.putBoolean( o, field.getFieldID(), booleanValue ) ;
- //reflective code: field.getField().setBoolean( o, booleanValue ) ;
- }
- break;
- case 'C':
- char charValue = orbStream.read_wchar();
- if (field.getField() != null) {
- bridge.putChar( o, field.getFieldID(), charValue ) ;
- //reflective code: field.getField().setChar( o, charValue ) ;
- }
- break;
- case 'S':
- short shortValue = orbStream.read_short();
- if (field.getField() != null) {
- bridge.putShort( o, field.getFieldID(), shortValue ) ;
- //reflective code: field.getField().setShort( o, shortValue ) ;
- }
- break;
- case 'I':
- int intValue = orbStream.read_long();
- if (field.getField() != null) {
- bridge.putInt( o, field.getFieldID(), intValue ) ;
- //reflective code: field.getField().setInt( o, intValue ) ;
- }
- break;
- case 'J':
- long longValue = orbStream.read_longlong();
- if (field.getField() != null) {
- bridge.putLong( o, field.getFieldID(), longValue ) ;
- //reflective code: field.getField().setLong( o, longValue ) ;
- }
- break;
- case 'F' :
- float floatValue = orbStream.read_float();
- if (field.getField() != null) {
- bridge.putFloat( o, field.getFieldID(), floatValue ) ;
- //reflective code: field.getField().setFloat( o, floatValue ) ;
- }
- break;
- case 'D' :
- double doubleValue = orbStream.read_double();
- if (field.getField() != null) {
- bridge.putDouble( o, field.getFieldID(), doubleValue ) ;
- //reflective code: field.getField().setDouble( o, doubleValue ) ;
- }
- break;
- default:
- // XXX I18N, logging needed.
- throw new InvalidClassException(cl.getName());
- }
- } catch (IllegalArgumentException e) {
- /* This case should never happen. If the field types
- are not the same, InvalidClassException is raised when
- matching the local class to the serialized ObjectStreamClass. */
- ClassCastException cce = new ClassCastException("Assigning instance of class " +
- field.getType().getName() +
- " to field " +
- currentClassDesc.getName() + '#' +
- field.getField().getName());
- cce.initCause( e ) ;
- throw cce ;
- }
- }
-
- private Object inputObjectField(org.omg.CORBA.ValueMember field,
- com.sun.org.omg.SendingContext.CodeBase sender)
- throws IndirectionException, ClassNotFoundException, IOException,
- StreamCorruptedException {
-
- Object objectValue = null;
- Class type = null;
- String id = field.id;
-
- try {
- type = vhandler.getClassFromType(id);
- } catch(ClassNotFoundException cnfe) {
- // Make sure type = null
- type = null;
- }
-
- String signature = null;
- if (type != null)
- signature = ValueUtility.getSignature(field);
-
- if (signature != null && (signature.equals("Ljava/lang/Object;") ||
- signature.equals("Ljava/io/Serializable;") ||
- signature.equals("Ljava/io/Externalizable;"))) {
- objectValue = javax.rmi.CORBA.Util.readAny(orbStream);
- } else {
- // Decide what method call to make based on the type. If
- // it is a type for which we need to load a stub, convert
- // the type to the correct stub type.
- //
- // NOTE : Since FullValueDescription does not allow us
- // to ask whether something is an interface we do not
- // have the ability to optimize this check.
-
- int callType = ValueHandlerImpl.kValueType;
-
- if (!vhandler.isSequence(id)) {
-
- if (field.type.kind().value() == kRemoteTypeCode.kind().value()) {
-
- // RMI Object reference...
- callType = ValueHandlerImpl.kRemoteType;
-
- } else {
-
- // REVISIT. If we don't have the local class,
- // we should probably verify that it's an RMI type,
- // query the remote FVD, and use is_abstract.
- // Our FVD seems to get NullPointerExceptions for any
- // non-RMI types.
-
- // This uses the local class in the same way as
- // inputObjectField(ObjectStreamField) does. REVISIT
- // inputObjectField(ObjectStreamField)'s loadStubClass
- // logic. Assumption is that the given type cannot
- // evolve to become a CORBA abstract interface or
- // a RMI abstract interface.
-
- if (type != null && type.isInterface() &&
- (vhandler.isAbstractBase(type) ||
- ObjectStreamClassCorbaExt.isAbstractInterface(type))) {
-
- callType = ValueHandlerImpl.kAbstractType;
- }
- }
- }
-
- // Now that we have used the FVD of the field to determine the proper course
- // of action, it is ok to use the type (Class) from this point forward since
- // the rep. id for this read will also follow on the wire.
-
- switch (callType) {
- case ValueHandlerImpl.kRemoteType:
- if (type != null)
- objectValue = Utility.readObjectAndNarrow(orbStream, type);
- else
- objectValue = orbStream.read_Object();
- break;
- case ValueHandlerImpl.kAbstractType:
- if (type != null)
- objectValue = Utility.readAbstractAndNarrow(orbStream, type);
- else
- objectValue = orbStream.read_abstract_interface();
- break;
- case ValueHandlerImpl.kValueType:
- if (type != null)
- objectValue = orbStream.read_value(type);
- else
- objectValue = orbStream.read_value();
- break;
- default:
- // XXX I18N, logging needed.
- throw new StreamCorruptedException("Unknown callType: " + callType);
- }
- }
-
- return objectValue;
- }
-
- /**
- * Factored out of inputClassFields and reused in
- * inputCurrentClassFieldsForReadFields.
- *
- * Reads the field (which of an Object type as opposed to a primitive)
- * described by ObjectStreamField field and returns it.
- */
- private Object inputObjectField(ObjectStreamField field)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IndirectionException, IOException {
-
- if (ObjectStreamClassCorbaExt.isAny(field.getTypeString())) {
- return javax.rmi.CORBA.Util.readAny(orbStream);
- }
-
- Object objectValue = null;
-
- // fields have an API to provide the actual class
- // corresponding to the data type
- // Class type = osc.forClass();
- Class fieldType = field.getType();
- Class actualType = fieldType; // This may change if stub loaded.
-
- // Decide what method call to make based on the fieldType. If
- // it is a type for which we need to load a stub, convert
- // the type to the correct stub type.
-
- int callType = ValueHandlerImpl.kValueType;
- boolean narrow = false;
-
- if (fieldType.isInterface()) {
- boolean loadStubClass = false;
-
- if (java.rmi.Remote.class.isAssignableFrom(fieldType)) {
-
- // RMI Object reference...
- callType = ValueHandlerImpl.kRemoteType;
-
- } else if (org.omg.CORBA.Object.class.isAssignableFrom(fieldType)){
-
- // IDL Object reference...
- callType = ValueHandlerImpl.kRemoteType;
- loadStubClass = true;
-
- } else if (vhandler.isAbstractBase(fieldType)) {
- // IDL Abstract Object reference...
-
- callType = ValueHandlerImpl.kAbstractType;
- loadStubClass = true;
- } else if (ObjectStreamClassCorbaExt.isAbstractInterface(fieldType)) {
- // RMI Abstract Object reference...
-
- callType = ValueHandlerImpl.kAbstractType;
- }
-
- if (loadStubClass) {
- try {
- String codebase = Util.getCodebase(fieldType);
- String repID = vhandler.createForAnyType(fieldType);
- Class stubType =
- Utility.loadStubClass(repID, codebase, fieldType);
- actualType = stubType;
- } catch (ClassNotFoundException e) {
- narrow = true;
- }
- } else {
- narrow = true;
- }
- }
-
- switch (callType) {
- case ValueHandlerImpl.kRemoteType:
- if (!narrow)
- objectValue = (Object)orbStream.read_Object(actualType);
- else
- objectValue = Utility.readObjectAndNarrow(orbStream, actualType);
- break;
- case ValueHandlerImpl.kAbstractType:
- if (!narrow)
- objectValue = (Object)orbStream.read_abstract_interface(actualType);
- else
- objectValue = Utility.readAbstractAndNarrow(orbStream, actualType);
- break;
- case ValueHandlerImpl.kValueType:
- objectValue = (Object)orbStream.read_value(actualType);
- break;
- default:
- // XXX I18N, logging needed.
- throw new StreamCorruptedException("Unknown callType: " + callType);
- }
-
- return objectValue;
- }
-
- private final boolean mustUseRemoteValueMembers() {
- return defaultReadObjectFVDMembers != null;
- }
-
- void readFields(java.util.Map fieldToValueMap)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException {
-
- if (mustUseRemoteValueMembers()) {
- inputRemoteMembersForReadFields(fieldToValueMap);
- } else
- inputCurrentClassFieldsForReadFields(fieldToValueMap);
- }
-
- private final void inputRemoteMembersForReadFields(java.util.Map fieldToValueMap)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException {
-
- // Must have this local variable since defaultReadObjectFVDMembers
- // may get mangled by recursion.
- ValueMember fields[] = defaultReadObjectFVDMembers;
-
- try {
-
- for (int i = 0; i < fields.length; i++) {
-
- switch (fields[i].type.kind().value()) {
-
- case TCKind._tk_octet:
- byte byteValue = orbStream.read_octet();
- fieldToValueMap.put(fields[i].name, new Byte(byteValue));
- break;
- case TCKind._tk_boolean:
- boolean booleanValue = orbStream.read_boolean();
- fieldToValueMap.put(fields[i].name, new Boolean(booleanValue));
- break;
- case TCKind._tk_char:
- // Backwards compatibility. Older Sun ORBs sent
- // _tk_char even though they read and wrote wchars
- // correctly.
- //
- // Fall through to the _tk_wchar case.
- case TCKind._tk_wchar:
- char charValue = orbStream.read_wchar();
- fieldToValueMap.put(fields[i].name, new Character(charValue));
- break;
- case TCKind._tk_short:
- short shortValue = orbStream.read_short();
- fieldToValueMap.put(fields[i].name, new Short(shortValue));
- break;
- case TCKind._tk_long:
- int intValue = orbStream.read_long();
- fieldToValueMap.put(fields[i].name, new Integer(intValue));
- break;
- case TCKind._tk_longlong:
- long longValue = orbStream.read_longlong();
- fieldToValueMap.put(fields[i].name, new Long(longValue));
- break;
- case TCKind._tk_float:
- float floatValue = orbStream.read_float();
- fieldToValueMap.put(fields[i].name, new Float(floatValue));
- break;
- case TCKind._tk_double:
- double doubleValue = orbStream.read_double();
- fieldToValueMap.put(fields[i].name, new Double(doubleValue));
- break;
- case TCKind._tk_value:
- case TCKind._tk_objref:
- case TCKind._tk_value_box:
- Object objectValue = null;
- try {
- objectValue = inputObjectField(fields[i],
- cbSender);
-
- } catch (IndirectionException cdrie) {
- // The CDR stream had never seen the given offset before,
- // so check the recursion manager (it will throw an
- // IOException if it doesn't have a reference, either).
- objectValue = activeRecursionMgr.getObject(cdrie.offset);
- }
-
- fieldToValueMap.put(fields[i].name, objectValue);
- break;
- default:
- // XXX I18N, logging needed.
- throw new StreamCorruptedException("Unknown kind: "
- + fields[i].type.kind().value());
- }
- }
- } catch (Throwable t) {
- StreamCorruptedException result = new StreamCorruptedException(t.getMessage());
- result.initCause(t);
- throw result;
- }
- }
-
- /**
- * Called from InputStreamHook.
- *
- * Reads the fields of the current class (could be the ones
- * queried from the remote FVD) and puts them in
- * the given Map, name to value. Wraps primitives in the
- * corresponding java.lang Objects.
- */
- private final void inputCurrentClassFieldsForReadFields(java.util.Map fieldToValueMap)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException {
-
- ObjectStreamField[] fields = currentClassDesc.getFieldsNoCopy();
-
- int primFields = fields.length - currentClassDesc.objFields;
-
- // Handle the primitives first
- for (int i = 0; i < primFields; ++i) {
-
- switch (fields[i].getTypeCode()) {
- case 'B':
- byte byteValue = orbStream.read_octet();
- fieldToValueMap.put(fields[i].getName(),
- new Byte(byteValue));
- break;
- case 'Z':
- boolean booleanValue = orbStream.read_boolean();
- fieldToValueMap.put(fields[i].getName(),
- new Boolean(booleanValue));
- break;
- case 'C':
- char charValue = orbStream.read_wchar();
- fieldToValueMap.put(fields[i].getName(),
- new Character(charValue));
- break;
- case 'S':
- short shortValue = orbStream.read_short();
- fieldToValueMap.put(fields[i].getName(),
- new Short(shortValue));
- break;
- case 'I':
- int intValue = orbStream.read_long();
- fieldToValueMap.put(fields[i].getName(),
- new Integer(intValue));
- break;
- case 'J':
- long longValue = orbStream.read_longlong();
- fieldToValueMap.put(fields[i].getName(),
- new Long(longValue));
- break;
- case 'F' :
- float floatValue = orbStream.read_float();
- fieldToValueMap.put(fields[i].getName(),
- new Float(floatValue));
- break;
- case 'D' :
- double doubleValue = orbStream.read_double();
- fieldToValueMap.put(fields[i].getName(),
- new Double(doubleValue));
- break;
- default:
- // XXX I18N, logging needed.
- throw new InvalidClassException(currentClassDesc.getName());
- }
- }
-
- /* Read and set object fields from the input stream. */
- if (currentClassDesc.objFields > 0) {
- for (int i = primFields; i < fields.length; i++) {
- Object objectValue = null;
- try {
- objectValue = inputObjectField(fields[i]);
- } catch(IndirectionException cdrie) {
- // The CDR stream had never seen the given offset before,
- // so check the recursion manager (it will throw an
- // IOException if it doesn't have a reference, either).
- objectValue = activeRecursionMgr.getObject(cdrie.offset);
- }
-
- fieldToValueMap.put(fields[i].getName(), objectValue);
- }
- }
- }
-
- /*
- * Read the fields of the specified class from the input stream and set
- * the values of the fields in the specified object. If the specified
- * object is null, just consume the fields without setting any values. If
- * any ObjectStreamField does not have a reflected Field, don't try to set
- * that field in the object.
- *
- * REVISIT -- This code doesn't do what the comment says to when
- * getField() is null!
- */
- private void inputClassFields(Object o, final Class<?> cl,
- ObjectStreamField[] fields,
- com.sun.org.omg.SendingContext.CodeBase sender)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException
- {
-
- int primFields = fields.length - currentClassDesc.objFields;
-
- if (o != null) {
- for (int i = 0; i < primFields; ++i) {
- inputPrimitiveField(o, cl, fields[i]);
- }
- }
-
- /* Read and set object fields from the input stream. */
- if (currentClassDesc.objFields > 0) {
- for (int i = primFields; i < fields.length; i++) {
- Object objectValue = null;
-
- try {
- objectValue = inputObjectField(fields[i]);
- } catch(IndirectionException cdrie) {
- // The CDR stream had never seen the given offset before,
- // so check the recursion manager (it will throw an
- // IOException if it doesn't have a reference, either).
- objectValue = activeRecursionMgr.getObject(cdrie.offset);
- }
-
- if ((o == null) || (fields[i].getField() == null)) {
- continue;
- }
-
- try {
- Class<?> fieldCl = fields[i].getClazz();
- if ((objectValue != null)
- && (!fieldCl.isAssignableFrom(
- objectValue.getClass()))) {
- throw new IllegalArgumentException("Field mismatch");
- }
- Field declaredClassField = null;
- final String inputStreamFieldName = fields[i].getName();
- try {
- declaredClassField = getDeclaredField( cl, inputStreamFieldName);
- } catch (PrivilegedActionException paEx) {
- throw new IllegalArgumentException(
- (NoSuchFieldException) paEx.getException());
- } catch (SecurityException secEx) {
- throw new IllegalArgumentException(secEx);
- } catch (NullPointerException npEx) {
- continue;
- } catch (NoSuchFieldException e) {
- continue;
- }
-
- if (declaredClassField == null) {
- continue;
- }
- Class<?> declaredFieldClass = declaredClassField.getType();
-
- // check input field type is a declared field type
- // input field is a subclass of the declared field
- if (!declaredFieldClass.isAssignableFrom(fieldCl)) {
- throw new IllegalArgumentException(
- "Field Type mismatch");
- }
- if (objectValue != null && !fieldCl.isInstance(objectValue)) {
- throw new IllegalArgumentException();
- }
- bridge.putObject( o, fields[i].getFieldID(), objectValue ) ;
- // reflective code: fields[i].getField().set( o, objectValue ) ;
- } catch (IllegalArgumentException iaEx) {
- String objectValueClassName = "null";
- String currentClassDescClassName = "null";
- String fieldName = "null";
- if (objectValue != null) {
- objectValueClassName = objectValue.getClass().getName();
- }
- if (currentClassDesc != null) {
- currentClassDescClassName = currentClassDesc.getName();
- }
- if (fields[i] != null && fields[i].getField() != null) {
- fieldName = fields[i].getField().getName();
- }
- ClassCastException ccEx = new ClassCastException(
- "Assigning instance of class " + objectValueClassName
- + " to field " + currentClassDescClassName + '#' + fieldName);
- ccEx.initCause( iaEx ) ;
- throw ccEx ;
- }
- } // end : for loop
- }
- }
-
- /*
- * Read the fields of the specified class from the input stream and set
- * the values of the fields in the specified object. If the specified
- * object is null, just consume the fields without setting any values. If
- * any ObjectStreamField does not have a reflected Field, don't try to set
- * that field in the object.
- */
- private void inputClassFields(Object o, Class cl,
- ObjectStreamClass osc,
- ValueMember[] fields,
- com.sun.org.omg.SendingContext.CodeBase sender)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException
- {
- try{
- for (int i = 0; i < fields.length; ++i) {
- try {
- switch (fields[i].type.kind().value()) {
- case TCKind._tk_octet:
- byte byteValue = orbStream.read_octet();
- if ((o != null) && osc.hasField(fields[i]))
- setByteField(o, cl, fields[i].name, byteValue);
- break;
- case TCKind._tk_boolean:
- boolean booleanValue = orbStream.read_boolean();
- if ((o != null) && osc.hasField(fields[i]))
- setBooleanField(o, cl, fields[i].name, booleanValue);
- break;
- case TCKind._tk_char:
- // Backwards compatibility. Older Sun ORBs sent
- // _tk_char even though they read and wrote wchars
- // correctly.
- //
- // Fall through to the _tk_wchar case.
- case TCKind._tk_wchar:
- char charValue = orbStream.read_wchar();
- if ((o != null) && osc.hasField(fields[i]))
- setCharField(o, cl, fields[i].name, charValue);
- break;
- case TCKind._tk_short:
- short shortValue = orbStream.read_short();
- if ((o != null) && osc.hasField(fields[i]))
- setShortField(o, cl, fields[i].name, shortValue);
- break;
- case TCKind._tk_long:
- int intValue = orbStream.read_long();
- if ((o != null) && osc.hasField(fields[i]))
- setIntField(o, cl, fields[i].name, intValue);
- break;
- case TCKind._tk_longlong:
- long longValue = orbStream.read_longlong();
- if ((o != null) && osc.hasField(fields[i]))
- setLongField(o, cl, fields[i].name, longValue);
- break;
- case TCKind._tk_float:
- float floatValue = orbStream.read_float();
- if ((o != null) && osc.hasField(fields[i]))
- setFloatField(o, cl, fields[i].name, floatValue);
- break;
- case TCKind._tk_double:
- double doubleValue = orbStream.read_double();
- if ((o != null) && osc.hasField(fields[i]))
- setDoubleField(o, cl, fields[i].name, doubleValue);
- break;
- case TCKind._tk_value:
- case TCKind._tk_objref:
- case TCKind._tk_value_box:
- Object objectValue = null;
- try {
- objectValue = inputObjectField(fields[i], sender);
- } catch (IndirectionException cdrie) {
- // The CDR stream had never seen the given offset before,
- // so check the recursion manager (it will throw an
- // IOException if it doesn't have a reference, either).
- objectValue = activeRecursionMgr.getObject(cdrie.offset);
- }
-
- if (o == null)
- continue;
- try {
- if (osc.hasField(fields[i])){
- setObjectField(o,
- cl,
- fields[i].name,
- objectValue);
- } else {
- // REVISIT. Convert to a log message.
- // This is a normal case when fields have
- // been added as part of evolution, but
- // silently skipping can make it hard to
- // debug if there's an error
-// System.out.println("**** warning, not setting field: "
-// + fields[i].name
-// + " since not on class "
-// + osc.getName());
-
- }
- } catch (IllegalArgumentException e) {
- // XXX I18N, logging needed.
- ClassCastException cce = new ClassCastException("Assigning instance of class " +
- objectValue.getClass().getName() + " to field " + fields[i].name);
- cce.initCause(e) ;
- throw cce ;
- }
- break;
- default:
- // XXX I18N, logging needed.
- throw new StreamCorruptedException("Unknown kind: "
- + fields[i].type.kind().value());
- }
- } catch (IllegalArgumentException e) {
- /* This case should never happen. If the field types
- are not the same, InvalidClassException is raised when
- matching the local class to the serialized ObjectStreamClass. */
- // XXX I18N, logging needed.
- ClassCastException cce = new ClassCastException("Assigning instance of class " + fields[i].id +
- " to field " + currentClassDesc.getName() + '#' + fields[i].name);
- cce.initCause( e ) ;
- throw cce ;
- }
- }
- } catch(Throwable t){
- // XXX I18N, logging needed.
- StreamCorruptedException sce = new StreamCorruptedException(t.getMessage());
- sce.initCause(t) ;
- throw sce ;
- }
- }
-
- private void skipCustomUsingFVD(ValueMember[] fields,
- com.sun.org.omg.SendingContext.CodeBase sender)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException
- {
- readFormatVersion();
- boolean calledDefaultWriteObject = readBoolean();
-
- if (calledDefaultWriteObject)
- throwAwayData(fields, sender);
-
- if (getStreamFormatVersion() == 2) {
-
- ((ValueInputStream)getOrbStream()).start_value();
- ((ValueInputStream)getOrbStream()).end_value();
- }
- }
-
- /*
- * Read the fields of the specified class from the input stream throw data away.
- * This must handle same switch logic as above.
- */
- private void throwAwayData(ValueMember[] fields,
- com.sun.org.omg.SendingContext.CodeBase sender)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException {
-
- for (int i = 0; i < fields.length; ++i) {
-
- try {
-
- switch (fields[i].type.kind().value()) {
- case TCKind._tk_octet:
- orbStream.read_octet();
- break;
- case TCKind._tk_boolean:
- orbStream.read_boolean();
- break;
- case TCKind._tk_char:
- // Backwards compatibility. Older Sun ORBs sent
- // _tk_char even though they read and wrote wchars
- // correctly.
- //
- // Fall through to the _tk_wchar case.
- case TCKind._tk_wchar:
- orbStream.read_wchar();
- break;
- case TCKind._tk_short:
- orbStream.read_short();
- break;
- case TCKind._tk_long:
- orbStream.read_long();
- break;
- case TCKind._tk_longlong:
- orbStream.read_longlong();
- break;
- case TCKind._tk_float:
- orbStream.read_float();
- break;
- case TCKind._tk_double:
- orbStream.read_double();
- break;
- case TCKind._tk_value:
- case TCKind._tk_objref:
- case TCKind._tk_value_box:
- Class type = null;
- String id = fields[i].id;
-
- try {
- type = vhandler.getClassFromType(id);
- }
- catch(ClassNotFoundException cnfe){
- // Make sure type = null
- type = null;
- }
- String signature = null;
- if (type != null)
- signature = ValueUtility.getSignature(fields[i]);
-
- // Read value
- try {
- if ((signature != null) && ( signature.equals("Ljava/lang/Object;") ||
- signature.equals("Ljava/io/Serializable;") ||
- signature.equals("Ljava/io/Externalizable;")) ) {
- javax.rmi.CORBA.Util.readAny(orbStream);
- }
- else {
- // Decide what method call to make based on the type.
- //
- // NOTE : Since FullValueDescription does not allow us
- // to ask whether something is an interface we do not
- // have the ability to optimize this check.
-
- int callType = ValueHandlerImpl.kValueType;
-
- if (!vhandler.isSequence(id)) {
- FullValueDescription fieldFVD = sender.meta(fields[i].id);
- if (kRemoteTypeCode == fields[i].type) {
-
- // RMI Object reference...
- callType = ValueHandlerImpl.kRemoteType;
- } else if (fieldFVD.is_abstract) {
- // RMI Abstract Object reference...
-
- callType = ValueHandlerImpl.kAbstractType;
- }
- }
-
- // Now that we have used the FVD of the field to determine the proper course
- // of action, it is ok to use the type (Class) from this point forward since
- // the rep. id for this read will also follow on the wire.
-
- switch (callType) {
- case ValueHandlerImpl.kRemoteType:
- orbStream.read_Object();
- break;
- case ValueHandlerImpl.kAbstractType:
- orbStream.read_abstract_interface();
- break;
- case ValueHandlerImpl.kValueType:
- if (type != null) {
- orbStream.read_value(type);
- } else {
- orbStream.read_value();
- }
- break;
- default:
- // XXX I18N, logging needed.
- throw new StreamCorruptedException("Unknown callType: "
- + callType);
- }
- }
-
- }
- catch(IndirectionException cdrie) {
- // Since we are throwing this away, don't bother handling recursion.
- continue;
- }
-
- break;
- default:
- // XXX I18N, logging needed.
- throw new StreamCorruptedException("Unknown kind: "
- + fields[i].type.kind().value());
-
- }
- } catch (IllegalArgumentException e) {
- /* This case should never happen. If the field types
- are not the same, InvalidClassException is raised when
- matching the local class to the serialized ObjectStreamClass. */
- // XXX I18N, logging needed.
- ClassCastException cce = new ClassCastException("Assigning instance of class " +
- fields[i].id + " to field " + currentClassDesc.getName() +
- '#' + fields[i].name);
- cce.initCause(e) ;
- throw cce ;
- }
- }
-
- }
-
- private static void setObjectField(Object o, Class<?> c, String fieldName, Object v) {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- Class fieldCl = fld.getType();
- if(v != null && !fieldCl.isInstance(v)) {
- throw new Exception();
- }
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putObject( o, key, v ) ;
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetObjectField( e, fieldName,
- o.toString(),
- v.toString() ) ;
- } else {
- throw utilWrapper.errorSetObjectField( e, fieldName,
- "null " + c.getName() + " object",
- v.toString() ) ;
- }
- }
- }
-
- private static void setBooleanField(Object o, Class<?> c, String fieldName, boolean v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Boolean.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putBoolean( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetBooleanField( e, fieldName,
- o.toString(),
- new Boolean(v) ) ;
- } else {
- throw utilWrapper.errorSetBooleanField( e, fieldName,
- "null " + c.getName() + " object",
- new Boolean(v) ) ;
- }
- }
- }
-
- private static void setByteField(Object o, Class<?> c, String fieldName, byte v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Byte.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putByte( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetByteField( e, fieldName,
- o.toString(),
- new Byte(v) ) ;
- } else {
- throw utilWrapper.errorSetByteField( e, fieldName,
- "null " + c.getName() + " object",
- new Byte(v) ) ;
- }
- }
- }
-
- private static void setCharField(Object o, Class<?> c, String fieldName, char v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Character.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putChar( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetCharField( e, fieldName,
- o.toString(),
- new Character(v) ) ;
- } else {
- throw utilWrapper.errorSetCharField( e, fieldName,
- "null " + c.getName() + " object",
- new Character(v) ) ;
- }
- }
- }
-
- private static void setShortField(Object o, Class<?> c, String fieldName, short v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Short.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putShort( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetShortField( e, fieldName,
- o.toString(),
- new Short(v) ) ;
- } else {
- throw utilWrapper.errorSetShortField( e, fieldName,
- "null " + c.getName() + " object",
- new Short(v) ) ;
- }
- }
- }
-
- private static void setIntField(Object o, final Class<?> c, final String fieldName, int v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Integer.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putInt( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetIntField( e, fieldName,
- o.toString(),
- new Integer(v) ) ;
- } else {
- throw utilWrapper.errorSetIntField( e, fieldName,
- "null " + c.getName() + " object",
- new Integer(v) ) ;
- }
- }
- }
-
- private static void setLongField(Object o, Class<?> c, String fieldName, long v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Long.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putLong( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetLongField( e, fieldName,
- o.toString(),
- new Long(v) ) ;
- } else {
- throw utilWrapper.errorSetLongField( e, fieldName,
- "null " + c.getName() + " object",
- new Long(v) ) ;
- }
- }
- }
-
- private static void setFloatField(Object o, Class<?> c, String fieldName, float v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Float.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putFloat( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetFloatField( e, fieldName,
- o.toString(),
- new Float(v) ) ;
- } else {
- throw utilWrapper.errorSetFloatField( e, fieldName,
- "null " + c.getName() + " object",
- new Float(v) ) ;
- }
- }
- }
-
- private static void setDoubleField(Object o, Class<?> c, String fieldName, double v)
- {
- try {
- Field fld = getDeclaredField(c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Double.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putDouble( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetDoubleField( e, fieldName,
- o.toString(),
- new Double(v) ) ;
- } else {
- throw utilWrapper.errorSetDoubleField( e, fieldName,
- "null " + c.getName() + " object",
- new Double(v) ) ;
- }
- }
- }
-
-
- private static Field getDeclaredField(final Class<?> c,
- final String fieldName)
- throws PrivilegedActionException, NoSuchFieldException, SecurityException {
- if (System.getSecurityManager() == null) {
- return c.getDeclaredField(fieldName);
- } else {
- return AccessController
- .doPrivileged(new PrivilegedExceptionAction<Field>() {
- public Field run()
- throws NoSuchFieldException {
- return c.getDeclaredField(fieldName);
- }
- });
- }
- }
-
- /**
- * This class maintains a map of stream position to
- * an Object currently being deserialized. It is used
- * to handle the cases where the are indirections to
- * an object on the recursion stack. The CDR level
- * handles indirections to objects previously seen
- * (and completely deserialized) in the stream.
- */
- static class ActiveRecursionManager
- {
- private Map<Integer, Object> offsetToObjectMap;
-
- public ActiveRecursionManager() {
- // A hash map is unsynchronized and allows
- // null values
- offsetToObjectMap = new HashMap<>();
- }
-
- // Called right after allocating a new object.
- // Offset is the starting position in the stream
- // of the object.
- public void addObject(int offset, Object value) {
- offsetToObjectMap.put(new Integer(offset), value);
- }
-
- // If the given starting position doesn't refer
- // to the beginning of an object currently being
- // deserialized, this throws an IOException.
- // Otherwise, it returns a reference to the
- // object.
- public Object getObject(int offset) throws IOException {
- Integer position = new Integer(offset);
-
- if (!offsetToObjectMap.containsKey(position))
- // XXX I18N, logging needed.
- throw new IOException("Invalid indirection to offset "
- + offset);
-
- return offsetToObjectMap.get(position);
- }
-
- // Called when an object has been completely
- // deserialized, so it should no longer be in
- // this mapping. The CDR level can handle
- // further indirections.
- public void removeObject(int offset) {
- offsetToObjectMap.remove(new Integer(offset));
- }
-
- // If the given offset doesn't map to an Object,
- // then it isn't an indirection to an object
- // currently being deserialized.
- public boolean containsObject(int offset) {
- return offsetToObjectMap.containsKey(new Integer(offset));
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java b/src/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java
deleted file mode 100644
index a8fcb18..0000000
--- a/src/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java
+++ /dev/null
@@ -1,820 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.portable.OutputStream;
-
-import java.security.AccessController ;
-import java.security.PrivilegedAction ;
-
-import java.io.IOException;
-import java.io.DataOutputStream;
-import java.io.Serializable;
-import java.io.InvalidClassException;
-import java.io.StreamCorruptedException;
-import java.io.Externalizable;
-import java.io.ObjectStreamException;
-import java.io.NotSerializableException;
-import java.io.NotActiveException;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Field;
-
-import java.util.Stack;
-
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandlerMultiFormat;
-
-import sun.corba.Bridge ;
-
-import com.sun.corba.se.impl.io.ObjectStreamClass;
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.util.RepositoryId;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.UtilSystemException ;
-
-/**
- * IIOPOutputStream is ...
- *
- * @author Stephen Lewallen
- * @since JDK1.1.6
- */
-
-public class IIOPOutputStream
- extends com.sun.corba.se.impl.io.OutputStreamHook
-{
- private UtilSystemException wrapper = UtilSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- private static Bridge bridge =
- (Bridge)AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
- return Bridge.get() ;
- }
- }
- ) ;
-
- private org.omg.CORBA_2_3.portable.OutputStream orbStream;
-
- private Object currentObject = null;
-
- private ObjectStreamClass currentClassDesc = null;
-
- private int recursionDepth = 0;
-
- private int simpleWriteDepth = 0;
-
- private IOException abortIOException = null;
-
- private java.util.Stack classDescStack = new java.util.Stack();
-
- // Used when calling an object's writeObject method
- private Object[] writeObjectArgList = {this};
-
- public IIOPOutputStream()
- throws java.io.IOException
- {
- super();
- }
-
- // If using RMI-IIOP stream format version 2, this tells
- // the ORB stream (which must be a ValueOutputStream) to
- // begin a new valuetype to contain the optional data
- // of the writeObject method.
- protected void beginOptionalCustomData() {
-
- if (streamFormatVersion == 2) {
-
- org.omg.CORBA.portable.ValueOutputStream vout
- = (org.omg.CORBA.portable.ValueOutputStream)orbStream;
-
- vout.start_value(currentClassDesc.getRMIIIOPOptionalDataRepId());
- }
- }
-
- final void setOrbStream(org.omg.CORBA_2_3.portable.OutputStream os) {
- orbStream = os;
- }
-
- final org.omg.CORBA_2_3.portable.OutputStream getOrbStream() {
- return orbStream;
- }
-
- final void increaseRecursionDepth(){
- recursionDepth++;
- }
-
- final int decreaseRecursionDepth(){
- return --recursionDepth;
- }
-
- /**
- * Override the actions of the final method "writeObject()"
- * in ObjectOutputStream.
- * @since JDK1.1.6
- */
- public final void writeObjectOverride(Object obj)
- throws IOException
- {
- writeObjectState.writeData(this);
-
- Util.writeAbstractObject((OutputStream)orbStream, obj);
- }
-
- /**
- * Override the actions of the final method "writeObject()"
- * in ObjectOutputStream.
- * @since JDK1.1.6
- */
- public final void simpleWriteObject(Object obj, byte formatVersion)
- /* throws IOException */
- {
- byte oldStreamFormatVersion = streamFormatVersion;
-
- streamFormatVersion = formatVersion;
-
- Object prevObject = currentObject;
- ObjectStreamClass prevClassDesc = currentClassDesc;
- simpleWriteDepth++;
-
- try {
- // if (!checkSpecialClasses(obj) && !checkSubstitutableSpecialClasses(obj))
- outputObject(obj);
-
- } catch (IOException ee) {
- if (abortIOException == null)
- abortIOException = ee;
- } finally {
- /* Restore state of previous call incase this is a nested call */
- streamFormatVersion = oldStreamFormatVersion;
- simpleWriteDepth--;
- currentObject = prevObject;
- currentClassDesc = prevClassDesc;
- }
-
- /* If the recursion depth is 0, test for and clear the pending exception.
- * If there is a pending exception throw it.
- */
- IOException pending = abortIOException;
- if (simpleWriteDepth == 0)
- abortIOException = null;
- if (pending != null) {
- bridge.throwException( pending ) ;
- }
- }
-
- // Required by the superclass.
- ObjectStreamField[] getFieldsNoCopy() {
- return currentClassDesc.getFieldsNoCopy();
- }
-
- /**
- * Override the actions of the final method "defaultWriteObject()"
- * in ObjectOutputStream.
- * @since JDK1.1.6
- */
- public final void defaultWriteObjectDelegate()
- /* throws IOException */
- {
- try {
- if (currentObject == null || currentClassDesc == null)
- // XXX I18N, Logging needed.
- throw new NotActiveException("defaultWriteObjectDelegate");
-
- ObjectStreamField[] fields =
- currentClassDesc.getFieldsNoCopy();
- if (fields.length > 0) {
- outputClassFields(currentObject, currentClassDesc.forClass(),
- fields);
- }
- } catch(IOException ioe) {
- bridge.throwException(ioe);
- }
- }
-
- /**
- * Override the actions of the final method "enableReplaceObject()"
- * in ObjectOutputStream.
- * @since JDK1.1.6
- */
- public final boolean enableReplaceObjectDelegate(boolean enable)
- /* throws SecurityException */
- {
- return false;
-
- }
-
-
- protected final void annotateClass(Class<?> cl) throws IOException{
- // XXX I18N, Logging needed.
- throw new IOException("Method annotateClass not supported");
- }
-
- public final void close() throws IOException{
- // no op
- }
-
- protected final void drain() throws IOException{
- // no op
- }
-
- public final void flush() throws IOException{
- try{
- orbStream.flush();
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- protected final Object replaceObject(Object obj) throws IOException{
- // XXX I18N, Logging needed.
- throw new IOException("Method replaceObject not supported");
- }
-
- /**
- * Reset will disregard the state of any objects already written
- * to the stream. The state is reset to be the same as a new
- * ObjectOutputStream. The current point in the stream is marked
- * as reset so the corresponding ObjectInputStream will be reset
- * at the same point. Objects previously written to the stream
- * will not be refered to as already being in the stream. They
- * will be written to the stream again.
- * @since JDK1.1
- */
- public final void reset() throws IOException{
- try{
- //orbStream.reset();
-
- if (currentObject != null || currentClassDesc != null)
- // XXX I18N, Logging needed.
- throw new IOException("Illegal call to reset");
-
- abortIOException = null;
-
- if (classDescStack == null)
- classDescStack = new java.util.Stack();
- else
- classDescStack.setSize(0);
-
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void write(byte b[]) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_octet_array(b, 0, b.length);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void write(byte b[], int off, int len) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_octet_array(b, off, len);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void write(int data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_octet((byte)(data & 0xFF));
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeBoolean(boolean data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_boolean(data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeByte(int data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_octet((byte)data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeBytes(String data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- byte buf[] = data.getBytes();
- orbStream.write_octet_array(buf, 0, buf.length);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeChar(int data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_wchar((char)data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeChars(String data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- char buf[] = data.toCharArray();
- orbStream.write_wchar_array(buf, 0, buf.length);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeDouble(double data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_double(data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeFloat(float data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_float(data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeInt(int data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_long(data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeLong(long data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_longlong(data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeShort(int data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_short((short)data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- protected final void writeStreamHeader() throws IOException{
- // no op
- }
-
- /**
- * Helper method for correcting the Kestrel bug 4367783 (dealing
- * with larger than 8-bit chars). The old behavior is preserved
- * in orbutil.IIOPInputStream_1_3 in order to interoperate with
- * our legacy ORBs.
- */
- protected void internalWriteUTF(org.omg.CORBA.portable.OutputStream stream,
- String data)
- {
- stream.write_wstring(data);
- }
-
- public final void writeUTF(String data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- internalWriteUTF(orbStream, data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- // INTERNAL UTILITY METHODS
- /*
- * Check for special cases of serializing objects.
- * These objects are not subject to replacement.
- */
- private boolean checkSpecialClasses(Object obj) throws IOException {
-
- /*
- * If this is a class, don't allow substitution
- */
- //if (obj instanceof Class) {
- // throw new IOException("Serialization of Class not supported");
- //}
-
- if (obj instanceof ObjectStreamClass) {
- // XXX I18N, Logging needed.
- throw new IOException("Serialization of ObjectStreamClass not supported");
- }
-
- return false;
- }
-
- /*
- * Check for special cases of substitutable serializing objects.
- * These classes are replaceable.
- */
- private boolean checkSubstitutableSpecialClasses(Object obj)
- throws IOException
- {
- if (obj instanceof String) {
- orbStream.write_value((java.io.Serializable)obj);
- return true;
- }
-
- //if (obj.getClass().isArray()) {
- // outputArray(obj);
- // return true;
- //}
-
- return false;
- }
-
- /*
- * Write out the object
- */
- private void outputObject(final Object obj) throws IOException{
-
- currentObject = obj;
- Class currclass = obj.getClass();
-
- /* Get the Class descriptor for this class,
- * Throw a NotSerializableException if there is none.
- */
- currentClassDesc = ObjectStreamClass.lookup(currclass);
- if (currentClassDesc == null) {
- // XXX I18N, Logging needed.
- throw new NotSerializableException(currclass.getName());
- }
-
- /* If the object is externalizable,
- * call writeExternal.
- * else do Serializable processing.
- */
- if (currentClassDesc.isExternalizable()) {
- // Write format version
- orbStream.write_octet(streamFormatVersion);
-
- Externalizable ext = (Externalizable)obj;
- ext.writeExternal(this);
-
- } else {
-
- /* The object's classes should be processed from supertype to subtype
- * Push all the clases of the current object onto a stack.
- * Remember the stack pointer where this set of classes is being pushed.
- */
- if (currentClassDesc.forClass().getName().equals("java.lang.String")) {
- this.writeUTF((String)obj);
- return;
- }
- int stackMark = classDescStack.size();
- try {
- ObjectStreamClass next;
- while ((next = currentClassDesc.getSuperclass()) != null) {
- classDescStack.push(currentClassDesc);
- currentClassDesc = next;
- }
-
- /*
- * For currentClassDesc and all the pushed class descriptors
- * If the class is writing its own data
- * set blockData = true; call the class writeObject method
- * If not
- * invoke either the defaultWriteObject method.
- */
- do {
-
- WriteObjectState oldState = writeObjectState;
-
- try {
-
- setState(NOT_IN_WRITE_OBJECT);
-
- if (currentClassDesc.hasWriteObject()) {
- invokeObjectWriter(currentClassDesc, obj );
- } else {
- defaultWriteObjectDelegate();
- }
- } finally {
- setState(oldState);
- }
-
- } while (classDescStack.size() > stackMark &&
- (currentClassDesc = (ObjectStreamClass)classDescStack.pop()) != null);
- } finally {
- classDescStack.setSize(stackMark);
- }
- }
- }
-
- /*
- * Invoke writer.
- * _REVISIT_ invokeObjectWriter and invokeObjectReader behave inconsistently with each other since
- * the reader returns a boolean...fix later
- */
- private void invokeObjectWriter(ObjectStreamClass osc, Object obj)
- throws IOException
- {
- Class c = osc.forClass() ;
-
- try {
-
- // Write format version
- orbStream.write_octet(streamFormatVersion);
-
- writeObjectState.enterWriteObject(this);
-
- // writeObject(obj, c, this);
- osc.writeObjectMethod.invoke( obj, writeObjectArgList ) ;
-
- writeObjectState.exitWriteObject(this);
-
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof IOException)
- throw (IOException)t;
- else if (t instanceof RuntimeException)
- throw (RuntimeException) t;
- else if (t instanceof Error)
- throw (Error) t;
- else
- // XXX I18N, Logging needed.
- throw new Error("invokeObjectWriter internal error",e);
- } catch (IllegalAccessException e) {
- // cannot happen
- }
- }
-
- void writeField(ObjectStreamField field, Object value) throws IOException {
- switch (field.getTypeCode()) {
- case 'B':
- if (value == null)
- orbStream.write_octet((byte)0);
- else
- orbStream.write_octet(((Byte)value).byteValue());
- break;
- case 'C':
- if (value == null)
- orbStream.write_wchar((char)0);
- else
- orbStream.write_wchar(((Character)value).charValue());
- break;
- case 'F':
- if (value == null)
- orbStream.write_float((float)0);
- else
- orbStream.write_float(((Float)value).floatValue());
- break;
- case 'D':
- if (value == null)
- orbStream.write_double((double)0);
- else
- orbStream.write_double(((Double)value).doubleValue());
- break;
- case 'I':
- if (value == null)
- orbStream.write_long((int)0);
- else
- orbStream.write_long(((Integer)value).intValue());
- break;
- case 'J':
- if (value == null)
- orbStream.write_longlong((long)0);
- else
- orbStream.write_longlong(((Long)value).longValue());
- break;
- case 'S':
- if (value == null)
- orbStream.write_short((short)0);
- else
- orbStream.write_short(((Short)value).shortValue());
- break;
- case 'Z':
- if (value == null)
- orbStream.write_boolean(false);
- else
- orbStream.write_boolean(((Boolean)value).booleanValue());
- break;
- case '[':
- case 'L':
- // What to do if it's null?
- writeObjectField(field, value);
- break;
- default:
- // XXX I18N, Logging needed.
- throw new InvalidClassException(currentClassDesc.getName());
- }
- }
-
- private void writeObjectField(ObjectStreamField field,
- Object objectValue) throws IOException {
-
- if (ObjectStreamClassCorbaExt.isAny(field.getTypeString())) {
- javax.rmi.CORBA.Util.writeAny(orbStream, objectValue);
- }
- else {
- Class type = field.getType();
- int callType = ValueHandlerImpl.kValueType;
-
- if (type.isInterface()) {
- String className = type.getName();
-
- if (java.rmi.Remote.class.isAssignableFrom(type)) {
-
- // RMI Object reference...
-
- callType = ValueHandlerImpl.kRemoteType;
-
-
- } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)){
-
- // IDL Object reference...
- callType = ValueHandlerImpl.kRemoteType;
-
- } else if (RepositoryId.isAbstractBase(type)) {
- // IDL Abstract Object reference...
- callType = ValueHandlerImpl.kAbstractType;
- } else if (ObjectStreamClassCorbaExt.isAbstractInterface(type)) {
- callType = ValueHandlerImpl.kAbstractType;
- }
- }
-
- switch (callType) {
- case ValueHandlerImpl.kRemoteType:
- Util.writeRemoteObject(orbStream, objectValue);
- break;
- case ValueHandlerImpl.kAbstractType:
- Util.writeAbstractObject(orbStream, objectValue);
- break;
- case ValueHandlerImpl.kValueType:
- try{
- orbStream.write_value((java.io.Serializable)objectValue, type);
- }
- catch(ClassCastException cce){
- if (objectValue instanceof java.io.Serializable)
- throw cce;
- else
- Utility.throwNotSerializableForCorba(objectValue.getClass().getName());
- }
- }
- }
- }
-
- /* Write the fields of the specified class by invoking the appropriate
- * write* method on this class.
- */
- private void outputClassFields(Object o, Class cl,
- ObjectStreamField[] fields)
- throws IOException, InvalidClassException {
-
- for (int i = 0; i < fields.length; i++) {
- if (fields[i].getField() == null)
- // XXX I18N, Logging needed.
- throw new InvalidClassException(cl.getName(),
- "Nonexistent field " + fields[i].getName());
-
- try {
- switch (fields[i].getTypeCode()) {
- case 'B':
- byte byteValue = fields[i].getField().getByte( o ) ;
- orbStream.write_octet(byteValue);
- break;
- case 'C':
- char charValue = fields[i].getField().getChar( o ) ;
- orbStream.write_wchar(charValue);
- break;
- case 'F':
- float floatValue = fields[i].getField().getFloat( o ) ;
- orbStream.write_float(floatValue);
- break;
- case 'D' :
- double doubleValue = fields[i].getField().getDouble( o ) ;
- orbStream.write_double(doubleValue);
- break;
- case 'I':
- int intValue = fields[i].getField().getInt( o ) ;
- orbStream.write_long(intValue);
- break;
- case 'J':
- long longValue = fields[i].getField().getLong( o ) ;
- orbStream.write_longlong(longValue);
- break;
- case 'S':
- short shortValue = fields[i].getField().getShort( o ) ;
- orbStream.write_short(shortValue);
- break;
- case 'Z':
- boolean booleanValue = fields[i].getField().getBoolean( o ) ;
- orbStream.write_boolean(booleanValue);
- break;
- case '[':
- case 'L':
- Object objectValue = fields[i].getField().get( o ) ;
- writeObjectField(fields[i], objectValue);
- break;
- default:
- // XXX I18N, Logging needed.
- throw new InvalidClassException(cl.getName());
- }
- } catch (IllegalAccessException exc) {
- throw wrapper.illegalFieldAccess( exc, fields[i].getName() ) ;
- }
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java b/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java
deleted file mode 100644
index f4198e3..0000000
--- a/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import java.io.IOException;
-import java.io.StreamCorruptedException;
-import java.io.NotActiveException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.util.*;
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-
-import org.omg.CORBA.portable.ValueInputStream;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orb.ORBVersion;
-import com.sun.corba.se.spi.orb.ORBVersionFactory;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.UtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-
-public abstract class InputStreamHook extends ObjectInputStream
-{
- // These should be visible in all the nested classes
- static final OMGSystemException omgWrapper =
- OMGSystemException.get( CORBALogDomains.RPC_ENCODING ) ;
-
- static final UtilSystemException utilWrapper =
- UtilSystemException.get( CORBALogDomains.RPC_ENCODING ) ;
-
- private class HookGetFields extends ObjectInputStream.GetField {
- private Map fields = null;
-
- HookGetFields(Map fields){
- this.fields = fields;
- }
-
- /**
- * Get the ObjectStreamClass that describes the fields in the stream.
- *
- * REVISIT! This doesn't work since we have our own ObjectStreamClass.
- */
- public java.io.ObjectStreamClass getObjectStreamClass() {
- return null;
- }
-
- /**
- * Return true if the named field is defaulted and has no value
- * in this stream.
- */
- public boolean defaulted(String name)
- throws IOException, IllegalArgumentException {
- return (!fields.containsKey(name));
- }
-
- /**
- * Get the value of the named boolean field from the persistent field.
- */
- public boolean get(String name, boolean defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Boolean)fields.get(name)).booleanValue();
- }
-
- /**
- * Get the value of the named char field from the persistent fields.
- */
- public char get(String name, char defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Character)fields.get(name)).charValue();
-
- }
-
- /**
- * Get the value of the named byte field from the persistent fields.
- */
- public byte get(String name, byte defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Byte)fields.get(name)).byteValue();
-
- }
-
- /**
- * Get the value of the named short field from the persistent fields.
- */
- public short get(String name, short defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Short)fields.get(name)).shortValue();
-
- }
-
- /**
- * Get the value of the named int field from the persistent fields.
- */
- public int get(String name, int defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Integer)fields.get(name)).intValue();
-
- }
-
- /**
- * Get the value of the named long field from the persistent fields.
- */
- public long get(String name, long defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Long)fields.get(name)).longValue();
-
- }
-
- /**
- * Get the value of the named float field from the persistent fields.
- */
- public float get(String name, float defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Float)fields.get(name)).floatValue();
-
- }
-
- /**
- * Get the value of the named double field from the persistent field.
- */
- public double get(String name, double defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Double)fields.get(name)).doubleValue();
-
- }
-
- /**
- * Get the value of the named Object field from the persistent field.
- */
- public Object get(String name, Object defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return fields.get(name);
-
- }
-
- public String toString(){
- return fields.toString();
- }
- }
-
- public InputStreamHook()
- throws IOException {
- super();
- }
-
- public void defaultReadObject()
- throws IOException, ClassNotFoundException, NotActiveException
- {
- readObjectState.beginDefaultReadObject(this);
-
- defaultReadObjectDelegate();
-
- readObjectState.endDefaultReadObject(this);
- }
-
- abstract void defaultReadObjectDelegate();
-
- abstract void readFields(java.util.Map fieldToValueMap)
- throws java.io.InvalidClassException, java.io.StreamCorruptedException,
- ClassNotFoundException, java.io.IOException;
-
-
- // See java.io.ObjectInputStream.GetField
- // Remember that this is equivalent to defaultReadObject
- // in RMI-IIOP
- public ObjectInputStream.GetField readFields()
- throws IOException, ClassNotFoundException, NotActiveException {
-
- HashMap fieldValueMap = new HashMap();
-
- // We were treating readFields same as defaultReadObject. It is
- // incorrect if the state is readOptionalData. If this line
- // is uncommented, it will throw a stream corrupted exception.
- // _REVISIT_: The ideal fix would be to add a new state. In
- // writeObject user may do one of the following
- // 1. Call defaultWriteObject()
- // 2. Put out optional fields
- // 3. Call writeFields
- // We have the state defined for (1) and (2) but not for (3), so
- // we should ideally introduce a new state for 3 and have the
- // beginDefaultReadObject do nothing.
- //readObjectState.beginDefaultReadObject(this);
-
- readFields(fieldValueMap);
-
- readObjectState.endDefaultReadObject(this);
-
- return new HookGetFields(fieldValueMap);
- }
-
- // The following is a State pattern implementation of what
- // should be done when the sender's Serializable has a
- // writeObject method. This was especially necessary for
- // RMI-IIOP stream format version 2. Please see the
- // state diagrams in the docs directory of the workspace.
- //
- // On the reader's side, the main factors are whether or not
- // we have a readObject method and whether or not the
- // sender wrote default data
-
- protected void setState(ReadObjectState newState) {
- readObjectState = newState;
- }
-
- protected abstract byte getStreamFormatVersion();
- abstract org.omg.CORBA_2_3.portable.InputStream getOrbStream();
-
- // Description of possible actions
- protected static class ReadObjectState {
- public void beginUnmarshalCustomValue(InputStreamHook stream,
- boolean calledDefaultWriteObject,
- boolean hasReadObject) throws IOException {}
-
- public void endUnmarshalCustomValue(InputStreamHook stream) throws IOException {}
- public void beginDefaultReadObject(InputStreamHook stream) throws IOException {}
- public void endDefaultReadObject(InputStreamHook stream) throws IOException {}
- public void readData(InputStreamHook stream) throws IOException {}
- }
-
- protected ReadObjectState readObjectState = DEFAULT_STATE;
-
- protected static final ReadObjectState DEFAULT_STATE = new DefaultState();
- protected static final ReadObjectState IN_READ_OBJECT_OPT_DATA
- = new InReadObjectOptionalDataState();
- protected static final ReadObjectState IN_READ_OBJECT_NO_MORE_OPT_DATA
- = new InReadObjectNoMoreOptionalDataState();
- protected static final ReadObjectState IN_READ_OBJECT_DEFAULTS_SENT
- = new InReadObjectDefaultsSentState();
- protected static final ReadObjectState NO_READ_OBJECT_DEFAULTS_SENT
- = new NoReadObjectDefaultsSentState();
-
- protected static final ReadObjectState IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED
- = new InReadObjectRemoteDidNotUseWriteObjectState();
- protected static final ReadObjectState IN_READ_OBJECT_PAST_DEFAULTS_REMOTE_NOT_CUSTOM
- = new InReadObjectPastDefaultsRemoteDidNotUseWOState();
-
- protected static class DefaultState extends ReadObjectState {
-
- public void beginUnmarshalCustomValue(InputStreamHook stream,
- boolean calledDefaultWriteObject,
- boolean hasReadObject)
- throws IOException {
-
- if (hasReadObject) {
- if (calledDefaultWriteObject)
- stream.setState(IN_READ_OBJECT_DEFAULTS_SENT);
- else {
- try {
- if (stream.getStreamFormatVersion() == 2)
- ((ValueInputStream)stream.getOrbStream()).start_value();
- } catch( Exception e ) {
- // This will happen for Big Integer which uses
- // writeFields in it's writeObject. We should be past
- // start_value by now.
- // NOTE: If we don't log any exception here we should
- // be fine. If there is an error, it will be caught
- // while reading the optional data.
-
- }
- stream.setState(IN_READ_OBJECT_OPT_DATA);
- }
- } else {
- if (calledDefaultWriteObject)
- stream.setState(NO_READ_OBJECT_DEFAULTS_SENT);
- else
- // XXX I18N and logging needed.
- throw new StreamCorruptedException("No default data sent");
- }
- }
- }
-
- // REVISIT. If a readObject exits here without reading
- // default data, we won't skip it. This could be done automatically
- // as in line 1492 in IIOPInputStream.
- protected static class InReadObjectRemoteDidNotUseWriteObjectState extends ReadObjectState {
-
- public void beginUnmarshalCustomValue(InputStreamHook stream,
- boolean calledDefaultWriteObject,
- boolean hasReadObject)
- {
- throw utilWrapper.badBeginUnmarshalCustomValue() ;
- }
-
- public void endDefaultReadObject(InputStreamHook stream) {
- stream.setState(IN_READ_OBJECT_PAST_DEFAULTS_REMOTE_NOT_CUSTOM);
- }
-
- public void readData(InputStreamHook stream) {
- stream.throwOptionalDataIncompatibleException();
- }
- }
-
- protected static class InReadObjectPastDefaultsRemoteDidNotUseWOState extends ReadObjectState {
-
- public void beginUnmarshalCustomValue(InputStreamHook stream,
- boolean calledDefaultWriteObject,
- boolean hasReadObject)
- {
- throw utilWrapper.badBeginUnmarshalCustomValue() ;
- }
-
- public void beginDefaultReadObject(InputStreamHook stream) throws IOException
- {
- // XXX I18N and logging needed.
- throw new StreamCorruptedException("Default data already read");
- }
-
-
- public void readData(InputStreamHook stream) {
- stream.throwOptionalDataIncompatibleException();
- }
- }
-
- protected void throwOptionalDataIncompatibleException()
- {
- throw omgWrapper.rmiiiopOptionalDataIncompatible2() ;
- }
-
-
- protected static class InReadObjectDefaultsSentState extends ReadObjectState {
-
- public void beginUnmarshalCustomValue(InputStreamHook stream,
- boolean calledDefaultWriteObject,
- boolean hasReadObject) {
- // This should never happen.
- throw utilWrapper.badBeginUnmarshalCustomValue() ;
- }
-
- public void endUnmarshalCustomValue(InputStreamHook stream) {
-
- // In stream format version 2, we can skip over
- // the optional data this way. In stream format version 1,
- // we will probably wind up with an error if we're
- // unmarshaling a superclass.
- if (stream.getStreamFormatVersion() == 2) {
- ((ValueInputStream)stream.getOrbStream()).start_value();
- ((ValueInputStream)stream.getOrbStream()).end_value();
- }
-
- stream.setState(DEFAULT_STATE);
- }
-
- public void endDefaultReadObject(InputStreamHook stream) throws IOException {
-
- // Read the fake valuetype header in stream format version 2
- if (stream.getStreamFormatVersion() == 2)
- ((ValueInputStream)stream.getOrbStream()).start_value();
-
- stream.setState(IN_READ_OBJECT_OPT_DATA);
- }
-
- public void readData(InputStreamHook stream) throws IOException {
- org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
- if ((orb == null) ||
- !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
- throw new StreamCorruptedException(
- "Default data must be read first");
- }
- ORBVersion clientOrbVersion =
- ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();
-
- // Fix Date interop bug. For older versions of the ORB don't do
- // anything for readData(). Before this used to throw
- // StreamCorruptedException for older versions of the ORB where
- // calledDefaultWriteObject always returns true.
- if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
- (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
- // XXX I18N and logging needed.
- throw new StreamCorruptedException("Default data must be read first");
- }
- }
- }
-
- protected static class InReadObjectOptionalDataState extends ReadObjectState {
-
- public void beginUnmarshalCustomValue(InputStreamHook stream,
- boolean calledDefaultWriteObject,
- boolean hasReadObject)
- {
- // This should never happen.
- throw utilWrapper.badBeginUnmarshalCustomValue() ;
- }
-
- public void endUnmarshalCustomValue(InputStreamHook stream) throws IOException
- {
- if (stream.getStreamFormatVersion() == 2) {
- ((ValueInputStream)stream.getOrbStream()).end_value();
- }
- stream.setState(DEFAULT_STATE);
- }
-
- public void beginDefaultReadObject(InputStreamHook stream) throws IOException
- {
- // XXX I18N and logging needed.
- throw new StreamCorruptedException("Default data not sent or already read/passed");
- }
-
-
- }
-
- protected static class InReadObjectNoMoreOptionalDataState
- extends InReadObjectOptionalDataState {
-
- public void readData(InputStreamHook stream) throws IOException {
- stream.throwOptionalDataIncompatibleException();
- }
- }
-
- protected static class NoReadObjectDefaultsSentState extends ReadObjectState {
- public void endUnmarshalCustomValue(InputStreamHook stream) throws IOException {
- // Code should read default fields before calling this
-
- if (stream.getStreamFormatVersion() == 2) {
- ((ValueInputStream)stream.getOrbStream()).start_value();
- ((ValueInputStream)stream.getOrbStream()).end_value();
- }
-
- stream.setState(DEFAULT_STATE);
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java b/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
deleted file mode 100644
index 185f40c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
+++ /dev/null
@@ -1,1780 +0,0 @@
-/*
- * Copyright (c) 1998, 2014, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 2012 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.DigestOutputStream;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedAction;
-
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.InvocationTargetException;
-
-import java.io.IOException;
-import java.io.DataOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InvalidClassException;
-import java.io.Externalizable;
-import java.io.Serializable;
-
-import java.util.Arrays;
-import java.util.Comparator;
-
-import com.sun.corba.se.impl.util.RepositoryId;
-
-import org.omg.CORBA.ValueMember;
-
-import sun.corba.Bridge;
-
-/**
- * A ObjectStreamClass describes a class that can be serialized to a stream
- * or a class that was serialized to a stream. It contains the name
- * and the serialVersionUID of the class.
- * <br>
- * The ObjectStreamClass for a specific class loaded in this Java VM can
- * be found using the lookup method.
- *
- * @author Roger Riggs
- * @since JDK1.1
- */
-public class ObjectStreamClass implements java.io.Serializable {
- private static final boolean DEBUG_SVUID = false ;
-
- public static final long kDefaultUID = -1;
-
- private static Object noArgsList[] = {};
- private static Class<?> noTypesList[] = {};
-
- /** true if represents enum type */
- private boolean isEnum;
-
- private static final Bridge bridge =
- AccessController.doPrivileged(
- new PrivilegedAction<Bridge>() {
- public Bridge run() {
- return Bridge.get() ;
- }
- }
- ) ;
-
- /** Find the descriptor for a class that can be serialized. Null
- * is returned if the specified class does not implement
- * java.io.Serializable or java.io.Externalizable.
- */
- static final ObjectStreamClass lookup(Class<?> cl)
- {
- ObjectStreamClass desc = lookupInternal(cl);
- if (desc.isSerializable() || desc.isExternalizable())
- return desc;
- return null;
- }
-
- /*
- * Find the class descriptor for the specified class.
- * Package access only so it can be called from ObjectIn/OutStream.
- */
- static ObjectStreamClass lookupInternal(Class<?> cl)
- {
- /* Synchronize on the hashtable so no two threads will do
- * this at the same time.
- */
- ObjectStreamClass desc = null;
- synchronized (descriptorFor) {
- /* Find the matching descriptor if it already known */
- desc = findDescriptorFor(cl);
- if (desc == null) {
- /* Check if it's serializable */
- boolean serializable = Serializable.class.isAssignableFrom(cl);
-
- /* If the class is only Serializable,
- * lookup the descriptor for the superclass.
- */
- ObjectStreamClass superdesc = null;
- if (serializable) {
- Class<?> superclass = cl.getSuperclass();
- if (superclass != null)
- superdesc = lookup(superclass);
- }
-
- /* Check if its' externalizable.
- * If it's Externalizable, clear the serializable flag.
- * Only one or the other may be set in the protocol.
- */
- boolean externalizable = false;
- if (serializable) {
- externalizable =
- ((superdesc != null) && superdesc.isExternalizable()) ||
- Externalizable.class.isAssignableFrom(cl);
- if (externalizable) {
- serializable = false;
- }
- }
-
- /* Create a new version descriptor,
- * it put itself in the known table.
- */
- desc = new ObjectStreamClass(cl, superdesc,
- serializable, externalizable);
- }
- // Must always call init. See bug 4488137. This code was
- // incorrectly changed to return immediately on a non-null
- // cache result. That allowed threads to gain access to
- // unintialized instances.
- //
- // History: Note, the following init() call was originally within
- // the synchronization block, as it currently is now. Later, the
- // init() call was moved outside the synchronization block, and
- // the init() method used a private member variable lock, to
- // avoid performance problems. See bug 4165204. But that lead to
- // a deadlock situation, see bug 5104239. Hence, the init() method
- // has now been moved back into the synchronization block. The
- // right approach to solving these problems would be to rewrite
- // this class, based on the latest java.io.ObjectStreamClass.
- desc.init();
- }
- return desc;
- }
-
- /**
- * The name of the class described by this descriptor.
- */
- public final String getName() {
- return name;
- }
-
- /**
- * Return the serialVersionUID for this class.
- * The serialVersionUID defines a set of classes all with the same name
- * that have evolved from a common root class and agree to be serialized
- * and deserialized using a common format.
- */
- public static final long getSerialVersionUID( java.lang.Class<?> clazz) {
- ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz );
- if( theosc != null )
- {
- return theosc.getSerialVersionUID( );
- }
- return 0;
- }
-
- /**
- * Return the serialVersionUID for this class.
- * The serialVersionUID defines a set of classes all with the same name
- * that have evolved from a common root class and agree to be serialized
- * and deserialized using a common format.
- */
- public final long getSerialVersionUID() {
- return suid;
- }
-
- /**
- * Return the serialVersionUID string for this class.
- * The serialVersionUID defines a set of classes all with the same name
- * that have evolved from a common root class and agree to be serialized
- * and deserialized using a common format.
- */
- public final String getSerialVersionUIDStr() {
- if (suidStr == null)
- suidStr = Long.toHexString(suid).toUpperCase();
- return suidStr;
- }
-
- /**
- * Return the actual (computed) serialVersionUID for this class.
- */
- public static final long getActualSerialVersionUID( java.lang.Class<?> clazz )
- {
- ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz );
- if( theosc != null )
- {
- return theosc.getActualSerialVersionUID( );
- }
- return 0;
- }
-
- /**
- * Return the actual (computed) serialVersionUID for this class.
- */
- public final long getActualSerialVersionUID() {
- return actualSuid;
- }
-
- /**
- * Return the actual (computed) serialVersionUID for this class.
- */
- public final String getActualSerialVersionUIDStr() {
- if (actualSuidStr == null)
- actualSuidStr = Long.toHexString(actualSuid).toUpperCase();
- return actualSuidStr;
- }
-
- /**
- * Return the class in the local VM that this version is mapped to.
- * Null is returned if there is no corresponding local class.
- */
- public final Class<?> forClass() {
- return ofClass;
- }
-
- /**
- * Return an array of the fields of this serializable class.
- * @return an array containing an element for each persistent
- * field of this class. Returns an array of length zero if
- * there are no fields.
- * @since JDK1.2
- */
- public ObjectStreamField[] getFields() {
- // Return a copy so the caller can't change the fields.
- if (fields.length > 0) {
- ObjectStreamField[] dup = new ObjectStreamField[fields.length];
- System.arraycopy(fields, 0, dup, 0, fields.length);
- return dup;
- } else {
- return fields;
- }
- }
-
- public boolean hasField(ValueMember field)
- {
- try {
- for (int i = 0; i < fields.length; i++) {
- if (fields[i].getName().equals(field.name)) {
- if (fields[i].getSignature().equals(
- ValueUtility.getSignature(field)))
- return true;
- }
- }
- } catch (Exception exc) {
- // Ignore this; all we want to do is return false
- // Note that ValueUtility.getSignature can throw checked exceptions.
- }
-
- return false;
- }
-
- /* Avoid unnecessary allocations. */
- final ObjectStreamField[] getFieldsNoCopy() {
- return fields;
- }
-
- /**
- * Get the field of this class by name.
- * @return The ObjectStreamField object of the named field or null if there
- * is no such named field.
- */
- public final ObjectStreamField getField(String name) {
- /* Binary search of fields by name.
- */
- for (int i = fields.length-1; i >= 0; i--) {
- if (name.equals(fields[i].getName())) {
- return fields[i];
- }
- }
- return null;
- }
-
- public Serializable writeReplace(Serializable value) {
- if (writeReplaceObjectMethod != null) {
- try {
- return (Serializable) writeReplaceObjectMethod.invoke(value,noArgsList);
- } catch(Throwable t) {
- throw new RuntimeException(t);
- }
- }
- else return value;
- }
-
- public Object readResolve(Object value) {
- if (readResolveObjectMethod != null) {
- try {
- return readResolveObjectMethod.invoke(value,noArgsList);
- } catch(Throwable t) {
- throw new RuntimeException(t);
- }
- }
- else return value;
- }
-
- /**
- * Return a string describing this ObjectStreamClass.
- */
- public final String toString() {
- StringBuffer sb = new StringBuffer();
-
- sb.append(name);
- sb.append(": static final long serialVersionUID = ");
- sb.append(Long.toString(suid));
- sb.append("L;");
- return sb.toString();
- }
-
- /*
- * Create a new ObjectStreamClass from a loaded class.
- * Don't call this directly, call lookup instead.
- */
- private ObjectStreamClass(java.lang.Class<?> cl, ObjectStreamClass superdesc,
- boolean serial, boolean extern)
- {
- ofClass = cl; /* created from this class */
-
- if (Proxy.isProxyClass(cl)) {
- forProxyClass = true;
- }
-
- name = cl.getName();
- isEnum = Enum.class.isAssignableFrom(cl);
- superclass = superdesc;
- serializable = serial;
- if (!forProxyClass) {
- // proxy classes are never externalizable
- externalizable = extern;
- }
-
- /*
- * Enter this class in the table of known descriptors.
- * Otherwise, when the fields are read it may recurse
- * trying to find the descriptor for itself.
- */
- insertDescriptorFor(this);
-
- /*
- * The remainder of initialization occurs in init(), which is called
- * after the lock on the global class descriptor table has been
- * released.
- */
- }
-
- private static final class PersistentFieldsValue
- extends ClassValue<ObjectStreamField[]> {
- PersistentFieldsValue() { }
-
- protected ObjectStreamField[] computeValue(Class<?> type) {
- try {
- Field pf = type.getDeclaredField("serialPersistentFields");
- int mods = pf.getModifiers();
- if (Modifier.isPrivate(mods) && Modifier.isStatic(mods) &&
- Modifier.isFinal(mods)) {
- pf.setAccessible(true);
- java.io.ObjectStreamField[] fields =
- (java.io.ObjectStreamField[])pf.get(type);
- return translateFields(fields);
- }
- } catch (NoSuchFieldException | IllegalAccessException |
- IllegalArgumentException | ClassCastException e) {
- }
- return null;
- }
-
- private static ObjectStreamField[] translateFields(
- java.io.ObjectStreamField[] fields) {
- ObjectStreamField[] translation =
- new ObjectStreamField[fields.length];
- for (int i = 0; i < fields.length; i++) {
- translation[i] = new ObjectStreamField(fields[i].getName(),
- fields[i].getType());
- }
- return translation;
- }
- }
-
- private static final PersistentFieldsValue persistentFieldsValue =
- new PersistentFieldsValue();
-
- /*
- * Initialize class descriptor. This method is only invoked on class
- * descriptors created via calls to lookupInternal(). This method is kept
- * separate from the ObjectStreamClass constructor so that lookupInternal
- * does not have to hold onto a global class descriptor table lock while the
- * class descriptor is being initialized (see bug 4165204).
- */
-
-
- private void init() {
- synchronized (lock) {
-
- // See description at definition of initialized.
- if (initialized)
- return;
-
- final Class<?> cl = ofClass;
-
- if (!serializable ||
- externalizable ||
- forProxyClass ||
- name.equals("java.lang.String")){
- fields = NO_FIELDS;
- } else if (serializable) {
- /* Ask for permission to override field access checks.
- */
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- /* Fill in the list of persistent fields.
- * If it is declared, use the declared serialPersistentFields.
- * Otherwise, extract the fields from the class itself.
- */
- fields = persistentFieldsValue.get(cl);
-
- if (fields == null) {
- /* Get all of the declared fields for this
- * Class. setAccessible on all fields so they
- * can be accessed later. Create a temporary
- * ObjectStreamField array to hold each
- * non-static, non-transient field. Then copy the
- * temporary array into an array of the correct
- * size once the number of fields is known.
- */
- Field[] actualfields = cl.getDeclaredFields();
-
- int numFields = 0;
- ObjectStreamField[] tempFields =
- new ObjectStreamField[actualfields.length];
- for (int i = 0; i < actualfields.length; i++) {
- Field fld = actualfields[i] ;
- int modifiers = fld.getModifiers();
- if (!Modifier.isStatic(modifiers) &&
- !Modifier.isTransient(modifiers)) {
- fld.setAccessible(true) ;
- tempFields[numFields++] = new ObjectStreamField(fld);
- }
- }
-
- fields = new ObjectStreamField[numFields];
- System.arraycopy(tempFields, 0, fields, 0, numFields);
-
- } else {
- // For each declared persistent field, look for an actual
- // reflected Field. If there is one, make sure it's the correct
- // type and cache it in the ObjectStreamClass for that field.
- for (int j = fields.length-1; j >= 0; j--) {
- try {
- Field reflField = cl.getDeclaredField(fields[j].getName());
- if (fields[j].getType() == reflField.getType()) {
- reflField.setAccessible(true);
- fields[j].setField(reflField);
- }
- } catch (NoSuchFieldException e) {
- // Nothing to do
- }
- }
- }
- return null;
- }
- });
-
- if (fields.length > 1)
- Arrays.sort(fields);
-
- /* Set up field data for use while writing using the API api. */
- computeFieldInfo();
- }
-
- /* Get the serialVersionUID from the class.
- * It uses the access override mechanism so make sure
- * the field objects is only used here.
- *
- * NonSerializable classes have a serialVerisonUID of 0L.
- */
- if (isNonSerializable() || isEnum) {
- suid = 0L;
- } else {
- // Lookup special Serializable members using reflection.
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- if (forProxyClass) {
- // proxy classes always have serialVersionUID of 0L
- suid = 0L;
- } else {
- try {
- final Field f = cl.getDeclaredField("serialVersionUID");
- int mods = f.getModifiers();
- // SerialBug 5: static final SUID should be read
- if (Modifier.isStatic(mods) && Modifier.isFinal(mods) ) {
- f.setAccessible(true);
- suid = f.getLong(cl);
- // SerialBug 2: should be computed after writeObject
- // actualSuid = computeStructuralUID(cl);
- } else {
- suid = _computeSerialVersionUID(cl);
- // SerialBug 2: should be computed after writeObject
- // actualSuid = computeStructuralUID(cl);
- }
- } catch (NoSuchFieldException ex) {
- suid = _computeSerialVersionUID(cl);
- // SerialBug 2: should be computed after writeObject
- // actualSuid = computeStructuralUID(cl);
- } catch (IllegalAccessException ex) {
- suid = _computeSerialVersionUID(cl);
- }
- }
-
- writeReplaceObjectMethod = ObjectStreamClass.getInheritableMethod(cl,
- "writeReplace", noTypesList, Object.class);
-
- readResolveObjectMethod = ObjectStreamClass.getInheritableMethod(cl,
- "readResolve", noTypesList, Object.class);
-
- if (externalizable)
- cons = getExternalizableConstructor(cl) ;
- else
- cons = getSerializableConstructor(cl) ;
-
- if (serializable && !forProxyClass) {
- /* Look for the writeObject method
- * Set the accessible flag on it here. ObjectOutputStream
- * will call it as necessary.
- */
- writeObjectMethod = getPrivateMethod( cl, "writeObject",
- new Class<?>[] { java.io.ObjectOutputStream.class }, Void.TYPE ) ;
- readObjectMethod = getPrivateMethod( cl, "readObject",
- new Class<?>[] { java.io.ObjectInputStream.class }, Void.TYPE ) ;
- }
- return null;
- }
- });
- }
-
- // This call depends on a lot of information computed above!
- actualSuid = ObjectStreamClass.computeStructuralUID(this, cl);
-
- // If we have a write object method, precompute the
- // RMI-IIOP stream format version 2 optional data
- // repository ID.
- if (hasWriteObject())
- rmiiiopOptionalDataRepId = computeRMIIIOPOptionalDataRepId();
-
- // This must be done last.
- initialized = true;
- }
- }
-
- /**
- * Returns non-static private method with given signature defined by given
- * class, or null if none found. Access checks are disabled on the
- * returned method (if any).
- */
- private static Method getPrivateMethod(Class<?> cl, String name,
- Class<?>[] argTypes,
- Class<?> returnType)
- {
- try {
- Method meth = cl.getDeclaredMethod(name, argTypes);
- meth.setAccessible(true);
- int mods = meth.getModifiers();
- return ((meth.getReturnType() == returnType) &&
- ((mods & Modifier.STATIC) == 0) &&
- ((mods & Modifier.PRIVATE) != 0)) ? meth : null;
- } catch (NoSuchMethodException ex) {
- return null;
- }
- }
-
- // Specific to RMI-IIOP
- /**
- * Java to IDL ptc-02-01-12 1.5.1
- *
- * "The rep_id string passed to the start_value method must be
- * 'RMI:org.omg.custom.class:hashcode:suid' where class is the
- * fully-qualified name of the class whose writeObject method
- * is being invoked and hashcode and suid are the class's hashcode
- * and SUID."
- */
- private String computeRMIIIOPOptionalDataRepId() {
-
- StringBuffer sbuf = new StringBuffer("RMI:org.omg.custom.");
- sbuf.append(RepositoryId.convertToISOLatin1(this.getName()));
- sbuf.append(':');
- sbuf.append(this.getActualSerialVersionUIDStr());
- sbuf.append(':');
- sbuf.append(this.getSerialVersionUIDStr());
-
- return sbuf.toString();
- }
-
- /**
- * This will return null if there is no writeObject method.
- */
- public final String getRMIIIOPOptionalDataRepId() {
- return rmiiiopOptionalDataRepId;
- }
-
- /*
- * Create an empty ObjectStreamClass for a class about to be read.
- * This is separate from read so ObjectInputStream can assign the
- * wire handle early, before any nested ObjectStreamClass might
- * be read.
- */
- ObjectStreamClass(String n, long s) {
- name = n;
- suid = s;
- superclass = null;
- }
-
-
- /*
- * Set the class this version descriptor matches.
- * The base class name and serializable hash must match.
- * Fill in the reflected Fields that will be used
- * for reading.
- */
- final void setClass(Class<?> cl) throws InvalidClassException {
-
- if (cl == null) {
- localClassDesc = null;
- ofClass = null;
- computeFieldInfo();
- return;
- }
-
- localClassDesc = lookupInternal(cl);
- if (localClassDesc == null)
- // XXX I18N, logging needed
- throw new InvalidClassException(cl.getName(),
- "Local class not compatible");
- if (suid != localClassDesc.suid) {
-
- /* Check for exceptional cases that allow mismatched suid. */
-
- /* Allow adding Serializable or Externalizable
- * to a later release of the class.
- */
- boolean addedSerialOrExtern =
- isNonSerializable() || localClassDesc.isNonSerializable();
-
- /* Disregard the serialVersionUID of an array
- * when name and cl.Name differ. If resolveClass() returns
- * an array with a different package name,
- * the serialVersionUIDs will not match since the fully
- * qualified array class is used in the
- * computation of the array's serialVersionUID. There is
- * no way to set a permanent serialVersionUID for an array type.
- */
-
- boolean arraySUID = (cl.isArray() && ! cl.getName().equals(name));
-
- if (! arraySUID && ! addedSerialOrExtern ) {
- // XXX I18N, logging needed
- throw new InvalidClassException(cl.getName(),
- "Local class not compatible:" +
- " stream classdesc serialVersionUID=" + suid +
- " local class serialVersionUID=" + localClassDesc.suid);
- }
- }
-
- /* compare the class names, stripping off package names. */
- if (! compareClassNames(name, cl.getName(), '.'))
- // XXX I18N, logging needed
- throw new InvalidClassException(cl.getName(),
- "Incompatible local class name. " +
- "Expected class name compatible with " +
- name);
-
- /*
- * Test that both implement either serializable or externalizable.
- */
-
- // The next check is more generic, since it covers the
- // Proxy case, the JDK 1.3 serialization code has
- // both checks
- //if ((serializable && localClassDesc.externalizable) ||
- // (externalizable && localClassDesc.serializable))
- // throw new InvalidClassException(localCl.getName(),
- // "Serializable is incompatible with Externalizable");
-
- if ((serializable != localClassDesc.serializable) ||
- (externalizable != localClassDesc.externalizable) ||
- (!serializable && !externalizable))
-
- // XXX I18N, logging needed
- throw new InvalidClassException(cl.getName(),
- "Serialization incompatible with Externalization");
-
- /* Set up the reflected Fields in the class where the value of each
- * field in this descriptor should be stored.
- * Each field in this ObjectStreamClass (the source) is located (by
- * name) in the ObjectStreamClass of the class(the destination).
- * In the usual (non-versioned case) the field is in both
- * descriptors and the types match, so the reflected Field is copied.
- * If the type does not match, a InvalidClass exception is thrown.
- * If the field is not present in the class, the reflected Field
- * remains null so the field will be read but discarded.
- * If extra fields are present in the class they are ignored. Their
- * values will be set to the default value by the object allocator.
- * Both the src and dest field list are sorted by type and name.
- */
-
- ObjectStreamField[] destfield =
- (ObjectStreamField[])localClassDesc.fields;
- ObjectStreamField[] srcfield =
- (ObjectStreamField[])fields;
-
- int j = 0;
- nextsrc:
- for (int i = 0; i < srcfield.length; i++ ) {
- /* Find this field in the dest*/
- for (int k = j; k < destfield.length; k++) {
- if (srcfield[i].getName().equals(destfield[k].getName())) {
- /* found match */
- if (srcfield[i].isPrimitive() &&
- !srcfield[i].typeEquals(destfield[k])) {
- // XXX I18N, logging needed
- throw new InvalidClassException(cl.getName(),
- "The type of field " +
- srcfield[i].getName() +
- " of class " + name +
- " is incompatible.");
- }
-
- /* Skip over any fields in the dest that are not in the src */
- j = k;
-
- srcfield[i].setField(destfield[j].getField());
- // go on to the next source field
- continue nextsrc;
- }
- }
- }
-
- /* Set up field data for use while reading from the input stream. */
- computeFieldInfo();
-
- /* Remember the class this represents */
- ofClass = cl;
-
- /* get the cache of these methods from the local class
- * implementation.
- */
- readObjectMethod = localClassDesc.readObjectMethod;
- readResolveObjectMethod = localClassDesc.readResolveObjectMethod;
- }
-
- /* Compare the base class names of streamName and localName.
- *
- * @return Return true iff the base class name compare.
- * @parameter streamName Fully qualified class name.
- * @parameter localName Fully qualified class name.
- * @parameter pkgSeparator class names use either '.' or '/'.
- *
- * Only compare base class name to allow package renaming.
- */
- static boolean compareClassNames(String streamName,
- String localName,
- char pkgSeparator) {
- /* compare the class names, stripping off package names. */
- int streamNameIndex = streamName.lastIndexOf(pkgSeparator);
- if (streamNameIndex < 0)
- streamNameIndex = 0;
-
- int localNameIndex = localName.lastIndexOf(pkgSeparator);
- if (localNameIndex < 0)
- localNameIndex = 0;
-
- return streamName.regionMatches(false, streamNameIndex,
- localName, localNameIndex,
- streamName.length() - streamNameIndex);
- }
-
- /*
- * Compare the types of two class descriptors.
- * They match if they have the same class name and suid
- */
- final boolean typeEquals(ObjectStreamClass other) {
- return (suid == other.suid) &&
- compareClassNames(name, other.name, '.');
- }
-
- /*
- * Return the superclass descriptor of this descriptor.
- */
- final void setSuperclass(ObjectStreamClass s) {
- superclass = s;
- }
-
- /*
- * Return the superclass descriptor of this descriptor.
- */
- final ObjectStreamClass getSuperclass() {
- return superclass;
- }
-
- /**
- * Return whether the class has a readObject method
- */
- final boolean hasReadObject() {
- return readObjectMethod != null;
- }
-
- /*
- * Return whether the class has a writeObject method
- */
- final boolean hasWriteObject() {
- return writeObjectMethod != null ;
- }
-
- /**
- * Returns when or not this class should be custom
- * marshaled (use chunking). This should happen if
- * it is Externalizable OR if it or
- * any of its superclasses has a writeObject method,
- */
- final boolean isCustomMarshaled() {
- return (hasWriteObject() || isExternalizable())
- || (superclass != null && superclass.isCustomMarshaled());
- }
-
- /*
- * Return true if all instances of 'this' Externalizable class
- * are written in block-data mode from the stream that 'this' was read
- * from. <p>
- *
- * In JDK 1.1, all Externalizable instances are not written
- * in block-data mode.
- * In JDK 1.2, all Externalizable instances, by default, are written
- * in block-data mode and the Externalizable instance is terminated with
- * tag TC_ENDBLOCKDATA. Change enabled the ability to skip Externalizable
- * instances.
- *
- * IMPLEMENTATION NOTE:
- * This should have been a mode maintained per stream; however,
- * for compatibility reasons, it was only possible to record
- * this change per class. All Externalizable classes within
- * a given stream should either have this mode enabled or
- * disabled. This is enforced by not allowing the PROTOCOL_VERSION
- * of a stream to he changed after any objects have been written.
- *
- * @see ObjectOutputStream#useProtocolVersion
- * @see ObjectStreamConstants#PROTOCOL_VERSION_1
- * @see ObjectStreamConstants#PROTOCOL_VERSION_2
- *
- * @since JDK 1.2
- */
- boolean hasExternalizableBlockDataMode() {
- return hasExternalizableBlockData;
- }
-
- /**
- * Creates a new instance of the represented class. If the class is
- * externalizable, invokes its public no-arg constructor; otherwise, if the
- * class is serializable, invokes the no-arg constructor of the first
- * non-serializable superclass. Throws UnsupportedOperationException if
- * this class descriptor is not associated with a class, if the associated
- * class is non-serializable or if the appropriate no-arg constructor is
- * inaccessible/unavailable.
- */
- Object newInstance()
- throws InstantiationException, InvocationTargetException,
- UnsupportedOperationException
- {
- if (cons != null) {
- try {
- return cons.newInstance(new Object[0]);
- } catch (IllegalAccessException ex) {
- // should not occur, as access checks have been suppressed
- InternalError ie = new InternalError();
- ie.initCause( ex ) ;
- throw ie ;
- }
- } else {
- throw new UnsupportedOperationException();
- }
- }
-
- /**
- * Returns public no-arg constructor of given class, or null if none found.
- * Access checks are disabled on the returned constructor (if any), since
- * the defining class may still be non-public.
- */
- private static Constructor getExternalizableConstructor(Class<?> cl) {
- try {
- Constructor cons = cl.getDeclaredConstructor(new Class<?>[0]);
- cons.setAccessible(true);
- return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ?
- cons : null;
- } catch (NoSuchMethodException ex) {
- return null;
- }
- }
-
- /**
- * Returns subclass-accessible no-arg constructor of first non-serializable
- * superclass, or null if none found. Access checks are disabled on the
- * returned constructor (if any).
- */
- private static Constructor getSerializableConstructor(Class<?> cl) {
- Class<?> initCl = cl;
- while (Serializable.class.isAssignableFrom(initCl)) {
- if ((initCl = initCl.getSuperclass()) == null) {
- return null;
- }
- }
- try {
- Constructor cons = initCl.getDeclaredConstructor(new Class<?>[0]);
- int mods = cons.getModifiers();
- if ((mods & Modifier.PRIVATE) != 0 ||
- ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 &&
- !packageEquals(cl, initCl)))
- {
- return null;
- }
- cons = bridge.newConstructorForSerialization(cl, cons);
- cons.setAccessible(true);
- return cons;
- } catch (NoSuchMethodException ex) {
- return null;
- }
- }
-
- /*
- * Return the ObjectStreamClass of the local class this one is based on.
- */
- final ObjectStreamClass localClassDescriptor() {
- return localClassDesc;
- }
-
- /*
- * Get the Serializability of the class.
- */
- boolean isSerializable() {
- return serializable;
- }
-
- /*
- * Get the externalizability of the class.
- */
- boolean isExternalizable() {
- return externalizable;
- }
-
- boolean isNonSerializable() {
- return ! (externalizable || serializable);
- }
-
- /*
- * Calculate the size of the array needed to store primitive data and the
- * number of object references to read when reading from the input
- * stream.
- */
- private void computeFieldInfo() {
- primBytes = 0;
- objFields = 0;
-
- for (int i = 0; i < fields.length; i++ ) {
- switch (fields[i].getTypeCode()) {
- case 'B':
- case 'Z':
- primBytes += 1;
- break;
- case 'C':
- case 'S':
- primBytes += 2;
- break;
-
- case 'I':
- case 'F':
- primBytes += 4;
- break;
- case 'J':
- case 'D' :
- primBytes += 8;
- break;
-
- case 'L':
- case '[':
- objFields += 1;
- break;
- }
- }
- }
-
- private static void msg( String str )
- {
- System.out.println( str ) ;
- }
-
- /* JDK 1.5 has introduced some new modifier bits (such as SYNTHETIC)
- * that can affect the SVUID computation (see bug 4897937). These bits
- * must be ignored, as otherwise interoperability with ORBs in earlier
- * JDK versions can be compromised. I am adding these masks for this
- * purpose as discussed in the CCC for this bug (see http://ccc.sfbay/4897937).
- */
-
- public static final int CLASS_MASK = Modifier.PUBLIC | Modifier.FINAL |
- Modifier.INTERFACE | Modifier.ABSTRACT ;
- public static final int FIELD_MASK = Modifier.PUBLIC | Modifier.PRIVATE |
- Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL |
- Modifier.TRANSIENT | Modifier.VOLATILE ;
- public static final int METHOD_MASK = Modifier.PUBLIC | Modifier.PRIVATE |
- Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL |
- Modifier.SYNCHRONIZED | Modifier.NATIVE | Modifier.ABSTRACT |
- Modifier.STRICT ;
-
- /*
- * Compute a hash for the specified class. Incrementally add
- * items to the hash accumulating in the digest stream.
- * Fold the hash into a long. Use the SHA secure hash function.
- */
- private static long _computeSerialVersionUID(Class<?> cl) {
- if (DEBUG_SVUID)
- msg( "Computing SerialVersionUID for " + cl ) ;
- ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
-
- long h = 0;
- try {
- MessageDigest md = MessageDigest.getInstance("SHA");
- DigestOutputStream mdo = new DigestOutputStream(devnull, md);
- DataOutputStream data = new DataOutputStream(mdo);
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + cl.getName() + "\" )" ) ;
- data.writeUTF(cl.getName());
-
- int classaccess = cl.getModifiers();
- classaccess &= (Modifier.PUBLIC | Modifier.FINAL |
- Modifier.INTERFACE | Modifier.ABSTRACT);
-
- /* Workaround for javac bug that only set ABSTRACT for
- * interfaces if the interface had some methods.
- * The ABSTRACT bit reflects that the number of methods > 0.
- * This is required so correct hashes can be computed
- * for existing class files.
- * Previously this hack was previously present in the VM.
- */
- Method[] method = cl.getDeclaredMethods();
- if ((classaccess & Modifier.INTERFACE) != 0) {
- classaccess &= (~Modifier.ABSTRACT);
- if (method.length > 0) {
- classaccess |= Modifier.ABSTRACT;
- }
- }
-
- // Mask out any post-1.4 attributes
- classaccess &= CLASS_MASK ;
-
- if (DEBUG_SVUID)
- msg( "\twriteInt( " + classaccess + " ) " ) ;
- data.writeInt(classaccess);
-
- /*
- * Get the list of interfaces supported,
- * Accumulate their names their names in Lexical order
- * and add them to the hash
- */
- if (!cl.isArray()) {
- /* In 1.2fcs, getInterfaces() was modified to return
- * {java.lang.Cloneable, java.io.Serializable} when
- * called on array classes. These values would upset
- * the computation of the hash, so we explicitly omit
- * them from its computation.
- */
-
- Class<?> interfaces[] = cl.getInterfaces();
- Arrays.sort(interfaces, compareClassByName);
-
- for (int i = 0; i < interfaces.length; i++) {
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + interfaces[i].getName() + "\" ) " ) ;
- data.writeUTF(interfaces[i].getName());
- }
- }
-
- /* Sort the field names to get a deterministic order */
- Field[] field = cl.getDeclaredFields();
- Arrays.sort(field, compareMemberByName);
-
- for (int i = 0; i < field.length; i++) {
- Field f = field[i];
-
- /* Include in the hash all fields except those that are
- * private transient and private static.
- */
- int m = f.getModifiers();
- if (Modifier.isPrivate(m) &&
- (Modifier.isTransient(m) || Modifier.isStatic(m)))
- continue;
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + f.getName() + "\" ) " ) ;
- data.writeUTF(f.getName());
-
- // Mask out any post-1.4 bits
- m &= FIELD_MASK ;
-
- if (DEBUG_SVUID)
- msg( "\twriteInt( " + m + " ) " ) ;
- data.writeInt(m);
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + getSignature(f.getType()) + "\" ) " ) ;
- data.writeUTF(getSignature(f.getType()));
- }
-
- if (hasStaticInitializer(cl)) {
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"<clinit>\" ) " ) ;
- data.writeUTF("<clinit>");
-
- if (DEBUG_SVUID)
- msg( "\twriteInt( " + Modifier.STATIC + " )" ) ;
- data.writeInt(Modifier.STATIC); // TBD: what modifiers does it have
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"()V\" )" ) ;
- data.writeUTF("()V");
- }
-
- /*
- * Get the list of constructors including name and signature
- * Sort lexically, add all except the private constructors
- * to the hash with their access flags
- */
-
- MethodSignature[] constructors =
- MethodSignature.removePrivateAndSort(cl.getDeclaredConstructors());
- for (int i = 0; i < constructors.length; i++) {
- MethodSignature c = constructors[i];
- String mname = "<init>";
- String desc = c.signature;
- desc = desc.replace('/', '.');
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + mname + "\" )" ) ;
- data.writeUTF(mname);
-
- // mask out post-1.4 modifiers
- int modifier = c.member.getModifiers() & METHOD_MASK ;
-
- if (DEBUG_SVUID)
- msg( "\twriteInt( " + modifier + " ) " ) ;
- data.writeInt( modifier ) ;
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + desc+ "\" )" ) ;
- data.writeUTF(desc);
- }
-
- /* Include in the hash all methods except those that are
- * private transient and private static.
- */
- MethodSignature[] methods =
- MethodSignature.removePrivateAndSort(method);
- for (int i = 0; i < methods.length; i++ ) {
- MethodSignature m = methods[i];
- String desc = m.signature;
- desc = desc.replace('/', '.');
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + m.member.getName()+ "\" )" ) ;
- data.writeUTF(m.member.getName());
-
- // mask out post-1.4 modifiers
- int modifier = m.member.getModifiers() & METHOD_MASK ;
-
- if (DEBUG_SVUID)
- msg( "\twriteInt( " + modifier + " ) " ) ;
- data.writeInt( modifier ) ;
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + desc + "\" )" ) ;
- data.writeUTF(desc);
- }
-
- /* Compute the hash value for this class.
- * Use only the first 64 bits of the hash.
- */
- data.flush();
- byte hasharray[] = md.digest();
- for (int i = 0; i < Math.min(8, hasharray.length); i++) {
- h += (long)(hasharray[i] & 255) << (i * 8);
- }
- } catch (IOException ignore) {
- /* can't happen, but be deterministic anyway. */
- h = -1;
- } catch (NoSuchAlgorithmException complain) {
- SecurityException se = new SecurityException() ;
- se.initCause( complain ) ;
- throw se ;
- }
-
- return h;
- }
-
- private static long computeStructuralUID(com.sun.corba.se.impl.io.ObjectStreamClass osc, Class<?> cl) {
- ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
-
- long h = 0;
- try {
-
- if ((!java.io.Serializable.class.isAssignableFrom(cl)) ||
- (cl.isInterface())){
- return 0;
- }
-
- if (java.io.Externalizable.class.isAssignableFrom(cl)) {
- return 1;
- }
-
- MessageDigest md = MessageDigest.getInstance("SHA");
- DigestOutputStream mdo = new DigestOutputStream(devnull, md);
- DataOutputStream data = new DataOutputStream(mdo);
-
- // Get SUID of parent
- Class<?> parent = cl.getSuperclass();
- if ((parent != null))
- // SerialBug 1; acc. to spec the one for
- // java.lang.object
- // should be computed and put
- // && (parent != java.lang.Object.class))
- {
- //data.writeLong(computeSerialVersionUID(null,parent));
- data.writeLong(computeStructuralUID(lookup(parent), parent));
- }
-
- if (osc.hasWriteObject())
- data.writeInt(2);
- else
- data.writeInt(1);
-
- // CORBA formal 00-11-03 10.6.2: For each field of the
- // class that is mapped to IDL, sorted lexicographically
- // by Java field name, in increasing order...
- ObjectStreamField[] field = osc.getFields();
- if (field.length > 1) {
- Arrays.sort(field, compareObjStrFieldsByName);
- }
-
- // ...Java field name in UTF encoding, field
- // descriptor, as defined by the JVM spec...
- for (int i = 0; i < field.length; i++) {
- data.writeUTF(field[i].getName());
- data.writeUTF(field[i].getSignature());
- }
-
- /* Compute the hash value for this class.
- * Use only the first 64 bits of the hash.
- */
- data.flush();
- byte hasharray[] = md.digest();
- // int minimum = Math.min(8, hasharray.length);
- // SerialBug 3: SHA computation is wrong; for loop reversed
- //for (int i = minimum; i > 0; i--)
- for (int i = 0; i < Math.min(8, hasharray.length); i++) {
- h += (long)(hasharray[i] & 255) << (i * 8);
- }
- } catch (IOException ignore) {
- /* can't happen, but be deterministic anyway. */
- h = -1;
- } catch (NoSuchAlgorithmException complain) {
- SecurityException se = new SecurityException();
- se.initCause( complain ) ;
- throw se ;
- }
- return h;
- }
-
- /**
- * Compute the JVM signature for the class.
- */
- static String getSignature(Class<?> clazz) {
- String type = null;
- if (clazz.isArray()) {
- Class<?> cl = clazz;
- int dimensions = 0;
- while (cl.isArray()) {
- dimensions++;
- cl = cl.getComponentType();
- }
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < dimensions; i++) {
- sb.append("[");
- }
- sb.append(getSignature(cl));
- type = sb.toString();
- } else if (clazz.isPrimitive()) {
- if (clazz == Integer.TYPE) {
- type = "I";
- } else if (clazz == Byte.TYPE) {
- type = "B";
- } else if (clazz == Long.TYPE) {
- type = "J";
- } else if (clazz == Float.TYPE) {
- type = "F";
- } else if (clazz == Double.TYPE) {
- type = "D";
- } else if (clazz == Short.TYPE) {
- type = "S";
- } else if (clazz == Character.TYPE) {
- type = "C";
- } else if (clazz == Boolean.TYPE) {
- type = "Z";
- } else if (clazz == Void.TYPE) {
- type = "V";
- }
- } else {
- type = "L" + clazz.getName().replace('.', '/') + ";";
- }
- return type;
- }
-
- /*
- * Compute the JVM method descriptor for the method.
- */
- static String getSignature(Method meth) {
- StringBuffer sb = new StringBuffer();
-
- sb.append("(");
-
- Class<?>[] params = meth.getParameterTypes(); // avoid clone
- for (int j = 0; j < params.length; j++) {
- sb.append(getSignature(params[j]));
- }
- sb.append(")");
- sb.append(getSignature(meth.getReturnType()));
- return sb.toString();
- }
-
- /*
- * Compute the JVM constructor descriptor for the constructor.
- */
- static String getSignature(Constructor cons) {
- StringBuffer sb = new StringBuffer();
-
- sb.append("(");
-
- Class<?>[] params = cons.getParameterTypes(); // avoid clone
- for (int j = 0; j < params.length; j++) {
- sb.append(getSignature(params[j]));
- }
- sb.append(")V");
- return sb.toString();
- }
-
- /*
- * Cache of Class -> ClassDescriptor Mappings.
- */
- static private ObjectStreamClassEntry[] descriptorFor = new ObjectStreamClassEntry[61];
-
- /*
- * findDescriptorFor a Class. This looks in the cache for a
- * mapping from Class -> ObjectStreamClass mappings. The hashCode
- * of the Class is used for the lookup since the Class is the key.
- * The entries are extended from java.lang.ref.SoftReference so the
- * gc will be able to free them if needed.
- */
- private static ObjectStreamClass findDescriptorFor(Class<?> cl) {
-
- int hash = cl.hashCode();
- int index = (hash & 0x7FFFFFFF) % descriptorFor.length;
- ObjectStreamClassEntry e;
- ObjectStreamClassEntry prev;
-
- /* Free any initial entries whose refs have been cleared */
- while ((e = descriptorFor[index]) != null && e.get() == null) {
- descriptorFor[index] = e.next;
- }
-
- /* Traverse the chain looking for a descriptor with ofClass == cl.
- * unlink entries that are unresolved.
- */
- prev = e;
- while (e != null ) {
- ObjectStreamClass desc = (ObjectStreamClass)(e.get());
- if (desc == null) {
- // This entry has been cleared, unlink it
- prev.next = e.next;
- } else {
- if (desc.ofClass == cl)
- return desc;
- prev = e;
- }
- e = e.next;
- }
- return null;
- }
-
- /*
- * insertDescriptorFor a Class -> ObjectStreamClass mapping.
- */
- private static void insertDescriptorFor(ObjectStreamClass desc) {
- // Make sure not already present
- if (findDescriptorFor(desc.ofClass) != null) {
- return;
- }
-
- int hash = desc.ofClass.hashCode();
- int index = (hash & 0x7FFFFFFF) % descriptorFor.length;
- ObjectStreamClassEntry e = new ObjectStreamClassEntry(desc);
- e.next = descriptorFor[index];
- descriptorFor[index] = e;
- }
-
- private static Field[] getDeclaredFields(final Class<?> clz) {
- return (Field[]) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return clz.getDeclaredFields();
- }
- });
- }
-
-
- /*
- * The name of this descriptor
- */
- private String name;
-
- /*
- * The descriptor of the supertype.
- */
- private ObjectStreamClass superclass;
-
- /*
- * Flags for Serializable and Externalizable.
- */
- private boolean serializable;
- private boolean externalizable;
-
- /*
- * Array of persistent fields of this class, sorted by
- * type and name.
- */
- private ObjectStreamField[] fields;
-
- /*
- * Class that is a descriptor for in this virtual machine.
- */
- private Class<?> ofClass;
-
- /*
- * True if descriptor for a proxy class.
- */
- boolean forProxyClass;
-
-
- /*
- * SerialVersionUID for this class.
- */
- private long suid = kDefaultUID;
- private String suidStr = null;
-
- /*
- * Actual (computed) SerialVersionUID for this class.
- */
- private long actualSuid = kDefaultUID;
- private String actualSuidStr = null;
-
- /*
- * The total number of bytes of primitive fields.
- * The total number of object fields.
- */
- int primBytes;
- int objFields;
-
- /**
- * Flag indicating whether or not this instance has
- * successfully completed initialization. This is to
- * try to fix bug 4373844. Working to move to
- * reusing java.io.ObjectStreamClass for JDK 1.5.
- */
- private boolean initialized = false;
-
- /* Internal lock object. */
- private Object lock = new Object();
-
- /* In JDK 1.1, external data was not written in block mode.
- * As of JDK 1.2, external data is written in block data mode. This
- * flag enables JDK 1.2 to be able to read JDK 1.1 written external data.
- *
- * @since JDK 1.2
- */
- private boolean hasExternalizableBlockData;
- Method writeObjectMethod;
- Method readObjectMethod;
- private transient Method writeReplaceObjectMethod;
- private transient Method readResolveObjectMethod;
- private Constructor cons ;
-
- /**
- * Beginning in Java to IDL ptc/02-01-12, RMI-IIOP has a
- * stream format version 2 which puts a fake valuetype around
- * a Serializable's optional custom data. This valuetype has
- * a special repository ID made from the Serializable's
- * information which we are pre-computing and
- * storing here.
- */
- private String rmiiiopOptionalDataRepId = null;
-
- /*
- * ObjectStreamClass that this one was built from.
- */
- private ObjectStreamClass localClassDesc;
-
- /* Find out if the class has a static class initializer <clinit> */
- private static Method hasStaticInitializerMethod = null;
- /**
- * Returns true if the given class defines a static initializer method,
- * false otherwise.
- */
- private static boolean hasStaticInitializer(Class<?> cl) {
- if (hasStaticInitializerMethod == null) {
- Class<?> classWithThisMethod = null;
-
- try {
- if (classWithThisMethod == null)
- classWithThisMethod = java.io.ObjectStreamClass.class;
-
- hasStaticInitializerMethod =
- classWithThisMethod.getDeclaredMethod("hasStaticInitializer",
- new Class<?>[] { Class.class });
- } catch (NoSuchMethodException ex) {
- }
-
- if (hasStaticInitializerMethod == null) {
- // XXX I18N, logging needed
- throw new InternalError("Can't find hasStaticInitializer method on "
- + classWithThisMethod.getName());
- }
- hasStaticInitializerMethod.setAccessible(true);
- }
-
- try {
- Boolean retval = (Boolean)
- hasStaticInitializerMethod.invoke(null, new Object[] { cl });
- return retval.booleanValue();
- } catch (Exception ex) {
- // XXX I18N, logging needed
- InternalError ie = new InternalError( "Error invoking hasStaticInitializer" ) ;
- ie.initCause( ex ) ;
- throw ie ;
- }
- }
-
-
- /** use serialVersionUID from JDK 1.1. for interoperability */
- private static final long serialVersionUID = -6120832682080437368L;
-
- /**
- * Set serialPersistentFields of a Serializable class to this value to
- * denote that the class has no Serializable fields.
- */
- public static final ObjectStreamField[] NO_FIELDS =
- new ObjectStreamField[0];
-
- /*
- * Entries held in the Cache of known ObjectStreamClass objects.
- * Entries are chained together with the same hash value (modulo array size).
- */
- private static class ObjectStreamClassEntry // extends java.lang.ref.SoftReference
- {
- ObjectStreamClassEntry(ObjectStreamClass c) {
- //super(c);
- this.c = c;
- }
- ObjectStreamClassEntry next;
-
- public Object get()
- {
- return c;
- }
- private ObjectStreamClass c;
- }
-
- /*
- * Comparator object for Classes and Interfaces
- */
- private static Comparator compareClassByName =
- new CompareClassByName();
-
- private static class CompareClassByName implements Comparator {
- public int compare(Object o1, Object o2) {
- Class<?> c1 = (Class)o1;
- Class<?> c2 = (Class)o2;
- return (c1.getName()).compareTo(c2.getName());
- }
- }
-
- /**
- * Comparator for ObjectStreamFields by name
- */
- private final static Comparator compareObjStrFieldsByName
- = new CompareObjStrFieldsByName();
-
- private static class CompareObjStrFieldsByName implements Comparator {
- public int compare(Object o1, Object o2) {
- ObjectStreamField osf1 = (ObjectStreamField)o1;
- ObjectStreamField osf2 = (ObjectStreamField)o2;
-
- return osf1.getName().compareTo(osf2.getName());
- }
- }
-
- /*
- * Comparator object for Members, Fields, and Methods
- */
- private static Comparator compareMemberByName =
- new CompareMemberByName();
-
- private static class CompareMemberByName implements Comparator {
- public int compare(Object o1, Object o2) {
- String s1 = ((Member)o1).getName();
- String s2 = ((Member)o2).getName();
-
- if (o1 instanceof Method) {
- s1 += getSignature((Method)o1);
- s2 += getSignature((Method)o2);
- } else if (o1 instanceof Constructor) {
- s1 += getSignature((Constructor)o1);
- s2 += getSignature((Constructor)o2);
- }
- return s1.compareTo(s2);
- }
- }
-
- /* It is expensive to recompute a method or constructor signature
- many times, so compute it only once using this data structure. */
- private static class MethodSignature implements Comparator {
- Member member;
- String signature; // cached parameter signature
-
- /* Given an array of Method or Constructor members,
- return a sorted array of the non-private members.*/
- /* A better implementation would be to implement the returned data
- structure as an insertion sorted link list.*/
- static MethodSignature[] removePrivateAndSort(Member[] m) {
- int numNonPrivate = 0;
- for (int i = 0; i < m.length; i++) {
- if (! Modifier.isPrivate(m[i].getModifiers())) {
- numNonPrivate++;
- }
- }
- MethodSignature[] cm = new MethodSignature[numNonPrivate];
- int cmi = 0;
- for (int i = 0; i < m.length; i++) {
- if (! Modifier.isPrivate(m[i].getModifiers())) {
- cm[cmi] = new MethodSignature(m[i]);
- cmi++;
- }
- }
- if (cmi > 0)
- Arrays.sort(cm, cm[0]);
- return cm;
- }
-
- /* Assumes that o1 and o2 are either both methods
- or both constructors.*/
- public int compare(Object o1, Object o2) {
- /* Arrays.sort calls compare when o1 and o2 are equal.*/
- if (o1 == o2)
- return 0;
-
- MethodSignature c1 = (MethodSignature)o1;
- MethodSignature c2 = (MethodSignature)o2;
-
- int result;
- if (isConstructor()) {
- result = c1.signature.compareTo(c2.signature);
- } else { // is a Method.
- result = c1.member.getName().compareTo(c2.member.getName());
- if (result == 0)
- result = c1.signature.compareTo(c2.signature);
- }
- return result;
- }
-
- final private boolean isConstructor() {
- return member instanceof Constructor;
- }
- private MethodSignature(Member m) {
- member = m;
- if (isConstructor()) {
- signature = ObjectStreamClass.getSignature((Constructor)m);
- } else {
- signature = ObjectStreamClass.getSignature((Method)m);
- }
- }
- }
-
- /**
- * Returns non-static, non-abstract method with given signature provided it
- * is defined by or accessible (via inheritance) by the given class, or
- * null if no match found. Access checks are disabled on the returned
- * method (if any).
- *
- * Copied from the Merlin java.io.ObjectStreamClass.
- */
- private static Method getInheritableMethod(Class<?> cl, String name,
- Class<?>[] argTypes,
- Class<?> returnType)
- {
- Method meth = null;
- Class<?> defCl = cl;
- while (defCl != null) {
- try {
- meth = defCl.getDeclaredMethod(name, argTypes);
- break;
- } catch (NoSuchMethodException ex) {
- defCl = defCl.getSuperclass();
- }
- }
-
- if ((meth == null) || (meth.getReturnType() != returnType)) {
- return null;
- }
- meth.setAccessible(true);
- int mods = meth.getModifiers();
- if ((mods & (Modifier.STATIC | Modifier.ABSTRACT)) != 0) {
- return null;
- } else if ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0) {
- return meth;
- } else if ((mods & Modifier.PRIVATE) != 0) {
- return (cl == defCl) ? meth : null;
- } else {
- return packageEquals(cl, defCl) ? meth : null;
- }
- }
-
- /**
- * Returns true if classes are defined in the same package, false
- * otherwise.
- *
- * Copied from the Merlin java.io.ObjectStreamClass.
- */
- private static boolean packageEquals(Class<?> cl1, Class<?> cl2) {
- Package pkg1 = cl1.getPackage(), pkg2 = cl2.getPackage();
- return ((pkg1 == pkg2) || ((pkg1 != null) && (pkg1.equals(pkg2))));
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClassCorbaExt.java b/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClassCorbaExt.java
deleted file mode 100644
index 8f54e25..0000000
--- a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClassCorbaExt.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, 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.
- */
-
-package com.sun.corba.se.impl.io;
-
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedAction;
-
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-
-
-// This file contains some utility methods that
-// originally were in the OSC in the RMI-IIOP
-// code delivered by IBM. They don't make
-// sense there, and hence have been put
-// here so that they can be factored out in
-// an attempt to eliminate redundant code from
-// ObjectStreamClass. Eventually the goal is
-// to move to java.io.ObjectStreamClass, and
-// java.io.ObjectStreamField.
-
-// class is package private for security reasons
-
-class ObjectStreamClassCorbaExt {
-
- /**
- * Return true, iff,
- *
- * 1. 'cl' is an interface, and
- * 2. 'cl' and all its ancestors do not implement java.rmi.Remote, and
- * 3. if 'cl' has no methods (including those of its ancestors), or,
- * if all the methods (including those of its ancestors) throw an
- * exception that is atleast java.rmi.RemoteException or one of
- * java.rmi.RemoteException's super classes.
- */
- static final boolean isAbstractInterface(Class cl) {
- if (!cl.isInterface() || // #1
- java.rmi.Remote.class.isAssignableFrom(cl)) { // #2
- return false;
- }
- Method[] methods = cl.getMethods();
- for (int i = 0; i < methods.length; i++) {
- Class exceptions[] = methods[i].getExceptionTypes();
- boolean exceptionMatch = false;
- for (int j = 0; (j < exceptions.length) && !exceptionMatch; j++) {
- if ((java.rmi.RemoteException.class == exceptions[j]) ||
- (java.lang.Throwable.class == exceptions[j]) ||
- (java.lang.Exception.class == exceptions[j]) ||
- (java.io.IOException.class == exceptions[j])) {
- exceptionMatch = true;
- }
- }
- if (!exceptionMatch) {
- return false;
- }
- }
- return true;
- }
-
- /*
- * Returns TRUE if type is 'any'.
- */
- static final boolean isAny(String typeString) {
-
- int isAny = 0;
-
- if ( (typeString != null) &&
- (typeString.equals("Ljava/lang/Object;") ||
- typeString.equals("Ljava/io/Serializable;") ||
- typeString.equals("Ljava/io/Externalizable;")) )
- isAny = 1;
-
- return (isAny==1);
- }
-
- private static final Method[] getDeclaredMethods(final Class clz) {
- return (Method[]) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return clz.getDeclaredMethods();
- }
- });
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamField.java b/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamField.java
deleted file mode 100644
index 0fa0f99..0000000
--- a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamField.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright (c) 1998, 2004, 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.
- */
-
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import java.lang.reflect.Field;
-import java.lang.Comparable;
-import java.util.Hashtable;
-
-import sun.corba.Bridge ;
-import java.security.AccessController ;
-import java.security.PrivilegedAction ;
-
-/**
- * A description of a field in a serializable class.
- * A array of these is used to declare the persistent fields of
- * a class.
- *
- */
-public class ObjectStreamField implements Comparable
-{
- private static final Bridge bridge =
- (Bridge)AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
- return Bridge.get() ;
- }
- }
- ) ;
-
- /**
- * Create a named field with the specified type.
- */
- ObjectStreamField(String n, Class clazz) {
- name = n;
- this.clazz = clazz;
-
- // Compute the typecode for easy switching
- if (clazz.isPrimitive()) {
- if (clazz == Integer.TYPE) {
- type = 'I';
- } else if (clazz == Byte.TYPE) {
- type = 'B';
- } else if (clazz == Long.TYPE) {
- type = 'J';
- } else if (clazz == Float.TYPE) {
- type = 'F';
- } else if (clazz == Double.TYPE) {
- type = 'D';
- } else if (clazz == Short.TYPE) {
- type = 'S';
- } else if (clazz == Character.TYPE) {
- type = 'C';
- } else if (clazz == Boolean.TYPE) {
- type = 'Z';
- }
- } else if (clazz.isArray()) {
- type = '[';
- typeString = ObjectStreamClass.getSignature(clazz);
- } else {
- type = 'L';
- typeString = ObjectStreamClass.getSignature(clazz);
- }
-
- if (typeString != null)
- signature = typeString;
- else
- signature = String.valueOf(type);
-
- }
-
- ObjectStreamField(Field field) {
- this(field.getName(), field.getType());
- setField( field ) ;
- }
-
- /**
- * Create an ObjectStreamField containing a reflected Field.
- */
- ObjectStreamField(String n, char t, Field f, String ts)
- {
- name = n;
- type = t;
- setField( f ) ;
- typeString = ts;
-
- if (typeString != null)
- signature = typeString;
- else
- signature = String.valueOf(type);
-
- }
-
- /**
- * Get the name of this field.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Get the type of the field.
- */
- public Class getType() {
- if (clazz != null)
- return clazz;
- switch (type) {
- case 'B': clazz = Byte.TYPE;
- break;
- case 'C': clazz = Character.TYPE;
- break;
- case 'S': clazz = Short.TYPE;
- break;
- case 'I': clazz = Integer.TYPE;
- break;
- case 'J': clazz = Long.TYPE;
- break;
- case 'F': clazz = Float.TYPE;
- break;
- case 'D': clazz = Double.TYPE;
- break;
- case 'Z': clazz = Boolean.TYPE;
- break;
- case '[':
- case 'L':
- clazz = Object.class;
- break;
- }
-
- return clazz;
- }
-
- public char getTypeCode() {
- return type;
- }
-
- public String getTypeString() {
- return typeString;
- }
-
- Field getField() {
- return field;
- }
-
- void setField(Field field) {
- this.field = field;
- this.fieldID = bridge.objectFieldOffset( field ) ;
- }
-
- /*
- * Default constructor creates an empty field.
- * Usually used just to get to the sort functions.
- */
- ObjectStreamField() {
- }
-
- /**
- * test if this field is a primitive or not.
- */
- public boolean isPrimitive() {
- return (type != '[' && type != 'L');
- }
-
- /**
- * Compare this with another ObjectStreamField.
- * return -1 if this is smaller, 0 if equal, 1 if greater
- * types that are primitives are "smaller" than objects.
- * if equal, the names are compared.
- */
- public int compareTo(Object o) {
- ObjectStreamField f2 = (ObjectStreamField)o;
- boolean thisprim = (this.typeString == null);
- boolean otherprim = (f2.typeString == null);
-
- if (thisprim != otherprim) {
- return (thisprim ? -1 : 1);
- }
- return this.name.compareTo(f2.name);
- }
-
- /**
- * Compare the types of two class descriptors.
- * The match if they have the same primitive types.
- * or if they are both objects and the object types match.
- */
- public boolean typeEquals(ObjectStreamField other) {
- if (other == null || type != other.type)
- return false;
-
- /* Return true if the primitive types matched */
- if (typeString == null && other.typeString == null)
- return true;
-
- return ObjectStreamClass.compareClassNames(typeString,
- other.typeString,
- '/');
- }
-
- /* Returns the signature of the Field.
- *
- */
- public String getSignature() {
-
- return signature;
-
- }
-
- /**
- * Return a string describing this field.
- */
- public String toString() {
- if (typeString != null)
- return typeString + " " + name;
- else
- return type + " " + name;
- }
-
- public Class getClazz() {
- return clazz;
- }
-
- /* Returns the Field ID
- *
- */
- public long getFieldID() {
- return fieldID ;
- }
-
- private String name; // the name of the field
- private char type; // type first byte of the type signature
- private Field field; // Reflected field
- private String typeString; // iff object, typename
- private Class clazz; // the type of this field, if has been resolved
-
- // the next 2 things are RMI-IIOP specific, it can be easily
- // removed, if we can figure out all place where there are dependencies
- // to this. Signature is esentially equal to typestring. Then
- // essentially we can use the java.io.ObjectStreamField as such.
-
- private String signature; // the signature of the field
- private long fieldID = Bridge.INVALID_FIELD_OFFSET ;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/io/OptionalDataException.java b/src/share/classes/com/sun/corba/se/impl/io/OptionalDataException.java
deleted file mode 100644
index 89228fd..0000000
--- a/src/share/classes/com/sun/corba/se/impl/io/OptionalDataException.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 1998, 2002, 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.
- */
-
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-/**
- * Unexpected data appeared in an ObjectInputStream trying to read
- * an Object.
- * This exception occurs when the stream contains primitive data
- * instead of the object expected by readObject.
- * The eof flag in the exception is true to indicate that no more
- * primitive data is available.
- * The count field contains the number of bytes available to read.
- *
- * @author unascribed
- * @since JDK1.1
- */
-public class OptionalDataException extends java.io.IOException {
- /*
- * Create an <code>OptionalDataException</code> with a length.
- */
- OptionalDataException(int len) {
- eof = false;
- length = len;
- }
-
- /*
- * Create an <code>OptionalDataException</code> signifing no
- * more primitive data is available.
- */
- OptionalDataException(boolean end) {
- length = 0;
- eof = end;
- }
-
- /**
- * The number of bytes of primitive data available to be read
- * in the current buffer.
- */
- public int length;
-
- /**
- * True if there is no more data in the buffered part of the stream.
- */
- public boolean eof;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java b/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java
deleted file mode 100644
index 79ef01e..0000000
--- a/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Copyright (c) 1999, 2015, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import java.io.IOException;
-import java.io.NotActiveException;
-import java.io.OutputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectOutput;
-import java.util.Map;
-import java.util.HashMap;
-
-import org.omg.CORBA.INTERNAL;
-
-public abstract class OutputStreamHook extends ObjectOutputStream
-{
- private HookPutFields putFields = null;
-
- /**
- * Since ObjectOutputStream.PutField methods specify no exceptions,
- * we are not checking for null parameters on put methods.
- */
- private class HookPutFields extends ObjectOutputStream.PutField
- {
- private Map<String,Object> fields = new HashMap<>();
-
- /**
- * Put the value of the named boolean field into the persistent field.
- */
- public void put(String name, boolean value){
- fields.put(name, new Boolean(value));
- }
-
- /**
- * Put the value of the named char field into the persistent fields.
- */
- public void put(String name, char value){
- fields.put(name, new Character(value));
- }
-
- /**
- * Put the value of the named byte field into the persistent fields.
- */
- public void put(String name, byte value){
- fields.put(name, new Byte(value));
- }
-
- /**
- * Put the value of the named short field into the persistent fields.
- */
- public void put(String name, short value){
- fields.put(name, new Short(value));
- }
-
- /**
- * Put the value of the named int field into the persistent fields.
- */
- public void put(String name, int value){
- fields.put(name, new Integer(value));
- }
-
- /**
- * Put the value of the named long field into the persistent fields.
- */
- public void put(String name, long value){
- fields.put(name, new Long(value));
- }
-
- /**
- * Put the value of the named float field into the persistent fields.
- *
- */
- public void put(String name, float value){
- fields.put(name, new Float(value));
- }
-
- /**
- * Put the value of the named double field into the persistent field.
- */
- public void put(String name, double value){
- fields.put(name, new Double(value));
- }
-
- /**
- * Put the value of the named Object field into the persistent field.
- */
- public void put(String name, Object value){
- fields.put(name, value);
- }
-
- /**
- * Write the data and fields to the specified ObjectOutput stream.
- */
- public void write(ObjectOutput out) throws IOException {
- OutputStreamHook hook = (OutputStreamHook)out;
-
- ObjectStreamField[] osfields = hook.getFieldsNoCopy();
-
- // Write the fields to the stream in the order
- // provided by the ObjectStreamClass. (They should
- // be sorted appropriately already.)
- for (int i = 0; i < osfields.length; i++) {
-
- Object value = fields.get(osfields[i].getName());
-
- hook.writeField(osfields[i], value);
- }
- }
- }
-
- abstract void writeField(ObjectStreamField field, Object value) throws IOException;
-
- public OutputStreamHook()
- throws java.io.IOException {
- super();
- }
-
- public void defaultWriteObject() throws IOException {
-
- writeObjectState.defaultWriteObject(this);
-
- defaultWriteObjectDelegate();
- }
-
- public abstract void defaultWriteObjectDelegate();
-
- public ObjectOutputStream.PutField putFields()
- throws IOException {
- if (putFields == null) {
- putFields = new HookPutFields();
- }
- return putFields;
- }
-
- // Stream format version, saved/restored during recursive calls
- protected byte streamFormatVersion = 1;
-
- // Return the stream format version currently being used
- // to serialize an object
- public byte getStreamFormatVersion() {
- return streamFormatVersion;
- }
-
- abstract ObjectStreamField[] getFieldsNoCopy();
-
- // User uses PutFields to simulate default data.
- // See java.io.ObjectOutputStream.PutFields
- public void writeFields()
- throws IOException {
-
- writeObjectState.defaultWriteObject(this);
- if (putFields != null) {
- putFields.write(this);
- } else {
- throw new NotActiveException("no current PutField object");
- }
- }
-
- abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();
-
- protected abstract void beginOptionalCustomData();
-
-
- // The following is a State pattern implementation of what
- // should be done when a Serializable has a
- // writeObject method. This was especially necessary for
- // RMI-IIOP stream format version 2. Please see the
- // state diagrams in the docs directory of the workspace.
-
- protected WriteObjectState writeObjectState = NOT_IN_WRITE_OBJECT;
-
- protected void setState(WriteObjectState newState) {
- writeObjectState = newState;
- }
-
- // Description of possible actions
- protected static class WriteObjectState {
- public void enterWriteObject(OutputStreamHook stream) throws IOException {}
- public void exitWriteObject(OutputStreamHook stream) throws IOException {}
- public void defaultWriteObject(OutputStreamHook stream) throws IOException {}
- public void writeData(OutputStreamHook stream) throws IOException {}
- }
-
- protected static class DefaultState extends WriteObjectState {
- public void enterWriteObject(OutputStreamHook stream) throws IOException {
- stream.setState(IN_WRITE_OBJECT);
- }
- }
-
- protected static final WriteObjectState NOT_IN_WRITE_OBJECT = new DefaultState();
- protected static final WriteObjectState IN_WRITE_OBJECT = new InWriteObjectState();
- protected static final WriteObjectState WROTE_DEFAULT_DATA = new WroteDefaultDataState();
- protected static final WriteObjectState WROTE_CUSTOM_DATA = new WroteCustomDataState();
-
- protected static class InWriteObjectState extends WriteObjectState {
-
- public void enterWriteObject(OutputStreamHook stream) throws IOException {
- // XXX I18N, logging needed.
- throw new IOException("Internal state failure: Entered writeObject twice");
- }
-
- public void exitWriteObject(OutputStreamHook stream) throws IOException {
-
- // We didn't write any data, so write the
- // called defaultWriteObject indicator as false
- stream.getOrbStream().write_boolean(false);
-
- // If we're in stream format verison 2, we must
- // put the "null" marker to say that there isn't
- // any optional data
- if (stream.getStreamFormatVersion() == 2)
- stream.getOrbStream().write_long(0);
-
- stream.setState(NOT_IN_WRITE_OBJECT);
- }
-
- public void defaultWriteObject(OutputStreamHook stream) throws IOException {
-
- // The writeObject method called defaultWriteObject
- // or writeFields, so put the called defaultWriteObject
- // indicator as true
- stream.getOrbStream().write_boolean(true);
-
- stream.setState(WROTE_DEFAULT_DATA);
- }
-
- public void writeData(OutputStreamHook stream) throws IOException {
-
- // The writeObject method first called a direct
- // write operation. Write the called defaultWriteObject
- // indicator as false, put the special stream format
- // version 2 header (if stream format version 2, of course),
- // and write the data
- stream.getOrbStream().write_boolean(false);
- stream.beginOptionalCustomData();
- stream.setState(WROTE_CUSTOM_DATA);
- }
- }
-
- protected static class WroteDefaultDataState extends InWriteObjectState {
-
- public void exitWriteObject(OutputStreamHook stream) throws IOException {
-
- // We only wrote default data, so if in stream format
- // version 2, put the null indicator to say that there
- // is no optional data
- if (stream.getStreamFormatVersion() == 2)
- stream.getOrbStream().write_long(0);
-
- stream.setState(NOT_IN_WRITE_OBJECT);
- }
-
- public void defaultWriteObject(OutputStreamHook stream) throws IOException {
- // XXX I18N, logging needed.
- throw new IOException("Called defaultWriteObject/writeFields twice");
- }
-
- public void writeData(OutputStreamHook stream) throws IOException {
-
- // The writeObject method called a direct write operation.
- // If in stream format version 2, put the fake valuetype
- // header.
- stream.beginOptionalCustomData();
-
- stream.setState(WROTE_CUSTOM_DATA);
- }
- }
-
- protected static class WroteCustomDataState extends InWriteObjectState {
-
- public void exitWriteObject(OutputStreamHook stream) throws IOException {
- // In stream format version 2, we must tell the ORB
- // stream to close the fake custom valuetype.
- if (stream.getStreamFormatVersion() == 2)
- ((org.omg.CORBA.portable.ValueOutputStream)stream.getOrbStream()).end_value();
-
- stream.setState(NOT_IN_WRITE_OBJECT);
- }
-
- public void defaultWriteObject(OutputStreamHook stream) throws IOException {
- // XXX I18N, logging needed.
- throw new IOException("Cannot call defaultWriteObject/writeFields after writing custom data in RMI-IIOP");
- }
-
- // We don't have to do anything special here, just let
- // the stream write the data.
- public void writeData(OutputStreamHook stream) throws IOException {}
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/io/TypeMismatchException.java b/src/share/classes/com/sun/corba/se/impl/io/TypeMismatchException.java
deleted file mode 100644
index 7561f88..0000000
--- a/src/share/classes/com/sun/corba/se/impl/io/TypeMismatchException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-public class TypeMismatchException extends Error
-{
- public TypeMismatchException()
- {
- super();
- }
-
- public TypeMismatchException(String mssg)
- {
- super(mssg);
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java b/src/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java
deleted file mode 100644
index fdf3501..0000000
--- a/src/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java
+++ /dev/null
@@ -1,926 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import javax.rmi.CORBA.Util;
-
-import java.util.Hashtable;
-import java.io.IOException;
-
-import com.sun.corba.se.impl.util.RepositoryId;
-import com.sun.corba.se.impl.util.Utility;
-
-import org.omg.CORBA.TCKind;
-
-import org.omg.CORBA.portable.IndirectionException;
-import com.sun.org.omg.SendingContext.CodeBase;
-import com.sun.org.omg.SendingContext.CodeBaseHelper;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-import com.sun.corba.se.impl.logging.UtilSystemException;
-
-public final class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat {
-
- // Property to override our maximum stream format version
- public static final String FORMAT_VERSION_PROPERTY
- = "com.sun.CORBA.MaxStreamFormatVersion";
-
- private static final byte MAX_SUPPORTED_FORMAT_VERSION = (byte)2;
- private static final byte STREAM_FORMAT_VERSION_1 = (byte)1;
-
- // The ValueHandler's maximum stream format version to advertise,
- // set in a static initializer.
- private static final byte MAX_STREAM_FORMAT_VERSION;
-
- static {
- MAX_STREAM_FORMAT_VERSION = getMaxStreamFormatVersion();
- }
-
- // Looks for the FORMAT_VERSION_PROPERTY system property
- // to allow the user to override our default stream format
- // version. Note that this still only allows them to pick
- // a supported version (1 through MAX_STREAM_FORMAT_VERSION).
- private static byte getMaxStreamFormatVersion() {
-
- try {
-
- String propValue = (String) AccessController.doPrivileged(
- new PrivilegedAction() {
- public java.lang.Object run() {
- return System.getProperty(ValueHandlerImpl.FORMAT_VERSION_PROPERTY);
- }
- });
-
- // The property wasn't set
- if (propValue == null)
- return MAX_SUPPORTED_FORMAT_VERSION;
-
- byte result = Byte.parseByte(propValue);
-
- // REVISIT. Just set to MAX_SUPPORTED_FORMAT_VERSION
- // or really let the system shutdown with this Error?
- if (result < 1 || result > MAX_SUPPORTED_FORMAT_VERSION)
- // XXX I18N, logging needed.
- throw new ExceptionInInitializerError("Invalid stream format version: "
- + result
- + ". Valid range is 1 through "
- + MAX_SUPPORTED_FORMAT_VERSION);
-
- return result;
-
- } catch (Exception ex) {
- // REVISIT. Swallow this or really let
- // the system shutdown with this Error?
-
- Error err = new ExceptionInInitializerError(ex);
- err.initCause( ex ) ;
- throw err ;
- }
- }
-
- public static final short kRemoteType = 0;
- public static final short kAbstractType = 1;
- public static final short kValueType = 2;
-
- private Hashtable inputStreamPairs = null;
- private Hashtable outputStreamPairs = null;
- private CodeBase codeBase = null;
- private boolean useHashtables = true;
- private boolean isInputStream = true;
- private IIOPOutputStream outputStreamBridge = null;
- private IIOPInputStream inputStreamBridge = null;
- private OMGSystemException omgWrapper = OMGSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
- private UtilSystemException utilWrapper = UtilSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- // See javax.rmi.CORBA.ValueHandlerMultiFormat
- public byte getMaximumStreamFormatVersion() {
- return MAX_STREAM_FORMAT_VERSION;
- }
-
- // See javax.rmi.CORBA.ValueHandlerMultiFormat
- public void writeValue(org.omg.CORBA.portable.OutputStream out,
- java.io.Serializable value,
- byte streamFormatVersion) {
-
- if (streamFormatVersion == 2) {
- if (!(out instanceof org.omg.CORBA.portable.ValueOutputStream)) {
- throw omgWrapper.notAValueoutputstream() ;
- }
- } else if (streamFormatVersion != 1) {
- throw omgWrapper.invalidStreamFormatVersion(
- new Integer(streamFormatVersion) ) ;
- }
-
- writeValueWithVersion(out, value, streamFormatVersion);
- }
-
- private ValueHandlerImpl(){}
-
- private ValueHandlerImpl(boolean isInputStream) {
- this();
- useHashtables = false;
- this.isInputStream = isInputStream;
- }
-
- static ValueHandlerImpl getInstance() {
- return new ValueHandlerImpl();
- }
-
- static ValueHandlerImpl getInstance(boolean isInputStream) {
- return new ValueHandlerImpl(isInputStream);
- }
-
- /**
- * Writes the value to the stream using java semantics.
- * @param out The stream to write the value to
- * @param value The value to be written to the stream
- **/
- public void writeValue(org.omg.CORBA.portable.OutputStream _out,
- java.io.Serializable value) {
- writeValueWithVersion(_out, value, STREAM_FORMAT_VERSION_1);
- }
-
- private void writeValueWithVersion(org.omg.CORBA.portable.OutputStream _out,
- java.io.Serializable value,
- byte streamFormatVersion) {
-
- org.omg.CORBA_2_3.portable.OutputStream out =
- (org.omg.CORBA_2_3.portable.OutputStream) _out;
-
- if (!useHashtables) {
- if (outputStreamBridge == null) {
- outputStreamBridge = createOutputStream();
- outputStreamBridge.setOrbStream(out);
- }
-
- try {
- outputStreamBridge.increaseRecursionDepth();
- writeValueInternal(outputStreamBridge, out, value, streamFormatVersion);
- } finally {
- outputStreamBridge.decreaseRecursionDepth();
- }
-
- return;
- }
-
- IIOPOutputStream jdkToOrbOutputStreamBridge = null;
-
- if (outputStreamPairs == null)
- outputStreamPairs = new Hashtable();
-
- jdkToOrbOutputStreamBridge = (IIOPOutputStream)outputStreamPairs.get(_out);
-
- if (jdkToOrbOutputStreamBridge == null) {
- jdkToOrbOutputStreamBridge = createOutputStream();
- jdkToOrbOutputStreamBridge.setOrbStream(out);
- outputStreamPairs.put(_out, jdkToOrbOutputStreamBridge);
- }
-
- try {
-
- jdkToOrbOutputStreamBridge.increaseRecursionDepth();
- writeValueInternal(jdkToOrbOutputStreamBridge, out, value, streamFormatVersion);
- } finally {
- if (jdkToOrbOutputStreamBridge.decreaseRecursionDepth() == 0) {
- outputStreamPairs.remove(_out);
- }
- }
- }
-
- private void writeValueInternal(IIOPOutputStream bridge,
- org.omg.CORBA_2_3.portable.OutputStream out,
- java.io.Serializable value,
- byte streamFormatVersion)
- {
- Class clazz = value.getClass();
-
- if (clazz.isArray())
- write_Array(out, value, clazz.getComponentType());
- else
- bridge.simpleWriteObject(value, streamFormatVersion);
- }
-
- /**
- * Reads a value from the stream using java semantics.
- * @param in The stream to read the value from
- * @param clazz The type of the value to be read in
- * @param sender The sending context runtime
- **/
- public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream _in,
- int offset,
- java.lang.Class clazz,
- String repositoryID,
- org.omg.SendingContext.RunTime _sender)
- {
- // Must use narrow rather than a direct cast to a com.sun
- // class. Fix for bug 4379539.
- CodeBase sender = CodeBaseHelper.narrow(_sender);
-
- org.omg.CORBA_2_3.portable.InputStream in =
- (org.omg.CORBA_2_3.portable.InputStream) _in;
-
- if (!useHashtables) {
- if (inputStreamBridge == null) {
- inputStreamBridge = createInputStream();
- inputStreamBridge.setOrbStream(in);
- inputStreamBridge.setSender(sender); //d11638
- // backward compatability 4365188
- inputStreamBridge.setValueHandler(this);
- }
-
- java.io.Serializable result = null;
-
- try {
-
- inputStreamBridge.increaseRecursionDepth();
- result = (java.io.Serializable) readValueInternal(inputStreamBridge, in, offset, clazz, repositoryID, sender);
-
- } finally {
-
- if (inputStreamBridge.decreaseRecursionDepth() == 0) {
- // Indirections are resolved immediately since
- // the change to the active recursion manager,
- // so this will never happen.
- }
- }
-
- return result;
- }
-
- IIOPInputStream jdkToOrbInputStreamBridge = null;
- if (inputStreamPairs == null)
- inputStreamPairs = new Hashtable();
-
- jdkToOrbInputStreamBridge = (IIOPInputStream)inputStreamPairs.get(_in);
-
- if (jdkToOrbInputStreamBridge == null) {
-
- jdkToOrbInputStreamBridge = createInputStream();
- jdkToOrbInputStreamBridge.setOrbStream(in);
- jdkToOrbInputStreamBridge.setSender(sender); //d11638
- // backward compatability 4365188
- jdkToOrbInputStreamBridge.setValueHandler(this);
- inputStreamPairs.put(_in, jdkToOrbInputStreamBridge);
- }
-
- java.io.Serializable result = null;
-
- try {
-
- jdkToOrbInputStreamBridge.increaseRecursionDepth();
- result = (java.io.Serializable) readValueInternal(jdkToOrbInputStreamBridge, in, offset, clazz, repositoryID, sender);
-
- } finally {
-
- if (jdkToOrbInputStreamBridge.decreaseRecursionDepth() == 0) {
- inputStreamPairs.remove(_in);
- }
- }
-
- return result;
- }
-
- private java.io.Serializable readValueInternal(IIOPInputStream bridge,
- org.omg.CORBA_2_3.portable.InputStream in,
- int offset,
- java.lang.Class clazz,
- String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender)
- {
- java.io.Serializable result = null;
-
- if (clazz == null) {
- // clazz == null indicates an FVD situation for a nonexistant class
- if (isArray(repositoryID)){
- read_Array(bridge, in, null, sender, offset);
- } else {
- bridge.simpleSkipObject(repositoryID, sender);
- }
- return result;
- }
-
- if (clazz.isArray()) {
- result = (java.io.Serializable)read_Array(bridge, in, clazz, sender, offset);
- } else {
- result = (java.io.Serializable)bridge.simpleReadObject(clazz, repositoryID, sender, offset);
- }
-
- return result;
- }
-
- /**
- * Returns the repository ID for the given RMI value Class.
- * @param clz The class to return a repository ID for.
- * @return the repository ID of the Class.
- **/
- public java.lang.String getRMIRepositoryID(java.lang.Class clz) {
- return RepositoryId.createForJavaType(clz);
- }
-
- /**
- * Indicates whether the given Class performs custom or
- * default marshaling.
- * @param clz The class to test for custom marshaling.
- * @return True if the class performs custom marshaling, false
- * if it does not.
- **/
- public boolean isCustomMarshaled(java.lang.Class clz) {
- return ObjectStreamClass.lookup(clz).isCustomMarshaled();
- }
-
- /**
- * Returns the CodeBase for this ValueHandler. This is used by
- * the ORB runtime. The server sends the service context containing
- * the IOR for this CodeBase on the first GIOP reply. The clients
- * do the same on the first GIOP request.
- * @return the SendingContext.CodeBase of this ValueHandler.
- **/
- public org.omg.SendingContext.RunTime getRunTimeCodeBase() {
- if (codeBase != null)
- return codeBase;
- else {
- codeBase = new FVDCodeBaseImpl();
-
- // backward compatability 4365188
- // set the valueHandler so that correct/incorrect RepositoryID
- // calculations can be done based on the ORB version
- FVDCodeBaseImpl fvdImpl = (FVDCodeBaseImpl) codeBase;
- fvdImpl.setValueHandler(this);
- return codeBase;
- }
- }
-
-
- // methods supported for backward compatability so that the appropriate
- // Rep-id calculations take place based on the ORB version
-
- /**
- * Returns a boolean of whether or not RepositoryId indicates
- * FullValueDescriptor.
- * used for backward compatability
- */
-
- public boolean useFullValueDescription(Class clazz, String repositoryID)
- throws IOException
- {
- return RepositoryId.useFullValueDescription(clazz, repositoryID);
- }
-
- public String getClassName(String id)
- {
- RepositoryId repID = RepositoryId.cache.getId(id);
- return repID.getClassName();
- }
-
- public Class getClassFromType(String id)
- throws ClassNotFoundException
- {
- RepositoryId repId = RepositoryId.cache.getId(id);
- return repId.getClassFromType();
- }
-
- public Class getAnyClassFromType(String id)
- throws ClassNotFoundException
- {
- RepositoryId repId = RepositoryId.cache.getId(id);
- return repId.getAnyClassFromType();
- }
-
- public String createForAnyType(Class cl)
- {
- return RepositoryId.createForAnyType(cl);
- }
-
- public String getDefinedInId(String id)
- {
- RepositoryId repId = RepositoryId.cache.getId(id);
- return repId.getDefinedInId();
- }
-
- public String getUnqualifiedName(String id)
- {
- RepositoryId repId = RepositoryId.cache.getId(id);
- return repId.getUnqualifiedName();
- }
-
- public String getSerialVersionUID(String id)
- {
- RepositoryId repId = RepositoryId.cache.getId(id);
- return repId.getSerialVersionUID();
- }
-
-
- public boolean isAbstractBase(Class clazz)
- {
- return RepositoryId.isAbstractBase(clazz);
- }
-
- public boolean isSequence(String id)
- {
- RepositoryId repId = RepositoryId.cache.getId(id);
- return repId.isSequence();
- }
-
- /**
- * If the value contains a writeReplace method then the result
- * is returned. Otherwise, the value itself is returned.
- * @return the true value to marshal on the wire.
- **/
- public java.io.Serializable writeReplace(java.io.Serializable value) {
- return ObjectStreamClass.lookup(value.getClass()).writeReplace(value);
- }
-
- private void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out,
- char[] array,
- int offset,
- int length)
- {
- out.write_wchar_array(array, offset, length);
- }
-
- private void write_Array(org.omg.CORBA_2_3.portable.OutputStream out, java.io.Serializable obj, Class type) {
-
- int i, length;
-
- if (type.isPrimitive()) {
- if (type == Integer.TYPE) {
- int[] array = (int[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_long_array(array, 0, length);
- } else if (type == Byte.TYPE) {
- byte[] array = (byte[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_octet_array(array, 0, length);
- } else if (type == Long.TYPE) {
- long[] array = (long[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_longlong_array(array, 0, length);
- } else if (type == Float.TYPE) {
- float[] array = (float[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_float_array(array, 0, length);
- } else if (type == Double.TYPE) {
- double[] array = (double[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_double_array(array, 0, length);
- } else if (type == Short.TYPE) {
- short[] array = (short[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_short_array(array, 0, length);
- } else if (type == Character.TYPE) {
- char[] array = (char[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- writeCharArray(out, array, 0, length);
- } else if (type == Boolean.TYPE) {
- boolean[] array = (boolean[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_boolean_array(array, 0, length);
- } else {
- // XXX I18N, logging needed.
- throw new Error("Invalid primitive type : " +
- obj.getClass().getName());
- }
- } else if (type == java.lang.Object.class) {
- Object[] array = (Object[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- for (i = 0; i < length; i++) {
- Util.writeAny(out, array[i]);
- }
- } else {
- Object[] array = (Object[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- int callType = kValueType;
-
- if (type.isInterface()) {
- String className = type.getName();
-
- if (java.rmi.Remote.class.isAssignableFrom(type)) {
- // RMI Object reference...
- callType = kRemoteType;
- } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)){
- // IDL Object reference...
- callType = kRemoteType;
- } else if (RepositoryId.isAbstractBase(type)) {
- // IDL Abstract Object reference...
- callType = kAbstractType;
- } else if (ObjectStreamClassCorbaExt.isAbstractInterface(type)) {
- callType = kAbstractType;
- }
- }
-
- for (i = 0; i < length; i++) {
- switch (callType) {
- case kRemoteType:
- Util.writeRemoteObject(out, array[i]);
- break;
- case kAbstractType:
- Util.writeAbstractObject(out,array[i]);
- break;
- case kValueType:
- try{
- out.write_value((java.io.Serializable)array[i]);
- } catch(ClassCastException cce){
- if (array[i] instanceof java.io.Serializable)
- throw cce;
- else {
- Utility.throwNotSerializableForCorba(
- array[i].getClass().getName());
- }
- }
- break;
- }
- }
- }
- }
-
- private void readCharArray(org.omg.CORBA_2_3.portable.InputStream in,
- char[] array,
- int offset,
- int length)
- {
- in.read_wchar_array(array, offset, length);
- }
-
- private java.lang.Object read_Array(IIOPInputStream bridge,
- org.omg.CORBA_2_3.portable.InputStream in,
- Class sequence,
- com.sun.org.omg.SendingContext.CodeBase sender,
- int offset)
- {
- try {
- // Read length of coming array
- int length = in.read_ulong();
- int i;
-
- if (sequence == null) {
- for (i = 0; i < length; i++)
- in.read_value();
-
- return null;
- }
-
- Class componentType = sequence.getComponentType();
- Class actualType = componentType;
-
-
- if (componentType.isPrimitive()) {
- if (componentType == Integer.TYPE) {
- int[] array = new int[length];
- in.read_long_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Byte.TYPE) {
- byte[] array = new byte[length];
- in.read_octet_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Long.TYPE) {
- long[] array = new long[length];
- in.read_longlong_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Float.TYPE) {
- float[] array = new float[length];
- in.read_float_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Double.TYPE) {
- double[] array = new double[length];
- in.read_double_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Short.TYPE) {
- short[] array = new short[length];
- in.read_short_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Character.TYPE) {
- char[] array = new char[length];
- readCharArray(in, array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Boolean.TYPE) {
- boolean[] array = new boolean[length];
- in.read_boolean_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else {
- // XXX I18N, logging needed.
- throw new Error("Invalid primitive componentType : " + sequence.getName());
- }
- } else if (componentType == java.lang.Object.class) {
- Object[] array = (Object[])java.lang.reflect.Array.newInstance(
- componentType, length);
-
- // Store this object and its beginning position
- // since there might be indirections to it while
- // it's been unmarshalled.
- bridge.activeRecursionMgr.addObject(offset, array);
-
- for (i = 0; i < length; i++) {
- Object objectValue = null;
- try {
- objectValue = Util.readAny(in);
- } catch(IndirectionException cdrie) {
- try {
- // The CDR stream had never seen the given offset
- // before, so check the recursion manager (it will
- // throw an IOException if it doesn't have a
- // reference, either).
- objectValue = bridge.activeRecursionMgr.getObject(
- cdrie.offset);
- } catch (IOException ie) {
- // Translate to a MARSHAL exception since
- // ValueHandlers aren't allowed to throw
- // IOExceptions
- throw utilWrapper.invalidIndirection( ie,
- new Integer( cdrie.offset ) ) ;
- }
- }
-
- array[i] = objectValue;
- }
- return ((java.io.Serializable)((Object)array));
- } else {
- Object[] array = (Object[])java.lang.reflect.Array.newInstance(
- componentType, length);
- // Store this object and its beginning position
- // since there might be indirections to it while
- // it's been unmarshalled.
- bridge.activeRecursionMgr.addObject(offset, array);
-
- // Decide what method call to make based on the componentType.
- // If it is a componentType for which we need to load a stub,
- // convert the componentType to the correct stub type.
-
- int callType = kValueType;
- boolean narrow = false;
-
- if (componentType.isInterface()) {
- boolean loadStubClass = false;
- // String className = componentType.getName();
-
- if (java.rmi.Remote.class.isAssignableFrom(componentType)) {
-
- // RMI Object reference...
- callType = kRemoteType;
-
- // for better performance, load the stub class once
- // instead of for each element of the array
- loadStubClass = true;
- } else if (org.omg.CORBA.Object.class.isAssignableFrom(componentType)){
- // IDL Object reference...
- callType = kRemoteType;
- loadStubClass = true;
- } else if (RepositoryId.isAbstractBase(componentType)) {
- // IDL Abstract Object reference...
- callType = kAbstractType;
- loadStubClass = true;
- } else if (ObjectStreamClassCorbaExt.isAbstractInterface(componentType)) {
-
- // RMI Abstract Object reference...
-
- // componentType = null;
- callType = kAbstractType;
- }
-
- if (loadStubClass) {
- try {
- String codebase = Util.getCodebase(componentType);
- String repID = RepositoryId.createForAnyType(componentType);
- Class stubType =
- Utility.loadStubClass(repID, codebase, componentType);
- actualType = stubType;
- } catch (ClassNotFoundException e) {
- narrow = true;
- }
- } else {
- narrow = true;
- }
- }
-
- for (i = 0; i < length; i++) {
-
- try {
- switch (callType) {
- case kRemoteType:
- if (!narrow)
- array[i] = (Object)in.read_Object(actualType);
- else {
- array[i] = Utility.readObjectAndNarrow(in, actualType);
-
- }
- break;
- case kAbstractType:
- if (!narrow)
- array[i] = (Object)in.read_abstract_interface(actualType);
- else {
- array[i] = Utility.readAbstractAndNarrow(in, actualType);
- }
- break;
- case kValueType:
- array[i] = (Object)in.read_value(actualType);
- break;
- }
- } catch(IndirectionException cdrie) {
- // The CDR stream had never seen the given offset before,
- // so check the recursion manager (it will throw an
- // IOException if it doesn't have a reference, either).
- try {
- array[i] = bridge.activeRecursionMgr.getObject(
- cdrie.offset);
- } catch (IOException ioe) {
- // Translate to a MARSHAL exception since
- // ValueHandlers aren't allowed to throw
- // IOExceptions
- throw utilWrapper.invalidIndirection( ioe,
- new Integer( cdrie.offset ) ) ;
- }
- }
-
- }
-
- return ((java.io.Serializable)((Object)array));
- }
- } finally {
- // We've completed deserializing this object. Any
- // future indirections will be handled correctly at the
- // CDR level. The ActiveRecursionManager only deals with
- // objects currently being deserialized.
- bridge.activeRecursionMgr.removeObject(offset);
- }
- }
-
- private boolean isArray(String repId){
- return RepositoryId.cache.getId(repId).isSequence();
- }
-
- private String getOutputStreamClassName() {
- return "com.sun.corba.se.impl.io.IIOPOutputStream";
- }
-
- private IIOPOutputStream createOutputStream() {
- final String name = getOutputStreamClassName();
- try {
- IIOPOutputStream stream = createOutputStreamBuiltIn(name);
- if (stream != null) {
- return stream;
- }
- return createCustom(IIOPOutputStream.class, name);
- } catch (Throwable t) {
- // Throw exception under the carpet.
- InternalError ie = new InternalError(
- "Error loading " + name
- );
- ie.initCause(t);
- throw ie;
- }
- }
-
- /**
- * Construct a built in implementation with priveleges.
- * Returning null indicates a non-built is specified.
- */
- private IIOPOutputStream createOutputStreamBuiltIn(
- final String name
- ) throws Throwable {
- try {
- return AccessController.doPrivileged(
- new PrivilegedExceptionAction<IIOPOutputStream>() {
- public IIOPOutputStream run() throws IOException {
- return createOutputStreamBuiltInNoPriv(name);
- }
- }
- );
- } catch (java.security.PrivilegedActionException exc) {
- throw exc.getCause();
- }
- }
-
- /**
- * Returning null indicates a non-built is specified.
- */
- private IIOPOutputStream createOutputStreamBuiltInNoPriv(
- final String name
- ) throws IOException {
- return name.equals(IIOPOutputStream.class.getName()) ?
- new IIOPOutputStream() : null;
- }
-
- private String getInputStreamClassName() {
- return "com.sun.corba.se.impl.io.IIOPInputStream";
- }
-
- private IIOPInputStream createInputStream() {
- final String name = getInputStreamClassName();
- try {
- IIOPInputStream stream = createInputStreamBuiltIn(name);
- if (stream != null) {
- return stream;
- }
- return createCustom(IIOPInputStream.class, name);
- } catch (Throwable t) {
- // Throw exception under the carpet.
- InternalError ie = new InternalError(
- "Error loading " + name
- );
- ie.initCause(t);
- throw ie;
- }
- }
-
- /**
- * Construct a built in implementation with priveleges.
- * Returning null indicates a non-built is specified.
- */
- private IIOPInputStream createInputStreamBuiltIn(
- final String name
- ) throws Throwable {
- try {
- return AccessController.doPrivileged(
- new PrivilegedExceptionAction<IIOPInputStream>() {
- public IIOPInputStream run() throws IOException {
- return createInputStreamBuiltInNoPriv(name);
- }
- }
- );
- } catch (java.security.PrivilegedActionException exc) {
- throw exc.getCause();
- }
- }
-
- /**
- * Returning null indicates a non-built is specified.
- */
- private IIOPInputStream createInputStreamBuiltInNoPriv(
- final String name
- ) throws IOException {
- return name.equals(IIOPInputStream.class.getName()) ?
- new IIOPInputStream() : null;
- }
-
- /**
- * Create a custom implementation without privileges.
- */
- private <T> T createCustom(
- final Class<T> type, final String className
- ) throws Throwable {
- // Note: We use the thread context or system ClassLoader here
- // since we want to load classes outside of the
- // core JDK when running J2EE Pure ORB and
- // talking to Kestrel.
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if (cl == null)
- cl = ClassLoader.getSystemClassLoader();
-
- Class<?> clazz = cl.loadClass(className);
- Class<? extends T> streamClass = clazz.asSubclass(type);
-
- // Since the ClassLoader should cache the class, this isn't
- // as expensive as it looks.
- return streamClass.newInstance();
-
- }
-
- TCKind getJavaCharTCKind() {
- return TCKind.tk_wchar;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java b/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java
deleted file mode 100644
index 20cec8d..0000000
--- a/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- * 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
-import com.sun.org.omg.CORBA.OperationDescription;
-import com.sun.org.omg.CORBA.AttributeDescription;
-import org.omg.CORBA.ValueMember;
-import com.sun.org.omg.CORBA.Initializer;
-import org.omg.CORBA.IDLType;
-import com.sun.org.omg.CORBA._IDLTypeStub;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.TypeCodePackage.*;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import java.lang.reflect.*;
-import com.sun.corba.se.impl.util.RepositoryId;
-import java.util.*;
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandler;
-
-/**
- * Holds utility methods for converting from ObjectStreamClass to
- * FullValueDescription and generating typecodes from ObjectStreamClass.
- **/
-public class ValueUtility {
-
- public static final short PRIVATE_MEMBER = 0;
- public static final short PUBLIC_MEMBER = 1;
-
- private static final String primitiveConstants[] = {
- null, // tk_null 0
- null, // tk_void 1
- "S", // tk_short 2
- "I", // tk_long 3
- "S", // tk_ushort 4
- "I", // tk_ulong 5
- "F", // tk_float 6
- "D", // tk_double 7
- "Z", // tk_boolean 8
- "C", // tk_char 9
- "B", // tk_octet 10
- null, // tk_any 11
- null, // tk_typecode 12
- null, // tk_principal 13
- null, // tk_objref 14
- null, // tk_struct 15
- null, // tk_union 16
- null, // tk_enum 17
- null, // tk_string 18
- null, // tk_sequence 19
- null, // tk_array 20
- null, // tk_alias 21
- null, // tk_except 22
- "J", // tk_longlong 23
- "J", // tk_ulonglong 24
- "D", // tk_longdouble 25
- "C", // tk_wchar 26
- null, // tk_wstring 27
- null, // tk_fixed 28
- null, // tk_value 29
- null, // tk_value_box 30
- null, // tk_native 31
- null, // tk_abstract_interface 32
- };
-
- static {
- sun.corba.SharedSecrets.setJavaCorbaAccess(new sun.corba.JavaCorbaAccess() {
- public ValueHandlerImpl newValueHandlerImpl() {
- return ValueHandlerImpl.getInstance();
- }
- public Class<?> loadClass(String className) throws ClassNotFoundException {
- if (Thread.currentThread().getContextClassLoader() != null) {
- return Thread.currentThread().getContextClassLoader().
- loadClass(className);
- } else {
- return ClassLoader.getSystemClassLoader().loadClass(className);
- }
- }
- });
- }
-
- public static String getSignature(ValueMember member)
- throws ClassNotFoundException {
-
- // REVISIT. Can the type be something that is
- // non-primitive yet not a value_box, value, or objref?
- // If so, should use ObjectStreamClass or throw
- // exception.
-
- if (member.type.kind().value() == TCKind._tk_value_box ||
- member.type.kind().value() == TCKind._tk_value ||
- member.type.kind().value() == TCKind._tk_objref) {
- Class c = RepositoryId.cache.getId(member.id).getClassFromType();
- return ObjectStreamClass.getSignature(c);
-
- } else {
-
- return primitiveConstants[member.type.kind().value()];
- }
-
- }
-
- public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, ValueHandler vh){
-
- // Create FullValueDescription
- FullValueDescription result = new FullValueDescription();
- Class className = osc.forClass();
-
- ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
- String repId = vhandler.createForAnyType(className);
-
- // Set FVD name
- result.name = vhandler.getUnqualifiedName(repId);
- if (result.name == null)
- result.name = "";
-
- // Set FVD id _REVISIT_ : Manglings
- result.id = vhandler.getRMIRepositoryID(className);
- if (result.id == null)
- result.id = "";
-
- // Set FVD is_abstract
- result.is_abstract = ObjectStreamClassCorbaExt.isAbstractInterface(className);
-
- // Set FVD is_custom
- result.is_custom = osc.hasWriteObject() || osc.isExternalizable();
-
- // Set FVD defined_in _REVISIT_ : Manglings
- result.defined_in = vhandler.getDefinedInId(repId);
- if (result.defined_in == null)
- result.defined_in = "";
-
- // Set FVD version
- result.version = vhandler.getSerialVersionUID(repId);
- if (result.version == null)
- result.version = "";
-
- // Skip FVD operations - N/A
- result.operations = new OperationDescription[0];
-
- // Skip FVD attributed - N/A
- result.attributes = new AttributeDescription[0];
-
- // Set FVD members
- // Maps classes to repositoryIDs strings. This is used to detect recursive types.
- IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
- // Stores all types created for resolving indirect types at the end.
- result.members = translateMembers(orb, osc, vh, createdIDs);
-
- // Skip FVD initializers - N/A
- result.initializers = new Initializer[0];
-
- Class interfaces[] = osc.forClass().getInterfaces();
- int abstractCount = 0;
-
- // Skip FVD supported_interfaces
- result.supported_interfaces = new String[interfaces.length];
- for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
- interfaceIndex++) {
- result.supported_interfaces[interfaceIndex] =
- vhandler.createForAnyType(interfaces[interfaceIndex]);
-
- if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
- (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
- abstractCount++;
- }
-
- // Skip FVD abstract_base_values - N/A
- result.abstract_base_values = new String[abstractCount];
- for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
- interfaceIndex++) {
- if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
- (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
- result.abstract_base_values[interfaceIndex] =
- vhandler.createForAnyType(interfaces[interfaceIndex]);
-
- }
-
- result.is_truncatable = false;
-
- // Set FVD base_value
- Class superClass = osc.forClass().getSuperclass();
- if (java.io.Serializable.class.isAssignableFrom(superClass))
- result.base_value = vhandler.getRMIRepositoryID(superClass);
- else
- result.base_value = "";
-
- // Set FVD type
- //result.type = createTypeCodeForClass(orb, osc.forClass());
- result.type = orb.get_primitive_tc(TCKind.tk_value); //11638
-
- return result;
-
- }
-
- private static ValueMember[] translateMembers (ORB orb,
- ObjectStreamClass osc,
- ValueHandler vh,
- IdentityKeyValueStack createdIDs)
- {
- ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
- ObjectStreamField fields[] = osc.getFields();
- int fieldsLength = fields.length;
- ValueMember[] members = new ValueMember[fieldsLength];
- // Note : fields come out of ObjectStreamClass in correct order for
- // writing. So, we will create the same order in the members array.
- for (int i = 0; i < fieldsLength; i++) {
- String valRepId = vhandler.getRMIRepositoryID(fields[i].getClazz());
- members[i] = new ValueMember();
- members[i].name = fields[i].getName();
- members[i].id = valRepId; // _REVISIT_ : Manglings
- members[i].defined_in = vhandler.getDefinedInId(valRepId);// _REVISIT_ : Manglings
- members[i].version = "1.0";
- members[i].type_def = new _IDLTypeStub(); // _REVISIT_ : IDLType implementation missing
-
- if (fields[i].getField() == null) {
- // When using serialPersistentFields, the class may
- // no longer have an actual Field that corresponds
- // to one of the items. The Java to IDL spec
- // ptc-00-01-06 1.3.5.6 says that the IDL field
- // should be private in this case.
- members[i].access = PRIVATE_MEMBER;
- } else {
- int m = fields[i].getField().getModifiers();
- if (Modifier.isPublic(m))
- members[i].access = PUBLIC_MEMBER;
- else
- members[i].access = PRIVATE_MEMBER;
- }
-
- switch (fields[i].getTypeCode()) {
- case 'B':
- members[i].type = orb.get_primitive_tc(TCKind.tk_octet); //11638
- break;
- case 'C':
- members[i].type
- = orb.get_primitive_tc(vhandler.getJavaCharTCKind()); // 11638
- break;
- case 'F':
- members[i].type = orb.get_primitive_tc(TCKind.tk_float); //11638
- break;
- case 'D' :
- members[i].type = orb.get_primitive_tc(TCKind.tk_double); //11638
- break;
- case 'I':
- members[i].type = orb.get_primitive_tc(TCKind.tk_long); //11638
- break;
- case 'J':
- members[i].type = orb.get_primitive_tc(TCKind.tk_longlong); //11638
- break;
- case 'S':
- members[i].type = orb.get_primitive_tc(TCKind.tk_short); //11638
- break;
- case 'Z':
- members[i].type = orb.get_primitive_tc(TCKind.tk_boolean); //11638
- break;
- // case '[':
- // members[i].type = orb.get_primitive_tc(TCKind.tk_value_box); //11638
- // members[i].id = RepositoryId.createForAnyType(fields[i].getType());
- // break;
- default:
- members[i].type = createTypeCodeForClassInternal(orb, fields[i].getClazz(), vhandler,
- createdIDs);
- members[i].id = vhandler.createForAnyType(fields[i].getType());
- break;
- } // end switch
-
- } // end for loop
-
- return members;
- }
-
- private static boolean exists(String str, String strs[]){
- for (int i = 0; i < strs.length; i++)
- if (str.equals(strs[i]))
- return true;
-
- return false;
- }
-
- public static boolean isAssignableFrom(String clzRepositoryId, FullValueDescription type,
- com.sun.org.omg.SendingContext.CodeBase sender){
-
- if (exists(clzRepositoryId, type.supported_interfaces))
- return true;
-
- if (clzRepositoryId.equals(type.id))
- return true;
-
- if ((type.base_value != null) &&
- (!type.base_value.equals(""))) {
- FullValueDescription parent = sender.meta(type.base_value);
-
- return isAssignableFrom(clzRepositoryId, parent, sender);
- }
-
- return false;
-
- }
-
- public static TypeCode createTypeCodeForClass (ORB orb, java.lang.Class c, ValueHandler vh) {
- // Maps classes to repositoryIDs strings. This is used to detect recursive types.
- IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
- // Stores all types created for resolving indirect types at the end.
- TypeCode tc = createTypeCodeForClassInternal(orb, c, vh, createdIDs);
- return tc;
- }
-
- private static TypeCode createTypeCodeForClassInternal (ORB orb,
- java.lang.Class c,
- ValueHandler vh,
- IdentityKeyValueStack createdIDs)
- {
- // This wrapper method is the protection against infinite recursion.
- TypeCode tc = null;
- String id = (String)createdIDs.get(c);
- if (id != null) {
- return orb.create_recursive_tc(id);
- } else {
- id = vh.getRMIRepositoryID(c);
- if (id == null) id = "";
- // cache the rep id BEFORE creating a new typecode.
- // so that recursive tc can look up the rep id.
- createdIDs.push(c, id);
- tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
- createdIDs.pop();
- return tc;
- }
- }
-
- // Maintains a stack of key-value pairs. Compares elements using == operator.
- private static class IdentityKeyValueStack {
- private static class KeyValuePair {
- Object key;
- Object value;
- KeyValuePair(Object key, Object value) {
- this.key = key;
- this.value = value;
- }
- boolean equals(KeyValuePair pair) {
- return pair.key == this.key;
- }
- }
-
- Stack pairs = null;
-
- Object get(Object key) {
- if (pairs == null) {
- return null;
- }
- for (Iterator i = pairs.iterator(); i.hasNext();) {
- KeyValuePair pair = (KeyValuePair)i.next();
- if (pair.key == key) {
- return pair.value;
- }
- }
- return null;
- }
-
- void push(Object key, Object value) {
- if (pairs == null) {
- pairs = new Stack();
- }
- pairs.push(new KeyValuePair(key, value));
- }
-
- void pop() {
- pairs.pop();
- }
- }
-
- private static TypeCode createTypeCodeInternal (ORB orb,
- java.lang.Class c,
- ValueHandler vh,
- String id,
- IdentityKeyValueStack createdIDs)
- {
- if ( c.isArray() ) {
- // Arrays - may recurse for multi-dimensional arrays
- Class componentClass = c.getComponentType();
- TypeCode embeddedType;
- if ( componentClass.isPrimitive() ){
- embeddedType
- = ValueUtility.getPrimitiveTypeCodeForClass(orb,
- componentClass,
- vh);
- } else {
- embeddedType = createTypeCodeForClassInternal(orb, componentClass, vh,
- createdIDs);
- }
- TypeCode t = orb.create_sequence_tc (0, embeddedType);
- return orb.create_value_box_tc (id, "Sequence", t);
- } else if ( c == java.lang.String.class ) {
- // Strings
- TypeCode t = orb.create_string_tc (0);
- return orb.create_value_box_tc (id, "StringValue", t);
- } else if (java.rmi.Remote.class.isAssignableFrom(c)) {
- return orb.get_primitive_tc(TCKind.tk_objref);
- } else if (org.omg.CORBA.Object.class.isAssignableFrom(c)) {
- return orb.get_primitive_tc(TCKind.tk_objref);
- }
-
- // Anything else
-
- ObjectStreamClass osc = ObjectStreamClass.lookup(c);
-
- if (osc == null) {
- return orb.create_value_box_tc (id, "Value", orb.get_primitive_tc (TCKind.tk_value));
- }
-
- // type modifier
- // REVISIT truncatable and abstract?
- short modifier = (osc.isCustomMarshaled() ? org.omg.CORBA.VM_CUSTOM.value : org.omg.CORBA.VM_NONE.value);
-
- // concrete base
- TypeCode base = null;
- Class superClass = c.getSuperclass();
- if (superClass != null && java.io.Serializable.class.isAssignableFrom(superClass)) {
- base = createTypeCodeForClassInternal(orb, superClass, vh, createdIDs);
- }
-
- // members
- ValueMember[] members = translateMembers (orb, osc, vh, createdIDs);
-
- return orb.create_value_tc(id, c.getName(), modifier, base, members);
- }
-
- public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
- Class c,
- ValueHandler vh) {
-
- if (c == Integer.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_long);
- } else if (c == Byte.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_octet);
- } else if (c == Long.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_longlong);
- } else if (c == Float.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_float);
- } else if (c == Double.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_double);
- } else if (c == Short.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_short);
- } else if (c == Character.TYPE) {
- return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
- } else if (c == Boolean.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_boolean);
- } else {
- // _REVISIT_ Not sure if this is right.
- return orb.get_primitive_tc (TCKind.tk_any);
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/ByteBuffer.java b/src/share/classes/com/sun/corba/se/impl/ior/ByteBuffer.java
deleted file mode 100644
index 3d75294..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/ByteBuffer.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, 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.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-
-public class ByteBuffer {
- /**
- * The array buffer into which the components of the ByteBuffer are
- * stored. The capacity of the ByteBuffer is the length of this array buffer,
- * and is at least large enough to contain all the ByteBuffer's elements.<p>
- *
- * Any array elements following the last element in the ByteBuffer are 0.
- */
- protected byte elementData[];
-
- /**
- * The number of valid components in this <tt>ByteBuffer</tt> object.
- * Components <tt>elementData[0]</tt> through
- * <tt>elementData[elementCount-1]</tt> are the actual items.
- *
- * @serial
- */
- protected int elementCount;
-
- /**
- * The amount by which the capacity of the ByteBuffer is automatically
- * incremented when its size becomes greater than its capacity. If
- * the capacity increment is less than or equal to zero, the capacity
- * of the ByteBuffer is doubled each time it needs to grow.
- *
- * @serial
- */
- protected int capacityIncrement;
-
- /**
- * Constructs an empty ByteBuffer with the specified initial capacity and
- * capacity increment.
- *
- * @param initialCapacity the initial capacity of the ByteBuffer.
- * @param capacityIncrement the amount by which the capacity is
- * increased when the ByteBuffer overflows.
- * @exception IllegalArgumentException if the specified initial capacity
- * is negative
- */
- public ByteBuffer(int initialCapacity, int capacityIncrement) {
- super();
- if (initialCapacity < 0)
- throw new IllegalArgumentException("Illegal Capacity: "+
- initialCapacity);
- this.elementData = new byte[initialCapacity];
- this.capacityIncrement = capacityIncrement;
- }
-
- /**
- * Constructs an empty ByteBuffer with the specified initial capacity and
- * with its capacity increment equal to zero.
- *
- * @param initialCapacity the initial capacity of the ByteBuffer.
- * @exception IllegalArgumentException if the specified initial capacity
- * is negative
- */
- public ByteBuffer(int initialCapacity) {
- this(initialCapacity, 0);
- }
-
- /**
- * Constructs an empty ByteBuffer so that its internal data array
- * has size <tt>10</tt> and its standard capacity increment is
- * zero.
- */
- public ByteBuffer() {
- this(200);
- }
-
- /**
- * Trims the capacity of this ByteBuffer to be the ByteBuffer's current
- * size. If the capacity of this cector is larger than its current
- * size, then the capacity is changed to equal the size by replacing
- * its internal data array, kept in the field <tt>elementData</tt>,
- * with a smaller one. An application can use this operation to
- * minimize the storage of a ByteBuffer.
- */
- public void trimToSize() {
- int oldCapacity = elementData.length;
- if (elementCount < oldCapacity) {
- byte oldData[] = elementData;
- elementData = new byte[elementCount];
- System.arraycopy(oldData, 0, elementData, 0, elementCount);
- }
- }
-
- /**
- * This implements the unsynchronized semantics of ensureCapacity.
- * Synchronized methods in this class can internally call this
- * method for ensuring capacity without incurring the cost of an
- * extra synchronization.
- *
- * @see java.util.ByteBuffer#ensureCapacity(int)
- */
- private void ensureCapacityHelper(int minCapacity) {
- int oldCapacity = elementData.length;
- if (minCapacity > oldCapacity) {
- byte oldData[] = elementData;
- int newCapacity = (capacityIncrement > 0) ?
- (oldCapacity + capacityIncrement) : (oldCapacity * 2);
- if (newCapacity < minCapacity) {
- newCapacity = minCapacity;
- }
- elementData = new byte[newCapacity];
- System.arraycopy(oldData, 0, elementData, 0, elementCount);
- }
- }
-
- /**
- * Returns the current capacity of this ByteBuffer.
- *
- * @return the current capacity (the length of its internal
- * data arary, kept in the field <tt>elementData</tt>
- * of this ByteBuffer.
- */
- public int capacity() {
- return elementData.length;
- }
-
- /**
- * Returns the number of components in this ByteBuffer.
- *
- * @return the number of components in this ByteBuffer.
- */
- public int size() {
- return elementCount;
- }
-
- /**
- * Tests if this ByteBuffer has no components.
- *
- * @return <code>true</code> if and only if this ByteBuffer has
- * no components, that is, its size is zero;
- * <code>false</code> otherwise.
- */
- public boolean isEmpty() {
- return elementCount == 0;
- }
-
- public void append(byte value)
- {
- ensureCapacityHelper(elementCount + 1);
- elementData[elementCount++] = value;
- }
-
- public void append( int value )
- {
- ensureCapacityHelper(elementCount + 4);
- doAppend( value ) ;
- }
-
- private void doAppend( int value )
- {
- int current = value ;
- for (int ctr=0; ctr<4; ctr++) {
- elementData[elementCount+ctr] = (byte)(current & 255) ;
- current = current >> 8 ;
- }
- elementCount += 4 ;
- }
-
- public void append( String value )
- {
- byte[] data = value.getBytes() ;
- ensureCapacityHelper( elementCount + data.length + 4 ) ;
- doAppend( data.length ) ;
- System.arraycopy( data, 0, elementData, elementCount, data.length ) ;
- elementCount += data.length ;
- }
-
- /**
- * Returns an array containing all of the elements in this ByteBuffer
- * in the correct order.
- *
- * @since 1.2
- */
- public byte[] toArray() {
- return elementData ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java b/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java
deleted file mode 100644
index 63cdcae..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
-
-import org.omg.IOP.TAG_INTERNET_IOP ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-import com.sun.corba.se.spi.ior.TaggedComponent ;
-import com.sun.corba.se.spi.ior.Identifiable ;
-import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
-import com.sun.corba.se.spi.ior.WriteContents ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.impl.ior.FreezableList ;
-
-import com.sun.corba.se.impl.encoding.CDROutputStream ;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
-import com.sun.corba.se.impl.encoding.EncapsInputStream ;
-
-import sun.corba.EncapsInputStreamFactory;
-
-/**
- * This static utility class contains various utility methods for reading and
- * writing CDR encapsulations.
- *
- * @author Ken Cavanaugh
- */
-public class EncapsulationUtility
-{
- private EncapsulationUtility()
- {
- }
-
- /** Read the count from is, then read count Identifiables from
- * is using the factory. Add each constructed Identifiable to container.
- */
- public static void readIdentifiableSequence( List container,
- IdentifiableFactoryFinder finder, InputStream istr)
- {
- int count = istr.read_long() ;
- for (int ctr = 0; ctr<count; ctr++) {
- int id = istr.read_long() ;
- Identifiable obj = finder.create( id, istr ) ;
- container.add( obj ) ;
- }
- }
-
- /** Write all Identifiables that we contain to os. The total
- * length must be written before this method is called.
- */
- public static void writeIdentifiableSequence( List container, OutputStream os)
- {
- os.write_long( container.size() ) ;
- Iterator iter = container.iterator() ;
- while (iter.hasNext()) {
- Identifiable obj = (Identifiable)( iter.next() ) ;
- os.write_long( obj.getId() ) ;
- obj.write( os ) ;
- }
- }
-
- /** Helper method that is used to extract data from an output
- * stream and write the data to another output stream. Defined
- * as static so that it can be used in another class.
- */
- static public void writeOutputStream( OutputStream dataStream,
- OutputStream os )
- {
- byte[] data = ((CDROutputStream)dataStream).toByteArray() ;
- os.write_long( data.length ) ;
- os.write_octet_array( data, 0, data.length ) ;
- }
-
- /** Helper method to read the octet array from is, deencapsulate it,
- * and return
- * as another InputStream. This must be called inside the
- * constructor of a derived class to obtain the correct stream
- * for unmarshalling data.
- */
- static public InputStream getEncapsulationStream( InputStream is )
- {
- byte[] data = readOctets( is ) ;
- EncapsInputStream result = EncapsInputStreamFactory.newEncapsInputStream( is.orb(), data,
- data.length ) ;
- result.consumeEndian() ;
- return result ;
- }
-
- /** Helper method that reads an octet array from an input stream.
- * Defined as static here so that it can be used in another class.
- */
- static public byte[] readOctets( InputStream is )
- {
- int len = is.read_ulong() ;
- byte[] data = new byte[len] ;
- is.read_octet_array( data, 0, len ) ;
- return data ;
- }
-
- static public void writeEncapsulation( WriteContents obj,
- OutputStream os )
- {
- EncapsOutputStream out =
- sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)os.orb());
-
- out.putEndian() ;
-
- obj.writeContents( out ) ;
-
- writeOutputStream( out, os ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/FreezableList.java b/src/share/classes/com/sun/corba/se/impl/ior/FreezableList.java
deleted file mode 100644
index 8eb0511..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/FreezableList.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import java.util.Collection ;
-import java.util.List ;
-import java.util.AbstractList ;
-import java.util.ListIterator ;
-import java.util.Iterator ;
-
-import com.sun.corba.se.spi.ior.MakeImmutable ;
-
-/** Simple class that delegates all List operations to
-* another list. It also can be frozen, which means that
-* a number of operations can be performed on the list,
-* and then the list can be made immutable, so that no
-* further changes are possible. A FreezableList is frozen
-* using the makeImmutable method.
-*/
-public class FreezableList extends AbstractList {
- private List delegate = null ;
- private boolean immutable = false ;
-
- public boolean equals( Object obj )
- {
- if (obj == null)
- return false ;
-
- if (!(obj instanceof FreezableList))
- return false ;
-
- FreezableList other = (FreezableList)obj ;
-
- return delegate.equals( other.delegate ) &&
- (immutable == other.immutable) ;
- }
-
- public int hashCode()
- {
- return delegate.hashCode() ;
- }
-
- public FreezableList( List delegate, boolean immutable )
- {
- this.delegate = delegate ;
- this.immutable = immutable ;
- }
-
- public FreezableList( List delegate )
- {
- this( delegate, false ) ;
- }
-
- public void makeImmutable()
- {
- immutable = true ;
- }
-
- public boolean isImmutable()
- {
- return immutable ;
- }
-
- public void makeElementsImmutable()
- {
- Iterator iter = iterator() ;
- while (iter.hasNext()) {
- Object obj = iter.next() ;
- if (obj instanceof MakeImmutable) {
- MakeImmutable element = (MakeImmutable)obj ;
- element.makeImmutable() ;
- }
- }
- }
-
- // Methods overridden from AbstractList
-
- public int size()
- {
- return delegate.size() ;
- }
-
- public Object get(int index)
- {
- return delegate.get(index) ;
- }
-
- public Object set(int index, Object element)
- {
- if (immutable)
- throw new UnsupportedOperationException() ;
-
- return delegate.set(index, element) ;
- }
-
- public void add(int index, Object element)
- {
- if (immutable)
- throw new UnsupportedOperationException() ;
-
- delegate.add(index, element) ;
- }
-
- public Object remove(int index)
- {
- if (immutable)
- throw new UnsupportedOperationException() ;
-
- return delegate.remove(index) ;
- }
-
- // We also override subList so that the result is a FreezableList.
- public List subList(int fromIndex, int toIndex)
- {
- List list = delegate.subList(fromIndex, toIndex) ;
- List result = new FreezableList( list, immutable ) ;
- return result ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/GenericIdentifiable.java b/src/share/classes/com/sun/corba/se/impl/ior/GenericIdentifiable.java
deleted file mode 100644
index 1715b4f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/GenericIdentifiable.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.Arrays ;
-
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.ior.Identifiable ;
-
-/**
- * @author
- * This is used for unknown components and profiles. A TAG_MULTICOMPONENT_PROFILE will be represented this way.
- */
-public abstract class GenericIdentifiable implements Identifiable
-{
- private int id;
- private byte data[];
-
- public GenericIdentifiable(int id, InputStream is)
- {
- this.id = id ;
- data = EncapsulationUtility.readOctets( is ) ;
- }
-
- public int getId()
- {
- return id ;
- }
-
- public void write(OutputStream os)
- {
- os.write_ulong( data.length ) ;
- os.write_octet_array( data, 0, data.length ) ;
- }
-
- public String toString()
- {
- return "GenericIdentifiable[id=" + getId() + "]" ;
- }
-
- public boolean equals(Object obj)
- {
- if (obj == null)
- return false ;
-
- if (!(obj instanceof GenericIdentifiable))
- return false ;
-
- GenericIdentifiable encaps = (GenericIdentifiable)obj ;
-
- return (getId() == encaps.getId()) &&
- Arrays.equals( getData(), encaps.getData() ) ;
- }
-
- public int hashCode()
- {
- int result = 17 ;
- for (int ctr=0; ctr<data.length; ctr++ )
- result = 37*result + data[ctr] ;
- return result ;
- }
-
- public GenericIdentifiable(int id, byte[] data)
- {
- this.id = id ;
- this.data = (byte[])(data.clone()) ;
- }
-
- public byte[] getData()
- {
- return data ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/GenericTaggedComponent.java b/src/share/classes/com/sun/corba/se/impl/ior/GenericTaggedComponent.java
deleted file mode 100644
index dbb8547..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/GenericTaggedComponent.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import org.omg.CORBA.ORB ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
-
-import com.sun.corba.se.spi.ior.TaggedComponent ;
-
-/**
- * @author
- */
-public class GenericTaggedComponent extends GenericIdentifiable
- implements TaggedComponent
-{
- public GenericTaggedComponent( int id, InputStream is )
- {
- super( id, is ) ;
- }
-
- public GenericTaggedComponent( int id, byte[] data )
- {
- super( id, data ) ;
- }
-
- /**
- * @return org.omg.IOP.TaggedComponent
- * @exception
- * @author
- */
- public org.omg.IOP.TaggedComponent getIOPComponent( ORB orb )
- {
- return new org.omg.IOP.TaggedComponent( getId(),
- getData() ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java b/src/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java
deleted file mode 100644
index b715dce..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-import com.sun.corba.se.spi.ior.TaggedProfile ;
-import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.ObjectKey ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
-
-import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
-
-/**
- * @author
- */
-public class GenericTaggedProfile extends GenericIdentifiable implements TaggedProfile
-{
- private ORB orb ;
-
- public GenericTaggedProfile( int id, InputStream is )
- {
- super( id, is ) ;
- this.orb = (ORB)(is.orb()) ;
- }
-
- public GenericTaggedProfile( ORB orb, int id, byte[] data )
- {
- super( id, data ) ;
- this.orb = orb ;
- }
-
- public TaggedProfileTemplate getTaggedProfileTemplate()
- {
- return null ;
- }
-
- public ObjectId getObjectId()
- {
- return null ;
- }
-
- public ObjectKeyTemplate getObjectKeyTemplate()
- {
- return null ;
- }
-
- public ObjectKey getObjectKey()
- {
- return null ;
- }
-
- public boolean isEquivalent( TaggedProfile prof )
- {
- return equals( prof ) ;
- }
-
- public void makeImmutable()
- {
- // NO-OP
- }
-
- public boolean isLocal()
- {
- return false ;
- }
-
- public org.omg.IOP.TaggedProfile getIOPProfile()
- {
- EncapsOutputStream os =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(orb);
- write( os ) ;
- InputStream is = (InputStream)(os.create_input_stream()) ;
- return org.omg.IOP.TaggedProfileHelper.read( is ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/IORImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/IORImpl.java
deleted file mode 100644
index 8c531d0..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/IORImpl.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.ListIterator ;
-import java.util.Iterator ;
-import java.util.Map ;
-import java.util.HashMap ;
-
-import java.io.StringWriter;
-import java.io.IOException;
-
-import javax.rmi.CORBA.Util;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import org.omg.IOP.TAG_INTERNET_IOP ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
-import com.sun.corba.se.spi.ior.TaggedProfile ;
-import com.sun.corba.se.spi.ior.IOR ;
-import com.sun.corba.se.spi.ior.IORTemplate ;
-import com.sun.corba.se.spi.ior.IORTemplateList ;
-import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
-import com.sun.corba.se.spi.ior.IdentifiableContainerBase ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.IORFactories ;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-
-import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.encoding.MarshalOutputStream;
-
-import com.sun.corba.se.impl.encoding.EncapsOutputStream;
-
-import com.sun.corba.se.impl.orbutil.HexOutputStream;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-import com.sun.corba.se.impl.logging.IORSystemException ;
-
-// XXX remove this once getProfile is gone
-import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
-
-/** An IOR is represented as a list of profiles.
-* Only objects that extend TaggedProfile should be added to an IOR.
-* However, enforcing this restriction requires overriding all
-* of the addXXX methods inherited from List, so no check
-* is included here.
-* @author Ken Cavanaugh
-*/
-public class IORImpl extends IdentifiableContainerBase implements IOR
-{
- private String typeId;
- private ORB factory = null ;
- private boolean isCachedHashValue = false;
- private int cachedHashValue;
- IORSystemException wrapper ;
-
- public ORB getORB()
- {
- return factory ;
- }
-
- /* This variable is set directly from the constructors that take
- * an IORTemplate or IORTemplateList as arguments; otherwise it
- * is derived from the list of TaggedProfile instances on the first
- * call to getIORTemplates. Note that we assume that an IOR with
- * mutiple TaggedProfile instances has the same ObjectId in each
- * TaggedProfile, as otherwise the IOR could never be created through
- * an ObjectReferenceFactory.
- */
- private IORTemplateList iortemps = null ;
-
- public boolean equals( Object obj )
- {
- if (obj == null)
- return false ;
-
- if (!(obj instanceof IOR))
- return false ;
-
- IOR other = (IOR)obj ;
-
- return super.equals( obj ) && typeId.equals( other.getTypeId() ) ;
- }
-
- public synchronized int hashCode()
- {
- if (! isCachedHashValue) {
- cachedHashValue = (super.hashCode() ^ typeId.hashCode());
- isCachedHashValue = true;
- }
- return cachedHashValue;
- }
-
- /** Construct an empty IOR. This is needed for null object references.
- */
- public IORImpl( ORB orb )
- {
- this( orb, "" ) ;
- }
-
- public IORImpl( ORB orb, String typeid )
- {
- factory = orb ;
- wrapper = IORSystemException.get( orb,
- CORBALogDomains.OA_IOR ) ;
- this.typeId = typeid ;
- }
-
- /** Construct an IOR from an IORTemplate by applying the same
- * object id to each TaggedProfileTemplate in the IORTemplate.
- */
- public IORImpl( ORB orb, String typeId, IORTemplate iortemp, ObjectId id)
- {
- this( orb, typeId ) ;
-
- this.iortemps = IORFactories.makeIORTemplateList() ;
- this.iortemps.add( iortemp ) ;
-
- addTaggedProfiles( iortemp, id ) ;
-
- makeImmutable() ;
- }
-
- private void addTaggedProfiles( IORTemplate iortemp, ObjectId id )
- {
- ObjectKeyTemplate oktemp = iortemp.getObjectKeyTemplate() ;
- Iterator templateIterator = iortemp.iterator() ;
-
- while (templateIterator.hasNext()) {
- TaggedProfileTemplate ptemp =
- (TaggedProfileTemplate)(templateIterator.next()) ;
-
- TaggedProfile profile = ptemp.create( oktemp, id ) ;
-
- add( profile ) ;
- }
- }
-
- /** Construct an IOR from an IORTemplate by applying the same
- * object id to each TaggedProfileTemplate in the IORTemplate.
- */
- public IORImpl( ORB orb, String typeId, IORTemplateList iortemps, ObjectId id)
- {
- this( orb, typeId ) ;
-
- this.iortemps = iortemps ;
-
- Iterator iter = iortemps.iterator() ;
- while (iter.hasNext()) {
- IORTemplate iortemp = (IORTemplate)(iter.next()) ;
- addTaggedProfiles( iortemp, id ) ;
- }
-
- makeImmutable() ;
- }
-
- public IORImpl(InputStream is)
- {
- this( (ORB)(is.orb()), is.read_string() ) ;
-
- IdentifiableFactoryFinder finder =
- factory.getTaggedProfileFactoryFinder() ;
-
- EncapsulationUtility.readIdentifiableSequence( this, finder, is ) ;
-
- makeImmutable() ;
- }
-
- public String getTypeId()
- {
- return typeId ;
- }
-
- public void write(OutputStream os)
- {
- os.write_string( typeId ) ;
- EncapsulationUtility.writeIdentifiableSequence( this, os ) ;
- }
-
- public String stringify()
- {
- StringWriter bs;
-
- MarshalOutputStream s =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
- s.putEndian();
- write( (OutputStream)s );
- bs = new StringWriter();
- try {
- s.writeTo(new HexOutputStream(bs));
- } catch (IOException ex) {
- throw wrapper.stringifyWriteError( ex ) ;
- }
-
- return ORBConstants.STRINGIFY_PREFIX + bs;
- }
-
- public synchronized void makeImmutable()
- {
- makeElementsImmutable() ;
-
- if (iortemps != null)
- iortemps.makeImmutable() ;
-
- super.makeImmutable() ;
- }
-
- public org.omg.IOP.IOR getIOPIOR() {
- EncapsOutputStream os =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
- write(os);
- InputStream is = (InputStream) (os.create_input_stream());
- return org.omg.IOP.IORHelper.read(is);
- }
-
- public boolean isNil()
- {
- //
- // The check for typeId length of 0 below is commented out
- // as a workaround for a bug in ORBs which send a
- // null objref with a non-empty typeId string.
- //
- return ((size() == 0) /* && (typeId.length() == 0) */);
- }
-
- public boolean isEquivalent(IOR ior)
- {
- Iterator myIterator = iterator() ;
- Iterator otherIterator = ior.iterator() ;
- while (myIterator.hasNext() && otherIterator.hasNext()) {
- TaggedProfile myProfile = (TaggedProfile)(myIterator.next()) ;
- TaggedProfile otherProfile = (TaggedProfile)(otherIterator.next()) ;
- if (!myProfile.isEquivalent( otherProfile ))
- return false ;
- }
-
- return myIterator.hasNext() == otherIterator.hasNext() ;
- }
-
- private void initializeIORTemplateList()
- {
- // Maps ObjectKeyTemplate to IORTemplate
- Map oktempToIORTemplate = new HashMap() ;
-
- iortemps = IORFactories.makeIORTemplateList() ;
- Iterator iter = iterator() ;
- ObjectId oid = null ; // used to check that all profiles have the same oid.
- while (iter.hasNext()) {
- TaggedProfile prof = (TaggedProfile)(iter.next()) ;
- TaggedProfileTemplate ptemp = prof.getTaggedProfileTemplate() ;
- ObjectKeyTemplate oktemp = prof.getObjectKeyTemplate() ;
-
- // Check that all oids for all profiles are the same: if they are not,
- // throw exception.
- if (oid == null)
- oid = prof.getObjectId() ;
- else if (!oid.equals( prof.getObjectId() ))
- throw wrapper.badOidInIorTemplateList() ;
-
- // Find or create the IORTemplate for oktemp.
- IORTemplate iortemp = (IORTemplate)(oktempToIORTemplate.get( oktemp )) ;
- if (iortemp == null) {
- iortemp = IORFactories.makeIORTemplate( oktemp ) ;
- oktempToIORTemplate.put( oktemp, iortemp ) ;
- iortemps.add( iortemp ) ;
- }
-
- iortemp.add( ptemp ) ;
- }
-
- iortemps.makeImmutable() ;
- }
-
- /** Return the IORTemplateList for this IOR. Will throw
- * exception if it is not possible to generate an IOR
- * from the IORTemplateList that is equal to this IOR,
- * which can only happen if not every TaggedProfile in the
- * IOR has the same ObjectId.
- */
- public synchronized IORTemplateList getIORTemplates()
- {
- if (iortemps == null)
- initializeIORTemplateList() ;
-
- return iortemps ;
- }
-
- /** Return the first IIOPProfile in this IOR.
- * XXX THIS IS TEMPORARY FOR BACKWARDS COMPATIBILITY AND WILL BE REMOVED
- * SOON!
- */
- public IIOPProfile getProfile()
- {
- IIOPProfile iop = null ;
- Iterator iter = iteratorById( TAG_INTERNET_IOP.value ) ;
- if (iter.hasNext())
- iop = (IIOPProfile)(iter.next()) ;
-
- if (iop != null)
- return iop ;
-
- // if we come to this point then no IIOP Profile
- // is present. Therefore, throw an exception.
- throw wrapper.iorMustHaveIiopProfile() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/IORTemplateImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/IORTemplateImpl.java
deleted file mode 100644
index 791c138..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/IORTemplateImpl.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.Iterator ;
-
-import org.omg.CORBA.INTERNAL ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-import org.omg.IOP.TAG_INTERNET_IOP ;
-
-import com.sun.corba.se.spi.ior.IdentifiableContainerBase ;
-import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
-import com.sun.corba.se.spi.ior.IORTemplate ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.IOR ;
-import com.sun.corba.se.spi.ior.IORFactory ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-/**
- * This class is a container of TaggedProfileTemplates.
- * @author
- */
-public class IORTemplateImpl extends IdentifiableContainerBase implements IORTemplate
-{
- private ObjectKeyTemplate oktemp ;
-
- public boolean equals( Object obj )
- {
- if (obj == null)
- return false ;
-
- if (!(obj instanceof IORTemplateImpl))
- return false ;
-
- IORTemplateImpl other = (IORTemplateImpl)obj ;
-
- return super.equals( obj ) && oktemp.equals( other.getObjectKeyTemplate() ) ;
- }
-
- public int hashCode()
- {
- return super.hashCode() ^ oktemp.hashCode() ;
- }
-
- public ObjectKeyTemplate getObjectKeyTemplate()
- {
- return oktemp ;
- }
-
- public IORTemplateImpl( ObjectKeyTemplate oktemp )
- {
- this.oktemp = oktemp ;
- }
-
- public IOR makeIOR( ORB orb, String typeid, ObjectId oid )
- {
- return new IORImpl( orb, typeid, this, oid ) ;
- }
-
- public boolean isEquivalent( IORFactory other )
- {
- if (!(other instanceof IORTemplate))
- return false ;
-
- IORTemplate list = (IORTemplate)other ;
-
- Iterator thisIterator = iterator() ;
- Iterator listIterator = list.iterator() ;
- while (thisIterator.hasNext() && listIterator.hasNext()) {
- TaggedProfileTemplate thisTemplate =
- (TaggedProfileTemplate)thisIterator.next() ;
- TaggedProfileTemplate listTemplate =
- (TaggedProfileTemplate)listIterator.next() ;
- if (!thisTemplate.isEquivalent( listTemplate ))
- return false ;
- }
-
- return (thisIterator.hasNext() == listIterator.hasNext()) &&
- getObjectKeyTemplate().equals( list.getObjectKeyTemplate() ) ;
- }
-
- /** Ensure that this IORTemplate and all of its profiles can not be
- * modified. This overrides the method inherited from
- * FreezableList through IdentifiableContainerBase.
- */
- public void makeImmutable()
- {
- makeElementsImmutable() ;
- super.makeImmutable() ;
- }
-
- public void write( OutputStream os )
- {
- oktemp.write( os ) ;
- EncapsulationUtility.writeIdentifiableSequence( this, os ) ;
- }
-
- public IORTemplateImpl( InputStream is )
- {
- ORB orb = (ORB)(is.orb()) ;
- IdentifiableFactoryFinder finder =
- orb.getTaggedProfileTemplateFactoryFinder() ;
-
- oktemp = orb.getObjectKeyFactory().createTemplate( is ) ;
- EncapsulationUtility.readIdentifiableSequence( this, finder, is ) ;
-
- makeImmutable() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/IORTemplateListImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/IORTemplateListImpl.java
deleted file mode 100644
index ec1d821..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/IORTemplateListImpl.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.ArrayList ;
-import java.util.Iterator ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.IORTemplate ;
-import com.sun.corba.se.spi.ior.IORTemplateList ;
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.IORTemplate ;
-import com.sun.corba.se.spi.ior.IOR ;
-import com.sun.corba.se.spi.ior.IORFactory ;
-import com.sun.corba.se.spi.ior.IORFactories ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-public class IORTemplateListImpl extends FreezableList implements IORTemplateList
-{
- /* This class must override add( int, Object ) and set( int, Object )
- * so that adding an IORTemplateList to an IORTemplateList just results
- * in a list of TaggedProfileTemplates.
- */
- public Object set( int index, Object element )
- {
- if (element instanceof IORTemplate) {
- return super.set( index, element ) ;
- } else if (element instanceof IORTemplateList) {
- Object result = remove( index ) ;
- add( index, element ) ;
- return result ;
- } else
- throw new IllegalArgumentException() ;
- }
-
- public void add( int index, Object element )
- {
- if (element instanceof IORTemplate) {
- super.add( index, element ) ;
- } else if (element instanceof IORTemplateList) {
- IORTemplateList tl = (IORTemplateList)element ;
- addAll( index, tl ) ;
- } else
- throw new IllegalArgumentException() ;
- }
-
- public IORTemplateListImpl()
- {
- super( new ArrayList() ) ;
- }
-
- public IORTemplateListImpl( InputStream is )
- {
- this() ;
- int size = is.read_long() ;
- for (int ctr=0; ctr<size; ctr++) {
- IORTemplate iortemp = IORFactories.makeIORTemplate( is ) ;
- add( iortemp ) ;
- }
-
- makeImmutable() ;
- }
-
- public void makeImmutable()
- {
- makeElementsImmutable() ;
- super.makeImmutable() ;
- }
-
- public void write( OutputStream os )
- {
- os.write_long( size() ) ;
- Iterator iter = iterator() ;
- while (iter.hasNext()) {
- IORTemplate iortemp = (IORTemplate)(iter.next()) ;
- iortemp.write( os ) ;
- }
- }
-
- public IOR makeIOR( ORB orb, String typeid, ObjectId oid )
- {
- return new IORImpl( orb, typeid, this, oid ) ;
- }
-
- public boolean isEquivalent( IORFactory other )
- {
- if (!(other instanceof IORTemplateList))
- return false ;
-
- IORTemplateList list = (IORTemplateList)other ;
-
- Iterator thisIterator = iterator() ;
- Iterator listIterator = list.iterator() ;
- while (thisIterator.hasNext() && listIterator.hasNext()) {
- IORTemplate thisTemplate = (IORTemplate)thisIterator.next() ;
- IORTemplate listTemplate = (IORTemplate)listIterator.next() ;
- if (!thisTemplate.isEquivalent( listTemplate ))
- return false ;
- }
-
- return thisIterator.hasNext() == listIterator.hasNext() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/IdentifiableFactoryFinderBase.java b/src/share/classes/com/sun/corba/se/impl/ior/IdentifiableFactoryFinderBase.java
deleted file mode 100644
index 89cc94c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/IdentifiableFactoryFinderBase.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-import java.util.Map ;
-import java.util.HashMap ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.ior.Identifiable ;
-import com.sun.corba.se.spi.ior.IdentifiableFactory ;
-import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.logging.IORSystemException ;
-
-public abstract class IdentifiableFactoryFinderBase implements
- IdentifiableFactoryFinder
-{
- private ORB orb ;
- private Map map ;
- protected IORSystemException wrapper ;
-
- protected IdentifiableFactoryFinderBase( ORB orb )
- {
- map = new HashMap() ;
- this.orb = orb ;
- wrapper = IORSystemException.get( orb,
- CORBALogDomains.OA_IOR ) ;
- }
-
- protected IdentifiableFactory getFactory(int id)
- {
- Integer ident = new Integer( id ) ;
- IdentifiableFactory factory = (IdentifiableFactory)(map.get(
- ident ) ) ;
- return factory ;
- }
-
- public abstract Identifiable handleMissingFactory( int id, InputStream is ) ;
-
- public Identifiable create(int id, InputStream is)
- {
- IdentifiableFactory factory = getFactory( id ) ;
-
- if (factory != null)
- return factory.create( is ) ;
- else
- return handleMissingFactory( id, is ) ;
- }
-
- public void registerFactory(IdentifiableFactory factory)
- {
- Integer ident = new Integer( factory.getId() ) ;
- map.put( ident, factory ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/JIDLObjectKeyTemplate.java b/src/share/classes/com/sun/corba/se/impl/ior/JIDLObjectKeyTemplate.java
deleted file mode 100644
index 3e7b9c2..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/JIDLObjectKeyTemplate.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import org.omg.CORBA.OctetSeqHolder ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
-
-/**
- * @author Ken Cavanaugh
- */
-public final class JIDLObjectKeyTemplate extends NewObjectKeyTemplateBase
-{
- /** This constructor reads the template ONLY from the stream.
- */
- public JIDLObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is )
- {
- super( orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID );
-
- setORBVersion( is ) ;
- }
-
- /** This constructor reads a complete ObjectKey (template and Id)
- * from the stream.
- */
- public JIDLObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is,
- OctetSeqHolder osh )
- {
- super( orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID );
-
- osh.value = readObjectKey( is ) ;
-
- setORBVersion( is ) ;
- }
-
- public JIDLObjectKeyTemplate( ORB orb, int scid, int serverid )
- {
- super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid,
- JIDL_ORB_ID, JIDL_OAID ) ;
-
- setORBVersion( ORBVersionFactory.getORBVersion() ) ;
- }
-
- protected void writeTemplate( OutputStream os )
- {
- os.write_long( getMagic() ) ;
- os.write_long( getSubcontractId() ) ;
- os.write_long( getServerId() ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/NewObjectKeyTemplateBase.java b/src/share/classes/com/sun/corba/se/impl/ior/NewObjectKeyTemplateBase.java
deleted file mode 100644
index 691927a..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/NewObjectKeyTemplateBase.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.io.IOException ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
-
-public abstract class NewObjectKeyTemplateBase extends ObjectKeyTemplateBase
-{
- public NewObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid,
- String orbid, ObjectAdapterId oaid )
- {
- super( orb, magic, scid, serverid, orbid, oaid ) ;
- // subclass must set the version, since we don't have the object key here.
-
- if (magic != ObjectKeyFactoryImpl.JAVAMAGIC_NEWER)
- throw wrapper.badMagic( new Integer( magic ) ) ;
- }
-
- public void write(ObjectId objectId, OutputStream os)
- {
- super.write( objectId, os ) ;
- getORBVersion().write( os ) ;
- }
-
- public void write(OutputStream os)
- {
- super.write( os ) ;
- getORBVersion().write( os ) ;
- }
-
- protected void setORBVersion( InputStream is )
- {
- ORBVersion version = ORBVersionFactory.create( is ) ;
- setORBVersion( version ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdArray.java b/src/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdArray.java
deleted file mode 100644
index bb98e46..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdArray.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import java.util.Iterator ;
-import java.util.Arrays ;
-
-public class ObjectAdapterIdArray extends ObjectAdapterIdBase {
- private final String[] objectAdapterId ;
-
- public ObjectAdapterIdArray( String[] objectAdapterId )
- {
- this.objectAdapterId = objectAdapterId ;
- }
-
- /** Special constructor used for OA IDs of length 2.
- */
- public ObjectAdapterIdArray( String name1, String name2 )
- {
- objectAdapterId = new String[2] ;
- objectAdapterId[0] = name1 ;
- objectAdapterId[1] = name2 ;
- }
-
- public int getNumLevels()
- {
- return objectAdapterId.length ;
- }
-
- public Iterator iterator()
- {
- return Arrays.asList( objectAdapterId ).iterator() ;
- }
-
- public String[] getAdapterName()
- {
- return (String[])(objectAdapterId.clone()) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdBase.java b/src/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdBase.java
deleted file mode 100644
index febce61..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdBase.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import java.util.Iterator ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-abstract class ObjectAdapterIdBase implements ObjectAdapterId {
- public boolean equals( Object other )
- {
- if (!(other instanceof ObjectAdapterId))
- return false ;
-
- ObjectAdapterId theOther = (ObjectAdapterId)other ;
-
- Iterator iter1 = iterator() ;
- Iterator iter2 = theOther.iterator() ;
-
- while (iter1.hasNext() && iter2.hasNext()) {
- String str1 = (String)(iter1.next()) ;
- String str2 = (String)(iter2.next()) ;
-
- if (!str1.equals( str2 ))
- return false ;
- }
-
- return iter1.hasNext() == iter2.hasNext() ;
- }
-
- public int hashCode()
- {
- int result = 17 ;
- Iterator iter = iterator() ;
- while (iter.hasNext()) {
- String str = (String)(iter.next()) ;
- result = 37*result + str.hashCode() ;
- }
- return result ;
- }
-
- public String toString()
- {
- StringBuffer buff = new StringBuffer() ;
- buff.append( "ObjectAdapterID[" ) ;
- Iterator iter = iterator() ;
- boolean first = true ;
- while (iter.hasNext()) {
- String str = (String)(iter.next()) ;
-
- if (first)
- first = false ;
- else
- buff.append( "/" ) ;
-
- buff.append( str ) ;
- }
-
- buff.append( "]" ) ;
-
- return buff.toString() ;
- }
-
- public void write( OutputStream os )
- {
- os.write_long( getNumLevels() ) ;
- Iterator iter = iterator() ;
- while (iter.hasNext()) {
- String str = (String)(iter.next()) ;
- os.write_string( str ) ;
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java b/src/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java
deleted file mode 100644
index 6c57923..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, 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.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import java.util.Iterator ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-/** ObjectAdapterIdNumber is used to represent pre-JDK 1.4 POA adapter
- * IDs. The POA ID was simply represented as a single integer, which was
- * mapped to the actual POA instance. Here, we just represent these
- * internally as arrays of the form { "OldRootPOA", "<number>" },
- * and provide an extra method to get the number back.
- */
-public class ObjectAdapterIdNumber extends ObjectAdapterIdArray {
- private int poaid ;
-
- public ObjectAdapterIdNumber( int poaid )
- {
- super( "OldRootPOA", Integer.toString( poaid ) ) ;
- this.poaid = poaid ;
- }
-
- public int getOldPOAId()
- {
- return poaid ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/ObjectIdImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/ObjectIdImpl.java
deleted file mode 100644
index 1c1d3c2..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/ObjectIdImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.Arrays ;
-import com.sun.corba.se.spi.ior.ObjectId ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-/**
- * @author
- */
-public final class ObjectIdImpl implements ObjectId
-{
- private byte[] id;
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof ObjectIdImpl))
- return false ;
-
- ObjectIdImpl other = (ObjectIdImpl)obj ;
-
- return Arrays.equals( this.id, other.id ) ;
- }
-
- public int hashCode()
- {
- int result = 17 ;
- for (int ctr=0; ctr<id.length; ctr++)
- result = 37*result + id[ctr] ;
- return result ;
- }
-
- public ObjectIdImpl( byte[] id )
- {
- this.id = id ;
- }
-
- public byte[] getId()
- {
- return id ;
- }
-
- public void write( OutputStream os )
- {
- os.write_long( id.length ) ;
- os.write_octet_array( id, 0, id.length ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java
deleted file mode 100644
index d774994..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.io.IOException ;
-
-import org.omg.CORBA.MARSHAL ;
-import org.omg.CORBA.OctetSeqHolder ;
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectKey ;
-import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.impl.ior.JIDLObjectKeyTemplate ;
-import com.sun.corba.se.impl.ior.POAObjectKeyTemplate ;
-import com.sun.corba.se.impl.ior.WireObjectKeyTemplate ;
-import com.sun.corba.se.impl.ior.ObjectIdImpl ;
-import com.sun.corba.se.impl.ior.ObjectKeyImpl ;
-import com.sun.corba.se.impl.logging.IORSystemException ;
-
-import com.sun.corba.se.impl.encoding.EncapsInputStream ;
-import sun.corba.EncapsInputStreamFactory;
-
-
-/** Based on the magic and scid, return the appropriate
-* ObjectKeyTemplate. Expects to be called with a valid
-* magic. If scid is not valid, null should be returned.
-*/
-interface Handler {
- ObjectKeyTemplate handle( int magic, int scid,
- InputStream is, OctetSeqHolder osh ) ;
-}
-
-/** Singleton used to manufacture ObjectKey and ObjectKeyTemplate
- * instances.
- * @author Ken Cavanaugh
- */
-public class ObjectKeyFactoryImpl implements ObjectKeyFactory
-{
- public static final int MAGIC_BASE = 0xAFABCAFE ;
-
- // Magic used in our object keys for JDK 1.2, 1.3, RMI-IIOP OP,
- // J2EE 1.0-1.2.1.
- public static final int JAVAMAGIC_OLD = MAGIC_BASE ;
-
- // Magic used only in JDK 1.3.1. No format changes in object keys.
- public static final int JAVAMAGIC_NEW = MAGIC_BASE + 1 ;
-
- // New magic used in our object keys for JDK 1.4, J2EE 1.3 and later.
- // Format changes: all object keys have version string; POA key format
- // is changed.
- public static final int JAVAMAGIC_NEWER = MAGIC_BASE + 2 ;
-
- public static final int MAX_MAGIC = JAVAMAGIC_NEWER ;
-
- // Beginning in JDK 1.3.1_01, we introduced changes which required
- // the ability to distinguish between JDK 1.3.1 FCS and the patch
- // versions. See OldJIDLObjectKeyTemplate.
- public static final byte JDK1_3_1_01_PATCH_LEVEL = 1;
-
- private final ORB orb ;
- private IORSystemException wrapper ;
-
- public ObjectKeyFactoryImpl( ORB orb )
- {
- this.orb = orb ;
- wrapper = IORSystemException.get( orb,
- CORBALogDomains.OA_IOR ) ;
- }
-
- // XXX The handlers still need to be made pluggable.
- //
- // I think this can be done as follows:
- // 1. Move the Handler interface into the SPI as ObjectKeyHandler.
- // 2. Add two methods to ObjectAdapterFactory:
- // ObjectKeyHandler getHandlerForObjectKey( ) ;
- // ObjectKeyHandler getHandlerForObjectKeyTemplate( ) ;
- // 3. Move the implementation of the fullKey handler and the
- // oktempOnly handler into TOAFactory and POAFactory.
- // 4. Move the ObjectKey impl classes into the impl/oa packages.
- // 5. Create an internal interface
- // interface HandlerFinder {
- // ObjectKeyHandler get( int scid ) ;
- // }
- // and modify create(InputStream,Handler,OctetSeqHolder)
- // to take a HandlerFinder instead of a Handler.
- // 6. Modify create( byte[] ) and createTemplate( InputStream )
- // to create an instance of HandlerFinder: something like:
- // new HandlerFinder() {
- // ObjectKeyHandler get( int scid )
- // {
- // return orb.getRequestDispatcherRegistry().
- // getObjectAdapterFactory( scid ).getHandlerForObjectKey() ;
- // }
- // and similarly for getHandlerForObjectKeyTemplate.
-
- /** This handler reads the full object key, both the oktemp
- * and the ID.
- */
- private Handler fullKey = new Handler() {
- public ObjectKeyTemplate handle( int magic, int scid,
- InputStream is, OctetSeqHolder osh ) {
- ObjectKeyTemplate oktemp = null ;
-
- if ((scid >= ORBConstants.FIRST_POA_SCID) &&
- (scid <= ORBConstants.MAX_POA_SCID)) {
- if (magic >= JAVAMAGIC_NEWER)
- oktemp = new POAObjectKeyTemplate( orb, magic, scid, is, osh ) ;
- else
- oktemp = new OldPOAObjectKeyTemplate( orb, magic, scid, is, osh ) ;
- } else if ((scid >= 0) && (scid < ORBConstants.FIRST_POA_SCID)) {
- if (magic >= JAVAMAGIC_NEWER)
- oktemp = new JIDLObjectKeyTemplate( orb, magic, scid, is, osh ) ;
- else
- oktemp = new OldJIDLObjectKeyTemplate( orb, magic, scid, is, osh );
- }
-
- return oktemp ;
- }
- } ;
-
- /** This handler reads only the oktemp.
- */
- private Handler oktempOnly = new Handler() {
- public ObjectKeyTemplate handle( int magic, int scid,
- InputStream is, OctetSeqHolder osh ) {
- ObjectKeyTemplate oktemp = null ;
-
- if ((scid >= ORBConstants.FIRST_POA_SCID) &&
- (scid <= ORBConstants.MAX_POA_SCID)) {
- if (magic >= JAVAMAGIC_NEWER)
- oktemp = new POAObjectKeyTemplate( orb, magic, scid, is ) ;
- else
- oktemp = new OldPOAObjectKeyTemplate( orb, magic, scid, is ) ;
- } else if ((scid >= 0) && (scid < ORBConstants.FIRST_POA_SCID)) {
- if (magic >= JAVAMAGIC_NEWER)
- oktemp = new JIDLObjectKeyTemplate( orb, magic, scid, is ) ;
- else
- oktemp = new OldJIDLObjectKeyTemplate( orb, magic, scid, is ) ;
- }
-
- return oktemp ;
- }
- } ;
-
- /** Returns true iff magic is in the range of valid magic numbers
- * for our ORB.
- */
- private boolean validMagic( int magic )
- {
- return (magic >= MAGIC_BASE) && (magic <= MAX_MAGIC) ;
- }
-
- /** Creates an ObjectKeyTemplate from the InputStream. Most of the
- * decoding is done inside the handler.
- */
- private ObjectKeyTemplate create( InputStream is, Handler handler,
- OctetSeqHolder osh )
- {
- ObjectKeyTemplate oktemp = null ;
-
- try {
- is.mark(0) ;
- int magic = is.read_long() ;
-
- if (validMagic( magic )) {
- int scid = is.read_long() ;
- oktemp = handler.handle( magic, scid, is, osh ) ;
- }
- } catch (MARSHAL mexc) {
- // XXX log this error
- // ignore this: error handled below because oktemp == null
- }
-
- if (oktemp == null)
- // If we did not successfully construct a oktemp, reset the
- // stream so that WireObjectKeyTemplate can correctly construct the
- // object key.
- try {
- is.reset() ;
- } catch (IOException exc) {
- // XXX log this error
- // ignore this
- }
-
- return oktemp ;
- }
-
- public ObjectKey create( byte[] key )
- {
- OctetSeqHolder osh = new OctetSeqHolder() ;
- EncapsInputStream is = EncapsInputStreamFactory.newEncapsInputStream( orb, key, key.length );
-
- ObjectKeyTemplate oktemp = create( is, fullKey, osh ) ;
- if (oktemp == null)
- oktemp = new WireObjectKeyTemplate( is, osh ) ;
-
- ObjectId oid = new ObjectIdImpl( osh.value ) ;
- return new ObjectKeyImpl( oktemp, oid ) ;
- }
-
- public ObjectKeyTemplate createTemplate( InputStream is )
- {
- ObjectKeyTemplate oktemp = create( is, oktempOnly, null ) ;
- if (oktemp == null)
- oktemp = new WireObjectKeyTemplate( orb ) ;
-
- return oktemp ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java
deleted file mode 100644
index ad2019a..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectKey ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-
-import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
-
-/**
- * @author
- */
-public class ObjectKeyImpl implements ObjectKey
-{
- private ObjectKeyTemplate oktemp;
- private ObjectId id;
-
- public boolean equals( Object obj )
- {
- if (obj == null)
- return false ;
-
- if (!(obj instanceof ObjectKeyImpl))
- return false ;
-
- ObjectKeyImpl other = (ObjectKeyImpl)obj ;
-
- return oktemp.equals( other.oktemp ) &&
- id.equals( other.id ) ;
- }
-
- public int hashCode()
- {
- return oktemp.hashCode() ^ id.hashCode() ;
- }
-
- public ObjectKeyTemplate getTemplate()
- {
- return oktemp ;
- }
-
- public ObjectId getId()
- {
- return id ;
- }
-
- public ObjectKeyImpl( ObjectKeyTemplate oktemp, ObjectId id )
- {
- this.oktemp = oktemp ;
- this.id = id ;
- }
-
- public void write( OutputStream os )
- {
- oktemp.write( id, os ) ;
- }
-
- public byte[] getBytes( org.omg.CORBA.ORB orb )
- {
- EncapsOutputStream os =
- sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
- write( os ) ;
- return os.toByteArray() ;
- }
-
- public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb )
- {
- return oktemp.getServerRequestDispatcher( orb, id ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyTemplateBase.java b/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyTemplateBase.java
deleted file mode 100644
index 845de9a..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyTemplateBase.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.Iterator ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-
-import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
-
-import com.sun.corba.se.impl.logging.IORSystemException ;
-
-
-/**
- * @author
- */
-public abstract class ObjectKeyTemplateBase implements ObjectKeyTemplate
-{
- // Fixed constants for Java IDL object key template forms
- public static final String JIDL_ORB_ID = "" ;
- private static final String[] JIDL_OAID_STRINGS = { "TransientObjectAdapter" } ;
- public static final ObjectAdapterId JIDL_OAID = new ObjectAdapterIdArray( JIDL_OAID_STRINGS ) ;
-
- private ORB orb ;
- protected IORSystemException wrapper ;
- private ORBVersion version ;
- private int magic ;
- private int scid ;
- private int serverid ;
- private String orbid ;
- private ObjectAdapterId oaid ;
-
- private byte[] adapterId ;
-
- public byte[] getAdapterId()
- {
- return (byte[])(adapterId.clone()) ;
- }
-
- private byte[] computeAdapterId()
- {
- // write out serverid, orbid, oaid
- ByteBuffer buff = new ByteBuffer() ;
-
- buff.append( getServerId() ) ;
- buff.append( orbid ) ;
-
- buff.append( oaid.getNumLevels() ) ;
- Iterator iter = oaid.iterator() ;
- while (iter.hasNext()) {
- String comp = (String)(iter.next()) ;
- buff.append( comp ) ;
- }
-
- buff.trimToSize() ;
-
- return buff.toArray() ;
- }
-
- public ObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid,
- String orbid, ObjectAdapterId oaid )
- {
- this.orb = orb ;
- this.wrapper = IORSystemException.get( orb,
- CORBALogDomains.OA_IOR ) ;
- this.magic = magic ;
- this.scid = scid ;
- this.serverid = serverid ;
- this.orbid = orbid ;
- this.oaid = oaid ;
-
- adapterId = computeAdapterId() ;
- }
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof ObjectKeyTemplateBase))
- return false ;
-
- ObjectKeyTemplateBase other = (ObjectKeyTemplateBase)obj ;
-
- return (magic == other.magic) && (scid == other.scid) &&
- (serverid == other.serverid) && (version.equals( other.version ) &&
- orbid.equals( other.orbid ) && oaid.equals( other.oaid )) ;
- }
-
- public int hashCode()
- {
- int result = 17 ;
- result = 37*result + magic ;
- result = 37*result + scid ;
- result = 37*result + serverid ;
- result = 37*result + version.hashCode() ;
- result = 37*result + orbid.hashCode() ;
- result = 37*result + oaid.hashCode() ;
- return result ;
- }
-
- public int getSubcontractId()
- {
- return scid ;
- }
-
- public int getServerId()
- {
- return serverid ;
- }
-
- public String getORBId()
- {
- return orbid ;
- }
-
- public ObjectAdapterId getObjectAdapterId()
- {
- return oaid ;
- }
-
- public void write(ObjectId objectId, OutputStream os)
- {
- writeTemplate( os ) ;
- objectId.write( os ) ;
- }
-
- public void write( OutputStream os )
- {
- writeTemplate( os ) ;
- }
-
- abstract protected void writeTemplate( OutputStream os ) ;
-
- protected int getMagic()
- {
- return magic ;
- }
-
- // All subclasses should set the version in their constructors.
- // Public so it can be used in a white-box test.
- public void setORBVersion( ORBVersion version )
- {
- this.version = version ;
- }
-
- public ORBVersion getORBVersion()
- {
- return version ;
- }
-
- protected byte[] readObjectKey( InputStream is )
- {
- int len = is.read_long() ;
- byte[] result = new byte[len] ;
- is.read_octet_array( result, 0, len ) ;
- return result ;
- }
-
- public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb, ObjectId id )
- {
- return orb.getRequestDispatcherRegistry().getServerRequestDispatcher( scid ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl.java
deleted file mode 100644
index cb5424c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import java.util.Iterator ;
-
-import org.omg.CORBA.portable.InputStream ;
-import org.omg.CORBA.portable.OutputStream ;
-import org.omg.CORBA.portable.StreamableValue ;
-
-import org.omg.CORBA.TypeCode ;
-
-import org.omg.PortableInterceptor.ObjectReferenceFactory ;
-import org.omg.PortableInterceptor.ObjectReferenceFactoryHelper ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactory;
-import com.sun.corba.se.spi.ior.IORTemplateList;
-import com.sun.corba.se.spi.ior.IORFactories;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-/** This is an implementation of the ObjectReferenceFactory abstract value
-* type defined by the portable interceptors IDL.
-* Note that this is a direct Java implementation
-* of the abstract value type: there is no stateful value type defined in IDL,
-* since defining the state in IDL is awkward and inefficient. The best way
-* to define the state is to use internal data structures that can be written
-* to and read from CORBA streams.
-*/
-public class ObjectReferenceFactoryImpl extends ObjectReferenceProducerBase
- implements ObjectReferenceFactory, StreamableValue
-{
- transient private IORTemplateList iorTemplates ;
-
- public ObjectReferenceFactoryImpl( InputStream is )
- {
- super( (ORB)(is.orb()) ) ;
- _read( is ) ;
- }
-
- public ObjectReferenceFactoryImpl( ORB orb, IORTemplateList iortemps )
- {
- super( orb ) ;
- iorTemplates = iortemps ;
- }
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof ObjectReferenceFactoryImpl))
- return false ;
-
- ObjectReferenceFactoryImpl other = (ObjectReferenceFactoryImpl)obj ;
-
- return (iorTemplates != null) &&
- iorTemplates.equals( other.iorTemplates ) ;
- }
-
- public int hashCode()
- {
- return iorTemplates.hashCode() ;
- }
-
- // Note that this repository ID must reflect the implementation
- // of the abstract valuetype (that is, this class), not the
- // repository ID of the org.omg.PortableInterceptor.ObjectReferenceFactory
- // class. This allows for multiple independent implementations
- // of the abstract valuetype, should that become necessary.
- public static final String repositoryId =
- "IDL:com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl:1.0" ;
-
- public String[] _truncatable_ids()
- {
- return new String[] { repositoryId } ;
- }
-
- public TypeCode _type()
- {
- return ObjectReferenceFactoryHelper.type() ;
- }
-
- /** Read the data into a (presumably) empty ObjectReferenceFactoryImpl.
- * This sets the orb to the ORB of the InputStream.
- */
- public void _read( InputStream is )
- {
- org.omg.CORBA_2_3.portable.InputStream istr =
- (org.omg.CORBA_2_3.portable.InputStream)is ;
-
- iorTemplates = IORFactories.makeIORTemplateList( istr ) ;
- }
-
- /** Write the state to the OutputStream.
- */
- public void _write( OutputStream os )
- {
- org.omg.CORBA_2_3.portable.OutputStream ostr =
- (org.omg.CORBA_2_3.portable.OutputStream)os ;
-
- iorTemplates.write( ostr ) ;
- }
-
- public IORFactory getIORFactory()
- {
- return iorTemplates ;
- }
-
- public IORTemplateList getIORTemplateList()
- {
- return iorTemplates ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceProducerBase.java b/src/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceProducerBase.java
deleted file mode 100644
index f4a3a60..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceProducerBase.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.ior.IORFactory ;
-import com.sun.corba.se.spi.ior.IOR ;
-import com.sun.corba.se.spi.ior.IORFactories ;
-import com.sun.corba.se.spi.ior.IORTemplateList ;
-import com.sun.corba.se.spi.ior.ObjectId ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-
-import com.sun.corba.se.impl.logging.IORSystemException ;
-
-public abstract class ObjectReferenceProducerBase {
- transient protected ORB orb ;
-
- public abstract IORFactory getIORFactory() ;
-
- public abstract IORTemplateList getIORTemplateList() ;
-
- public ObjectReferenceProducerBase( ORB orb )
- {
- this.orb = orb ;
- }
-
- public org.omg.CORBA.Object make_object (String repositoryId,
- byte[] objectId)
- {
- ObjectId oid = IORFactories.makeObjectId( objectId ) ;
- IOR ior = getIORFactory().makeIOR( orb, repositoryId, oid ) ;
-
- return ORBUtility.makeObjectReference( ior ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl.java
deleted file mode 100644
index 267f2db..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import java.util.Iterator ;
-
-import org.omg.CORBA.portable.InputStream ;
-import org.omg.CORBA.portable.OutputStream ;
-import org.omg.CORBA.portable.StreamableValue ;
-
-import org.omg.CORBA.TypeCode ;
-
-import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
-import org.omg.PortableInterceptor.ObjectReferenceTemplateHelper ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactory;
-import com.sun.corba.se.spi.ior.IORTemplate;
-import com.sun.corba.se.spi.ior.IORTemplateList;
-import com.sun.corba.se.spi.ior.IORFactories;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-/** This is an implementation of the ObjectReferenceTemplate abstract value
-* type defined by the portable interceptors IDL.
-* Note that this is a direct Java implementation
-* of the abstract value type: there is no stateful value type defined in IDL,
-* since defining the state in IDL is awkward and inefficient. The best way
-* to define the state is to use internal data structures that can be written
-* to and read from CORBA streams.
-*/
-public class ObjectReferenceTemplateImpl extends ObjectReferenceProducerBase
- implements ObjectReferenceTemplate, StreamableValue
-{
- transient private IORTemplate iorTemplate ;
-
- public ObjectReferenceTemplateImpl( InputStream is )
- {
- super( (ORB)(is.orb()) ) ;
- _read( is ) ;
- }
-
- public ObjectReferenceTemplateImpl( ORB orb, IORTemplate iortemp )
- {
- super( orb ) ;
- iorTemplate = iortemp ;
- }
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof ObjectReferenceTemplateImpl))
- return false ;
-
- ObjectReferenceTemplateImpl other = (ObjectReferenceTemplateImpl)obj ;
-
- return (iorTemplate != null) &&
- iorTemplate.equals( other.iorTemplate ) ;
- }
-
- public int hashCode()
- {
- return iorTemplate.hashCode() ;
- }
-
- // Note that this repository ID must reflect the implementation
- // of the abstract valuetype (that is, this class), not the
- // repository ID of the org.omg.PortableInterceptor.ObjectReferenceTemplate
- // class. This allows for multiple independent implementations
- // of the abstract valuetype, should that become necessary.
- public static final String repositoryId =
- "IDL:com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl:1.0" ;
-
- public String[] _truncatable_ids()
- {
- return new String[] { repositoryId } ;
- }
-
- public TypeCode _type()
- {
- return ObjectReferenceTemplateHelper.type() ;
- }
-
- /** Read the data into a (presumably) empty ORTImpl. This sets the
- * orb to the ORB of the InputStream.
- */
- public void _read( InputStream is )
- {
- org.omg.CORBA_2_3.portable.InputStream istr =
- (org.omg.CORBA_2_3.portable.InputStream)is ;
- iorTemplate = IORFactories.makeIORTemplate( istr ) ;
- orb = (ORB)(istr.orb()) ;
- }
-
- /** Write the state to the OutputStream.
- */
- public void _write( OutputStream os )
- {
- org.omg.CORBA_2_3.portable.OutputStream ostr =
- (org.omg.CORBA_2_3.portable.OutputStream)os ;
-
- iorTemplate.write( ostr ) ;
- }
-
- public String server_id ()
- {
- int val = iorTemplate.getObjectKeyTemplate().getServerId() ;
- return Integer.toString( val ) ;
- }
-
- public String orb_id ()
- {
- return iorTemplate.getObjectKeyTemplate().getORBId() ;
- }
-
- public String[] adapter_name()
- {
- ObjectAdapterId poaid =
- iorTemplate.getObjectKeyTemplate().getObjectAdapterId() ;
-
- return poaid.getAdapterName() ;
- }
-
- public IORFactory getIORFactory()
- {
- return iorTemplate ;
- }
-
- public IORTemplateList getIORTemplateList()
- {
- IORTemplateList tl = IORFactories.makeIORTemplateList() ;
- tl.add( iorTemplate ) ;
- tl.makeImmutable() ;
- return tl ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/OldJIDLObjectKeyTemplate.java b/src/share/classes/com/sun/corba/se/impl/ior/OldJIDLObjectKeyTemplate.java
deleted file mode 100644
index e5b854c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/OldJIDLObjectKeyTemplate.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import org.omg.CORBA.OctetSeqHolder ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
-
-import com.sun.corba.se.impl.encoding.CDRInputStream ;
-
-/**
- * Handles object keys created by JDK ORBs from before JDK 1.4.0.
- */
-public final class OldJIDLObjectKeyTemplate extends OldObjectKeyTemplateBase
-{
- /**
- * JDK 1.3.1 FCS did not include a version byte at the end of
- * its object keys. JDK 1.3.1_01 included the byte with the
- * value 1. Anything below 1 is considered an invalid value.
- */
- public static final byte NULL_PATCH_VERSION = 0;
-
- byte patchVersion = OldJIDLObjectKeyTemplate.NULL_PATCH_VERSION;
-
- public OldJIDLObjectKeyTemplate( ORB orb, int magic, int scid,
- InputStream is, OctetSeqHolder osh )
- {
- this( orb, magic, scid, is );
-
- osh.value = readObjectKey( is ) ;
-
- /**
- * Beginning with JDK 1.3.1_01, a byte was placed at the end of
- * the object key with a value indicating the patch version.
- * JDK 1.3.1_01 had the value 1. If other patches are necessary
- * which involve ORB versioning changes, they should increment
- * the patch version.
- *
- * Note that if we see a value greater than 1 in this code, we
- * will treat it as if we're talking to the most recent ORB version.
- *
- * WARNING: This code is sensitive to changes in CDRInputStream
- * getPosition. It assumes that the CDRInputStream is an
- * encapsulation whose position can be compared to the object
- * key array length.
- */
- if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW &&
- osh.value.length > ((CDRInputStream)is).getPosition()) {
-
- patchVersion = is.read_octet();
-
- if (patchVersion == ObjectKeyFactoryImpl.JDK1_3_1_01_PATCH_LEVEL)
- setORBVersion(ORBVersionFactory.getJDK1_3_1_01());
- else if (patchVersion > ObjectKeyFactoryImpl.JDK1_3_1_01_PATCH_LEVEL)
- setORBVersion(ORBVersionFactory.getORBVersion());
- else
- throw wrapper.invalidJdk131PatchLevel( new Integer( patchVersion ) ) ;
- }
- }
-
-
- public OldJIDLObjectKeyTemplate( ORB orb, int magic, int scid, int serverid)
- {
- super( orb, magic, scid, serverid, JIDL_ORB_ID, JIDL_OAID ) ;
- }
-
- public OldJIDLObjectKeyTemplate(ORB orb, int magic, int scid, InputStream is)
- {
- this( orb, magic, scid, is.read_long() ) ;
- }
-
- protected void writeTemplate( OutputStream os )
- {
- os.write_long( getMagic() ) ;
- os.write_long( getSubcontractId() ) ;
- os.write_long( getServerId() ) ;
- }
-
- public void write(ObjectId objectId, OutputStream os)
- {
- super.write(objectId, os);
-
- if (patchVersion != OldJIDLObjectKeyTemplate.NULL_PATCH_VERSION)
- os.write_octet( patchVersion ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/OldObjectKeyTemplateBase.java b/src/share/classes/com/sun/corba/se/impl/ior/OldObjectKeyTemplateBase.java
deleted file mode 100644
index e68d6f6..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/OldObjectKeyTemplateBase.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
-
-/**
- * @author Ken Cavanaugh
- */
-public abstract class OldObjectKeyTemplateBase extends ObjectKeyTemplateBase
-{
- public OldObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid,
- String orbid, ObjectAdapterId oaid )
- {
- super( orb, magic, scid, serverid, orbid, oaid ) ;
-
- // set version based on magic
- if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_OLD)
- setORBVersion( ORBVersionFactory.getOLD() ) ;
- else if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW)
- setORBVersion( ORBVersionFactory.getNEW() ) ;
- else // any other magic should not be here
- throw wrapper.badMagic( new Integer( magic ) ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/OldPOAObjectKeyTemplate.java b/src/share/classes/com/sun/corba/se/impl/ior/OldPOAObjectKeyTemplate.java
deleted file mode 100644
index 626310c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/OldPOAObjectKeyTemplate.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.OctetSeqHolder ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
-
-/**
- * @author Ken Cavanaugh
- */
-public final class OldPOAObjectKeyTemplate extends OldObjectKeyTemplateBase
-{
- /** This constructor reads the template ONLY from the stream
- */
- public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is )
- {
- this( orb, magic, scid, is.read_long(), is.read_long(), is.read_long() ) ;
- }
-
- /** This constructor reads a complete ObjectKey (template and Id)
- * from the stream.
- */
- public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is,
- OctetSeqHolder osh )
- {
- this( orb, magic, scid, is ) ;
- osh.value = readObjectKey( is ) ;
- }
-
- public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, int serverid,
- int orbid, int poaid)
- {
- super( orb, magic, scid, serverid,
- Integer.toString( orbid ),
- new ObjectAdapterIdNumber( poaid ) ) ;
- }
-
- public void writeTemplate(OutputStream os)
- {
- os.write_long( getMagic() ) ;
- os.write_long( getSubcontractId() ) ;
- os.write_long( getServerId() ) ;
-
- int orbid = Integer.parseInt( getORBId() ) ;
- os.write_long( orbid ) ;
-
- ObjectAdapterIdNumber oaid = (ObjectAdapterIdNumber)(getObjectAdapterId()) ;
- int poaid = oaid.getOldPOAId() ;
- os.write_long( poaid ) ;
- }
-
- public ORBVersion getORBVersion()
- {
- if (getMagic() == ObjectKeyFactoryImpl.JAVAMAGIC_OLD)
- return ORBVersionFactory.getOLD() ;
- else if (getMagic() == ObjectKeyFactoryImpl.JAVAMAGIC_NEW)
- return ORBVersionFactory.getNEW() ;
- else
- throw new INTERNAL() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/POAObjectKeyTemplate.java b/src/share/classes/com/sun/corba/se/impl/ior/POAObjectKeyTemplate.java
deleted file mode 100644
index ddb7d82..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/POAObjectKeyTemplate.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.Iterator ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import org.omg.CORBA.OctetSeqHolder ;
-
-import com.sun.corba.se.spi.activation.POANameHelper ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
-
-/**
- * @author
- */
-public final class POAObjectKeyTemplate extends NewObjectKeyTemplateBase
-{
- /** This constructor reads the template ONLY from the stream.
- */
- public POAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is )
- {
- super( orb, magic, scid, is.read_long(), is.read_string(),
- new ObjectAdapterIdArray( POANameHelper.read( is ) ) ) ;
-
- setORBVersion( is ) ;
- }
-
- /** This constructor reads a complete ObjectKey (template and Id)
- * from the stream.
- */
- public POAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is,
- OctetSeqHolder osh )
- {
- super( orb, magic, scid, is.read_long(), is.read_string(),
- new ObjectAdapterIdArray( POANameHelper.read( is ) ) ) ;
-
- osh.value = readObjectKey( is ) ;
-
- setORBVersion( is ) ;
- }
-
- public POAObjectKeyTemplate( ORB orb, int scid, int serverid, String orbid,
- ObjectAdapterId objectAdapterId)
- {
- super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, orbid,
- objectAdapterId ) ;
-
- setORBVersion( ORBVersionFactory.getORBVersion() ) ;
- }
-
- public void writeTemplate(OutputStream os)
- {
- os.write_long( getMagic() ) ;
- os.write_long( getSubcontractId() ) ;
- os.write_long( getServerId() ) ;
- os.write_string( getORBId() ) ;
- getObjectAdapterId().write( os ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/StubIORImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/StubIORImpl.java
deleted file mode 100644
index b495436..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/StubIORImpl.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.io.ObjectInputStream ;
-import java.io.ObjectOutputStream ;
-import java.io.IOException ;
-import java.io.StringWriter ;
-
-import org.omg.CORBA.ORB ;
-
-import org.omg.CORBA.portable.Delegate ;
-import org.omg.CORBA.portable.InputStream ;
-import org.omg.CORBA.portable.OutputStream ;
-
-// Be very careful: com.sun.corba imports must not depend on
-// PEORB internal classes in ways that prevent portability to
-// other vendor's ORBs.
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
-import com.sun.corba.se.impl.orbutil.HexOutputStream ;
-
-/**
- * This class implements a very simply IOR representation
- * which must be completely ORBImpl free so that this class
- * can be used in the implementation of a portable StubDelegateImpl.
- */
-public class StubIORImpl
-{
- // cached hash code
- private int hashCode;
-
- // IOR components
- private byte[] typeData;
- private int[] profileTags;
- private byte[][] profileData;
-
- public StubIORImpl()
- {
- hashCode = 0 ;
- typeData = null ;
- profileTags = null ;
- profileData = null ;
- }
-
- public String getRepositoryId()
- {
- if (typeData == null)
- return null ;
-
- return new String( typeData ) ;
- }
-
- public StubIORImpl( org.omg.CORBA.Object obj )
- {
- // write the IOR to an OutputStream and get an InputStream
- OutputStream ostr = StubAdapter.getORB( obj ).create_output_stream();
- ostr.write_Object(obj);
- InputStream istr = ostr.create_input_stream();
-
- // read the IOR components back from the stream
- int typeLength = istr.read_long();
- typeData = new byte[typeLength];
- istr.read_octet_array(typeData, 0, typeLength);
- int numProfiles = istr.read_long();
- profileTags = new int[numProfiles];
- profileData = new byte[numProfiles][];
- for (int i = 0; i < numProfiles; i++) {
- profileTags[i] = istr.read_long();
- profileData[i] = new byte[istr.read_long()];
- istr.read_octet_array(profileData[i], 0, profileData[i].length);
- }
- }
-
- public Delegate getDelegate( ORB orb )
- {
- // write the IOR components to an org.omg.CORBA.portable.OutputStream
- OutputStream ostr = orb.create_output_stream();
- ostr.write_long(typeData.length);
- ostr.write_octet_array(typeData, 0, typeData.length);
- ostr.write_long(profileTags.length);
- for (int i = 0; i < profileTags.length; i++) {
- ostr.write_long(profileTags[i]);
- ostr.write_long(profileData[i].length);
- ostr.write_octet_array(profileData[i], 0, profileData[i].length);
- }
-
- InputStream istr = ostr.create_input_stream() ;
-
- // read the IOR back from the stream
- org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
- return StubAdapter.getDelegate( obj ) ;
- }
-
- public void doRead( java.io.ObjectInputStream stream )
- throws IOException, ClassNotFoundException
- {
- // read the IOR from the ObjectInputStream
- int typeLength = stream.readInt();
- typeData = new byte[typeLength];
- stream.readFully(typeData);
- int numProfiles = stream.readInt();
- profileTags = new int[numProfiles];
- profileData = new byte[numProfiles][];
- for (int i = 0; i < numProfiles; i++) {
- profileTags[i] = stream.readInt();
- profileData[i] = new byte[stream.readInt()];
- stream.readFully(profileData[i]);
- }
- }
-
- public void doWrite( ObjectOutputStream stream )
- throws IOException
- {
- // write the IOR to the ObjectOutputStream
- stream.writeInt(typeData.length);
- stream.write(typeData);
- stream.writeInt(profileTags.length);
- for (int i = 0; i < profileTags.length; i++) {
- stream.writeInt(profileTags[i]);
- stream.writeInt(profileData[i].length);
- stream.write(profileData[i]);
- }
- }
-
- /**
- * Returns a hash code value for the object which is the same for all stubs
- * that represent the same remote object.
- * @return the hash code value.
- */
- public synchronized int hashCode()
- {
- if (hashCode == 0) {
-
- // compute the hash code
- for (int i = 0; i < typeData.length; i++) {
- hashCode = hashCode * 37 + typeData[i];
- }
-
- for (int i = 0; i < profileTags.length; i++) {
- hashCode = hashCode * 37 + profileTags[i];
- for (int j = 0; j < profileData[i].length; j++) {
- hashCode = hashCode * 37 + profileData[i][j];
- }
- }
- }
-
- return hashCode;
- }
-
- private boolean equalArrays( int[] data1, int[] data2 )
- {
- if (data1.length != data2.length)
- return false ;
-
- for (int ctr=0; ctr<data1.length; ctr++) {
- if (data1[ctr] != data2[ctr])
- return false ;
- }
-
- return true ;
- }
-
- private boolean equalArrays( byte[] data1, byte[] data2 )
- {
- if (data1.length != data2.length)
- return false ;
-
- for (int ctr=0; ctr<data1.length; ctr++) {
- if (data1[ctr] != data2[ctr])
- return false ;
- }
-
- return true ;
- }
-
- private boolean equalArrays( byte[][] data1, byte[][] data2 )
- {
- if (data1.length != data2.length)
- return false ;
-
- for (int ctr=0; ctr<data1.length; ctr++) {
- if (!equalArrays( data1[ctr], data2[ctr] ))
- return false ;
- }
-
- return true ;
- }
-
- public boolean equals(java.lang.Object obj)
- {
- if (this == obj) {
- return true;
- }
-
- if (!(obj instanceof StubIORImpl)) {
- return false;
- }
-
- StubIORImpl other = (StubIORImpl) obj;
- if (other.hashCode() != this.hashCode()) {
- return false;
- }
-
- return equalArrays( typeData, other.typeData ) &&
- equalArrays( profileTags, other.profileTags ) &&
- equalArrays( profileData, other.profileData ) ;
- }
-
- private void appendByteArray( StringBuffer result, byte[] data )
- {
- for ( int ctr=0; ctr<data.length; ctr++ ) {
- result.append( Integer.toHexString( data[ctr] ) ) ;
- }
- }
-
- /**
- * Returns a string representation of this stub. Returns the same string
- * for all stubs that represent the same remote object.
- * "SimpleIORImpl[<typeName>,[<profileID>]data, ...]"
- * @return a string representation of this stub.
- */
- public String toString()
- {
- StringBuffer result = new StringBuffer() ;
- result.append( "SimpleIORImpl[" ) ;
- String repositoryId = new String( typeData ) ;
- result.append( repositoryId ) ;
- for (int ctr=0; ctr<profileTags.length; ctr++) {
- result.append( ",(" ) ;
- result.append( profileTags[ctr] ) ;
- result.append( ")" ) ;
- appendByteArray( result, profileData[ctr] ) ;
- }
-
- result.append( "]" ) ;
- return result.toString() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java
deleted file mode 100644
index db334e7..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.sun.corba.se.spi.ior.Identifiable ;
-import com.sun.corba.se.spi.ior.IdentifiableFactory ;
-import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
-import com.sun.corba.se.spi.ior.TaggedComponent ;
-import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder ;
-
-import com.sun.corba.se.impl.ior.GenericTaggedComponent ;
-import com.sun.corba.se.impl.ior.IdentifiableFactoryFinderBase ;
-
-import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-/**
- * @author Ken Cavanaugh
- */
-public class TaggedComponentFactoryFinderImpl extends
- IdentifiableFactoryFinderBase implements TaggedComponentFactoryFinder
-{
- public TaggedComponentFactoryFinderImpl( ORB orb )
- {
- super( orb ) ;
- }
-
- public Identifiable handleMissingFactory( int id, InputStream is ) {
- return new GenericTaggedComponent( id, is ) ;
- }
-
- public TaggedComponent create( org.omg.CORBA.ORB orb,
- org.omg.IOP.TaggedComponent comp )
- {
- EncapsOutputStream os =
- sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
- org.omg.IOP.TaggedComponentHelper.write( os, comp ) ;
- InputStream is = (InputStream)(os.create_input_stream() ) ;
- // Skip the component ID: we just wrote it out above
- is.read_ulong() ;
-
- return (TaggedComponent)create( comp.tag, is ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/TaggedProfileFactoryFinderImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/TaggedProfileFactoryFinderImpl.java
deleted file mode 100644
index e234f5a..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/TaggedProfileFactoryFinderImpl.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import com.sun.corba.se.spi.ior.Identifiable ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.impl.ior.IdentifiableFactoryFinderBase ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-/**
- * @author
- */
-public class TaggedProfileFactoryFinderImpl extends
- IdentifiableFactoryFinderBase
-{
- public TaggedProfileFactoryFinderImpl( ORB orb )
- {
- super( orb ) ;
- }
-
- public Identifiable handleMissingFactory( int id, InputStream is)
- {
- return new GenericTaggedProfile( id, is ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/TaggedProfileTemplateFactoryFinderImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/TaggedProfileTemplateFactoryFinderImpl.java
deleted file mode 100644
index 8dba5d3..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/TaggedProfileTemplateFactoryFinderImpl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import com.sun.corba.se.spi.ior.Identifiable ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.impl.ior.IdentifiableFactoryFinderBase ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-import org.omg.CORBA.INTERNAL ;
-
-/**
- * @author
- */
-public class TaggedProfileTemplateFactoryFinderImpl extends
- IdentifiableFactoryFinderBase
-{
- public TaggedProfileTemplateFactoryFinderImpl( ORB orb )
- {
- super( orb ) ;
- }
-
- public Identifiable handleMissingFactory( int id, InputStream is)
- {
- throw wrapper.taggedProfileTemplateFactoryNotFound( new Integer(id) ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/TestAssertions b/src/share/classes/com/sun/corba/se/impl/ior/TestAssertions
deleted file mode 100644
index b74041a..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/TestAssertions
+++ /dev/null
@@ -1,136 +0,0 @@
-Remaining work
-- Look at the relation between TaggedComponents and Codecs.
-- Add TaggedComponentFactories to ORB init
-- look at PI and codecs
-- Implement PoliciesComponent
-
-=====================
-Testing:
-Tagged Components: (DONE)
- General:
- - Constructed data can be retrieved
- - read and written correctly as part of IOR
- (test this first in IdEncapsulationContainerBase test)
- AlternateIIOPAddressComponent:
- - can correctly write out TCP port >32K
- CodeSetsComponent
- - none additional
- JavaCodebaseComponent
- - none additional
- ORBTypeComponent
- - none additional
- PoliciesComponent
- - none additional
-
-IdentifiableContainerBase (DONE)
- - Test iteratorById on Identifiables (DONE)
- - Iterator on id not present is empty (hasNext() == false)
- - Iterator on id present returns all ids in sequence
-IdEncapsulationContainerBase (DONE)
- - Test read sequence of TaggedComponents
- - Test writing sequence of TaggedComponents
-GenericIdEncapsulation (DONE)
- - Test by using for tagged profile and tagged component
- - write out and read back test
-IIOPAddress (DONE)
- - Constructed object returns correct values
- - equals:
- - false for non-IIOPAddress value
- - true iff ports and hosts match
-IIOPProfile (DONE)
- - construct from id, template; check that correct values are returned
- - write out and read back
- - no components for 1.0
- - components for >1.0
- - getObjectKey returns value constructed correctly
- - isEquivalent iff ids equal and templates equivalent
-IIOPProfileTemplate (DONE)
- - Constructed object contains correct values
- - isEquivalent iff address and template are equal
- - cannot have new components added after makeImmutable call
-IOR (DONE)
- - Constructed object contains correct values
- - IOR() has null typeid and no profiles (DONE)
- - IOR( String ) has given typeid and no profiles (DONE)
- - IOR( String, IIOPProfileTemplate, ObjectId ) has given typeid and
- one IIOPProfile corresponding to template and objectid
- - IOR( String, IORTemplate, ObjectId ) has profiles corresponding to
- IORTemplate and ObjectIds. (DONE)
- - IORTemplate( String, IORTemplate, ObjectIds ) has profiles
- corresponding to IORTemplate and ObjectIds (DONE)
- - IOR( IORTemplate, ObjectIds ) usual test (DONE)
- - write out/read back test (DONE)
- - Construct IOR with 2 IIOPProfiles, each with several components,
- and 2 GenericIdEncapsulation profiles, write out, read back,
- check for equals directly and by calling equals
- - cannot have new profiles added after makeImmutable call (DONE)
- - contained IIOPProfiles cannot have added components after
- makeImmutable call. (DONE)
-IORTemplate (DONE)
- - Constructed object contains correct value
-JIDLObjectKeyTemplate (DONE)
- - test that IDs match expected values when created from
- byte[] in ObjectKeyFactory.create
- - Constructed object contains correct values
- - write out and read back test
- - getId correctly extract id from key
-FreezableList (DONE)
- - ASSUME that it acts like a linked list: don't test entire interface
- - all modification operations throw UnsupportedOperationException
- after makeImmutable call
- - all iterators (whether created before or after makeImmutable call)
- throw U.O.E. after makeImmutable
-ObjectId (DONE)
- - constructed object returns same id
- - test cases in equals
-ObjectKey (DONE)
- - constructed object returns same id, template
- - write/read test
- - getBytes returns correct value (test by using factory and
- comparing)
-ObjectKeyFactory (DONE)
- - test create with hand created keys
- - key length < 4
- - key length >= 4
- - magic is JAVAMAGIC
- - scid is POA scid
- - scid is JIDL scid
- - other scid
- - magic is not JAVAMAGIC
- - test with error cases on length
-POAObjectKeyTemplate (DONE)
- - test that IDs match expected values when created from
- byte[] in ObjectKeyFactory.create
- - test that IDs match when created with explicit values
- - write out and read back test
- - getId correctly extracts id from key
-TaggedComponentFactories (DONE)
- - only tested inditectly by reading and writing IIOPProfileTemplate
- that contains all components
-TaggedComponentFactoryFinder (DONE)
- - registered factory can be looked up
- - lookup of unregistered factory returns null
- - reads tagged component from stream as correct type if registered
- - reads tagged component from stream as generic if not registered
-TaggedProfileFactoryFinder (DONE)
- - reads IIOP profile as IIOPProfile
- - reads others as Generic
-WireObjectTemplate (DONE)
- - getId returns entire key as id
- - serverId is -1
- - write out and read back test
-
-Interfaces (no tests):
- IdEncapsulation
- IdEncapsulationFactory
- IdEncapsulationFactoryFinder
- Identifiable
- ObjectKeyTemplateo
- ObjectKeyTemplate
- TaggedComponent
- TaggedProfile
- TaggedProfileTemplate
- Writeable
-
-Trivial classes:
- ObjectIds
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/WireObjectKeyTemplate.java b/src/share/classes/com/sun/corba/se/impl/ior/WireObjectKeyTemplate.java
deleted file mode 100644
index b80e00e..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/WireObjectKeyTemplate.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import org.omg.CORBA.OctetSeqHolder ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
-
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.impl.encoding.CDRInputStream ;
-
-import com.sun.corba.se.impl.logging.IORSystemException ;
-
-/**
- * @author Ken Cavanaugh
- */
-public class WireObjectKeyTemplate implements ObjectKeyTemplate
-{
- private ORB orb ;
- private IORSystemException wrapper ;
-
- public boolean equals( Object obj )
- {
- if (obj == null)
- return false ;
-
- return obj instanceof WireObjectKeyTemplate ;
- }
-
- public int hashCode()
- {
- return 53 ; // All WireObjectKeyTemplates are the same, so they should
- // have the same hashCode.
- }
-
- private byte[] getId( InputStream is )
- {
- CDRInputStream cis = (CDRInputStream)is ;
- int len = cis.getBufferLength() ;
- byte[] result = new byte[ len ] ;
- cis.read_octet_array( result, 0, len ) ;
- return result ;
- }
-
- public WireObjectKeyTemplate( ORB orb )
- {
- initORB( orb ) ;
- }
-
- public WireObjectKeyTemplate( InputStream is, OctetSeqHolder osh )
- {
- osh.value = getId( is ) ;
- initORB( (ORB)(is.orb())) ;
- }
-
- private void initORB( ORB orb )
- {
- this.orb = orb ;
- wrapper = IORSystemException.get( orb,
- CORBALogDomains.OA_IOR ) ;
- }
-
- public void write( ObjectId id, OutputStream os )
- {
- byte[] key = id.getId() ;
- os.write_octet_array( key, 0, key.length ) ;
- }
-
- public void write( OutputStream os )
- {
- // Does nothing
- }
-
- public int getSubcontractId()
- {
- return ORBConstants.DEFAULT_SCID ;
- }
-
- /** While it might make sense to throw an exception here, this causes
- * problems since we need to check whether unusual object references
- * are local or not. It seems that the easiest way to handle this is
- * to return an invalid server id.
- */
- public int getServerId()
- {
- return -1 ;
- }
-
- public String getORBId()
- {
- throw wrapper.orbIdNotAvailable() ;
- }
-
- public ObjectAdapterId getObjectAdapterId()
- {
- throw wrapper.objectAdapterIdNotAvailable() ;
- }
-
- /** Adapter ID is not available, since our
- * ORB did not implement the object carrying this key.
- */
- public byte[] getAdapterId()
- {
- throw wrapper.adapterIdNotAvailable() ;
- }
-
- public ORBVersion getORBVersion()
- {
- return ORBVersionFactory.getFOREIGN() ;
- }
-
- public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb, ObjectId id )
- {
- byte[] bid = id.getId() ;
- String str = new String( bid ) ;
- return orb.getRequestDispatcherRegistry().getServerRequestDispatcher( str ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java
deleted file mode 100644
index 231dac6..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, 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.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.TaggedComponentBase ;
-
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-import com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent ;
-
-import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ;
-
-/**
- * @author Ken Cavanaugh
- */
-public class AlternateIIOPAddressComponentImpl extends TaggedComponentBase
- implements AlternateIIOPAddressComponent
-{
- private IIOPAddress addr ;
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof AlternateIIOPAddressComponentImpl))
- return false ;
-
- AlternateIIOPAddressComponentImpl other =
- (AlternateIIOPAddressComponentImpl)obj ;
-
- return addr.equals( other.addr ) ;
- }
-
- public int hashCode()
- {
- return addr.hashCode() ;
- }
-
- public String toString()
- {
- return "AlternateIIOPAddressComponentImpl[addr=" + addr + "]" ;
- }
-
- public AlternateIIOPAddressComponentImpl( IIOPAddress addr )
- {
- this.addr = addr ;
- }
-
- public IIOPAddress getAddress()
- {
- return addr ;
- }
-
- public void writeContents(OutputStream os)
- {
- addr.write( os ) ;
- }
-
- public int getId()
- {
- return TAG_ALTERNATE_IIOP_ADDRESS.value ; // 3 in CORBA 2.3.1 13.6.3
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/CodeSetsComponentImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/CodeSetsComponentImpl.java
deleted file mode 100644
index 12b8401..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/CodeSetsComponentImpl.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, 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.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.TaggedComponentBase ;
-
-import com.sun.corba.se.spi.ior.iiop.CodeSetsComponent ;
-
-import org.omg.IOP.TAG_CODE_SETS ;
-
-import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
-import com.sun.corba.se.impl.encoding.MarshalOutputStream ;
-import com.sun.corba.se.impl.encoding.MarshalInputStream ;
-
-/**
- * @author
- */
-public class CodeSetsComponentImpl extends TaggedComponentBase
- implements CodeSetsComponent
-{
- CodeSetComponentInfo csci ;
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof CodeSetsComponentImpl))
- return false ;
-
- CodeSetsComponentImpl other = (CodeSetsComponentImpl)obj ;
-
- return csci.equals( other.csci ) ;
- }
-
- public int hashCode()
- {
- return csci.hashCode() ;
- }
-
- public String toString()
- {
- return "CodeSetsComponentImpl[csci=" + csci + "]" ;
- }
-
- public CodeSetsComponentImpl()
- {
- // Uses our default code sets (see CodeSetComponentInfo)
- csci = new CodeSetComponentInfo() ;
- }
-
- public CodeSetsComponentImpl( InputStream is )
- {
- csci = new CodeSetComponentInfo() ;
- csci.read( (MarshalInputStream)is ) ;
- }
-
- public CodeSetsComponentImpl(com.sun.corba.se.spi.orb.ORB orb)
- {
- if (orb == null)
- csci = new CodeSetComponentInfo();
- else
- csci = orb.getORBData().getCodeSetComponentInfo();
- }
-
- public CodeSetComponentInfo getCodeSetComponentInfo()
- {
- return csci ;
- }
-
- public void writeContents(OutputStream os)
- {
- csci.write( (MarshalOutputStream)os ) ;
- }
-
- public int getId()
- {
- return TAG_CODE_SETS.value ; // 1 in CORBA 2.3.1 13.6.3
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressBase.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressBase.java
deleted file mode 100644
index a019def..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressBase.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior.iiop ;
-
-import org.omg.CORBA.BAD_PARAM ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-
-/**
- * @author
- */
-abstract class IIOPAddressBase implements IIOPAddress
-{
- // Ports are marshalled as shorts on the wire. The IDL
- // type is unsigned short, which lacks a convenient representation
- // in Java in the 32768-65536 range. So, we treat ports as
- // ints throught this code, except that marshalling requires a
- // scaling conversion. intToShort and shortToInt are provided
- // for this purpose.
- protected short intToShort( int value )
- {
- if (value > 32767)
- return (short)(value - 65536) ;
- return (short)value ;
- }
-
- protected int shortToInt( short value )
- {
- if (value < 0)
- return value + 65536 ;
- return value ;
- }
-
- public void write( OutputStream os )
- {
- os.write_string( getHost() ) ;
- int port = getPort() ;
- os.write_short( intToShort( port ) ) ;
- }
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof IIOPAddress))
- return false ;
-
- IIOPAddress other = (IIOPAddress)obj ;
-
- return getHost().equals(other.getHost()) &&
- (getPort() == other.getPort()) ;
- }
-
- public int hashCode()
- {
- return getHost().hashCode() ^ getPort() ;
- }
-
- public String toString()
- {
- return "IIOPAddress[" + getHost() + "," + getPort() + "]" ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressClosureImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressClosureImpl.java
deleted file mode 100644
index f8e9dfd..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressClosureImpl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.CORBA.BAD_PARAM ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.orbutil.closure.Closure ;
-
-/**
- * @author
- */
-public final class IIOPAddressClosureImpl extends IIOPAddressBase
-{
- private Closure host;
- private Closure port;
-
- public IIOPAddressClosureImpl( Closure host, Closure port )
- {
- this.host = host ;
- this.port = port ;
- }
-
- public String getHost()
- {
- return (String)(host.evaluate()) ;
- }
-
- public int getPort()
- {
- Integer value = (Integer)(port.evaluate()) ;
- return value.intValue() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressImpl.java
deleted file mode 100644
index 79c31cf..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressImpl.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.CORBA.BAD_PARAM ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.logging.IORSystemException ;
-
-/**
- * @author
- */
-public final class IIOPAddressImpl extends IIOPAddressBase
-{
- private ORB orb ;
- private IORSystemException wrapper ;
- private String host;
- private int port;
-
- public IIOPAddressImpl( ORB orb, String host, int port )
- {
- this.orb = orb ;
- wrapper = IORSystemException.get( orb,
- CORBALogDomains.OA_IOR ) ;
-
- if ((port < 0) || (port > 65535))
- throw wrapper.badIiopAddressPort( new Integer(port)) ;
-
- this.host = host ;
- this.port = port ;
- }
-
- public IIOPAddressImpl( InputStream is )
- {
- host = is.read_string() ;
- short thePort = is.read_short() ;
- port = shortToInt( thePort ) ;
- }
-
- public String getHost()
- {
- return host ;
- }
-
- public int getPort()
- {
- return port ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java
deleted file mode 100644
index 060dd3f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import java.util.List ;
-import java.util.Iterator ;
-
-import org.omg.CORBA.SystemException ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ;
-import org.omg.IOP.TAG_INTERNET_IOP;
-import org.omg.IOP.TAG_JAVA_CODEBASE;
-
-import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-import com.sun.corba.se.spi.ior.TaggedProfile ;
-import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
-import com.sun.corba.se.spi.ior.ObjectKey ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.TaggedComponent ;
-import com.sun.corba.se.spi.ior.IdentifiableBase ;
-import com.sun.corba.se.spi.ior.IORFactories ;
-import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
-
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
-import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
-import com.sun.corba.se.spi.ior.iiop.JavaCodebaseComponent ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.ior.EncapsulationUtility ;
-
-import com.sun.corba.se.impl.encoding.EncapsInputStream ;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
-
-import sun.corba.EncapsInputStreamFactory;
-
-import com.sun.corba.se.impl.util.JDKBridge;
-
-import com.sun.corba.se.impl.logging.IORSystemException;
-
-/**
- * @author
- */
-public class IIOPProfileImpl extends IdentifiableBase implements IIOPProfile
-{
- private ORB orb ;
- private IORSystemException wrapper ;
- private ObjectId oid;
- private IIOPProfileTemplate proftemp;
- private ObjectKeyTemplate oktemp ;
-
- // Cached lookups
- protected String codebase = null ;
- protected boolean cachedCodebase = false;
-
- private boolean checkedIsLocal = false ;
- private boolean cachedIsLocal = false ;
-
- // initialize-on-demand holder
- private static class LocalCodeBaseSingletonHolder {
- public static JavaCodebaseComponent comp ;
-
- static {
- String localCodebase = JDKBridge.getLocalCodebase() ;
- if (localCodebase == null)
- comp = null ;
- else
- comp = IIOPFactories.makeJavaCodebaseComponent(
- localCodebase ) ;
- }
- }
-
- private GIOPVersion giopVersion = null;
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof IIOPProfileImpl))
- return false ;
-
- IIOPProfileImpl other = (IIOPProfileImpl)obj ;
-
- return oid.equals( other.oid ) && proftemp.equals( other.proftemp ) &&
- oktemp.equals( other.oktemp ) ;
- }
-
- public int hashCode()
- {
- return oid.hashCode() ^ proftemp.hashCode() ^ oktemp.hashCode() ;
- }
-
- public ObjectId getObjectId()
- {
- return oid ;
- }
-
- public TaggedProfileTemplate getTaggedProfileTemplate()
- {
- return proftemp ;
- }
-
- public ObjectKeyTemplate getObjectKeyTemplate()
- {
- return oktemp ;
- }
-
- private IIOPProfileImpl( ORB orb )
- {
- this.orb = orb ;
- wrapper = IORSystemException.get( orb,
- CORBALogDomains.OA_IOR ) ;
- }
-
- public IIOPProfileImpl( ORB orb, ObjectKeyTemplate oktemp, ObjectId oid,
- IIOPProfileTemplate proftemp )
- {
- this( orb ) ;
- this.oktemp = oktemp ;
- this.oid = oid ;
- this.proftemp = proftemp ;
- }
-
- public IIOPProfileImpl( InputStream is )
- {
- this( (ORB)(is.orb()) ) ;
- init( is ) ;
- }
-
- public IIOPProfileImpl( ORB orb, org.omg.IOP.TaggedProfile profile)
- {
- this( orb ) ;
-
- if (profile == null || profile.tag != TAG_INTERNET_IOP.value ||
- profile.profile_data == null) {
- throw wrapper.invalidTaggedProfile() ;
- }
-
- EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream((ORB)orb, profile.profile_data,
- profile.profile_data.length);
- istr.consumeEndian();
- init( istr ) ;
- }
-
- private void init( InputStream istr )
- {
- // First, read all of the IIOP IOR data
- GIOPVersion version = new GIOPVersion() ;
- version.read( istr ) ;
- IIOPAddress primary = new IIOPAddressImpl( istr ) ;
- byte[] key = EncapsulationUtility.readOctets( istr ) ;
-
- ObjectKey okey = orb.getObjectKeyFactory().create( key ) ;
- oktemp = okey.getTemplate() ;
- oid = okey.getId() ;
-
- proftemp = IIOPFactories.makeIIOPProfileTemplate( orb,
- version, primary ) ;
-
- // Handle any tagged components (if applicable)
- if (version.getMinor() > 0)
- EncapsulationUtility.readIdentifiableSequence( proftemp,
- orb.getTaggedComponentFactoryFinder(), istr ) ;
-
- // If there is no codebase in this IOR and there IS a
- // java.rmi.server.codebase property set, we need to
- // update the IOR with the local codebase. Note that
- // there is only one instance of the local codebase, but it
- // can be safely shared in multiple IORs since it is immutable.
- if (uncachedGetCodeBase() == null) {
- JavaCodebaseComponent jcc = LocalCodeBaseSingletonHolder.comp ;
-
- if (jcc != null) {
- if (version.getMinor() > 0)
- proftemp.add( jcc ) ;
-
- codebase = jcc.getURLs() ;
- }
-
- // Whether codebase is null or not, we have it,
- // and so getCodebase ned never call uncachedGetCodebase.
- cachedCodebase = true;
- }
- }
-
- public void writeContents(OutputStream os)
- {
- proftemp.write( oktemp, oid, os ) ;
- }
-
- public int getId()
- {
- return proftemp.getId() ;
- }
-
- public boolean isEquivalent( TaggedProfile prof )
- {
- if (!(prof instanceof IIOPProfile))
- return false ;
-
- IIOPProfile other = (IIOPProfile)prof ;
-
- return oid.equals( other.getObjectId() ) &&
- proftemp.isEquivalent( other.getTaggedProfileTemplate() ) &&
- oktemp.equals( other.getObjectKeyTemplate() ) ;
- }
-
- public ObjectKey getObjectKey()
- {
- ObjectKey result = IORFactories.makeObjectKey( oktemp, oid ) ;
- return result ;
- }
-
- public org.omg.IOP.TaggedProfile getIOPProfile()
- {
- EncapsOutputStream os =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(orb);
- os.write_long( getId() ) ;
- write( os ) ;
- InputStream is = (InputStream)(os.create_input_stream()) ;
- return org.omg.IOP.TaggedProfileHelper.read( is ) ;
- }
-
- private String uncachedGetCodeBase() {
- Iterator iter = proftemp.iteratorById( TAG_JAVA_CODEBASE.value ) ;
-
- if (iter.hasNext()) {
- JavaCodebaseComponent jcbc = (JavaCodebaseComponent)(iter.next()) ;
- return jcbc.getURLs() ;
- }
-
- return null ;
- }
-
- public synchronized String getCodebase() {
- if (!cachedCodebase) {
- cachedCodebase = true ;
- codebase = uncachedGetCodeBase() ;
- }
-
- return codebase ;
- }
-
- /**
- * @return the ORBVersion associated with the object key in the IOR.
- */
- public ORBVersion getORBVersion() {
- return oktemp.getORBVersion();
- }
-
- public synchronized boolean isLocal()
- {
- if (!checkedIsLocal) {
- checkedIsLocal = true ;
- String host = proftemp.getPrimaryAddress().getHost() ;
-
- cachedIsLocal = orb.isLocalHost(host) &&
- orb.isLocalServerId(oktemp.getSubcontractId(),
- oktemp.getServerId()) &&
- orb.getLegacyServerSocketManager()
- .legacyIsLocalServerPort(
- proftemp.getPrimaryAddress().getPort());
- }
-
- return cachedIsLocal ;
- }
-
- /** Return the servant for this IOR, if it is local AND if the OA that
- * implements this objref supports direct access to servants outside of an
- * invocation.
- * XXX revisit: do we want this at all? If we do, it might move to the
- * ObjectKeyTemplate instead.
- */
- public java.lang.Object getServant()
- {
- if (!isLocal())
- return null ;
-
- RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ;
- ObjectAdapterFactory oaf = scr.getObjectAdapterFactory(
- oktemp.getSubcontractId() ) ;
-
- ObjectAdapterId oaid = oktemp.getObjectAdapterId() ;
- ObjectAdapter oa = null ;
-
- try {
- oa = oaf.find( oaid ) ;
- } catch (SystemException exc) {
- // Could not find the OA, so just return null.
- // This usually happens when POAs are being deleted,
- // and the POA always return null for getLocalServant anyway.
- wrapper.getLocalServantFailure( exc, oaid.toString() ) ;
- return null ;
- }
-
- byte[] boid = oid.getId() ;
- java.lang.Object servant = oa.getLocalServant( boid ) ;
- return servant ;
- }
-
- /**
- * Return GIOPVersion for this IOR.
- * Requests created against this IOR will be of the
- * return Version.
- */
- public synchronized GIOPVersion getGIOPVersion()
- {
- return proftemp.getGIOPVersion() ;
- }
-
- public void makeImmutable()
- {
- proftemp.makeImmutable() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java
deleted file mode 100644
index 32a7d66..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import java.util.Iterator ;
-
-import org.omg.IOP.TAG_INTERNET_IOP ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.TaggedComponent ;
-import com.sun.corba.se.spi.ior.TaggedProfile ;
-import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
-import com.sun.corba.se.spi.ior.TaggedProfileTemplateBase ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.IdentifiableContainerBase ;
-import com.sun.corba.se.spi.ior.IdentifiableBase ;
-
-import com.sun.corba.se.impl.ior.EncapsulationUtility ;
-
-import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
-
-import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
-
-import com.sun.corba.se.impl.encoding.CDROutputStream ;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
-import com.sun.corba.se.spi.orb.ORB ;
-
-/**
- * @author
- * If getMinorVersion==0, this does not contain any tagged components
- */
-public class IIOPProfileTemplateImpl extends TaggedProfileTemplateBase
- implements IIOPProfileTemplate
-{
- private ORB orb ;
- private GIOPVersion giopVersion ;
- private IIOPAddress primary ;
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof IIOPProfileTemplateImpl))
- return false ;
-
- IIOPProfileTemplateImpl other = (IIOPProfileTemplateImpl)obj ;
-
- return super.equals( obj ) && giopVersion.equals( other.giopVersion ) &&
- primary.equals( other.primary ) ;
- }
-
- public int hashCode()
- {
- return super.hashCode() ^ giopVersion.hashCode() ^ primary.hashCode() ;
- }
-
- public TaggedProfile create( ObjectKeyTemplate oktemp, ObjectId id )
- {
- return IIOPFactories.makeIIOPProfile( orb, oktemp, id, this ) ;
- }
-
- public GIOPVersion getGIOPVersion()
- {
- return giopVersion ;
- }
-
- public IIOPAddress getPrimaryAddress()
- {
- return primary ;
- }
-
- public IIOPProfileTemplateImpl( ORB orb, GIOPVersion version, IIOPAddress primary )
- {
- this.orb = orb ;
- this.giopVersion = version ;
- this.primary = primary ;
- if (giopVersion.getMinor() == 0)
- // Adding tagged components is not allowed for IIOP 1.0,
- // so this template is complete and should be made immutable.
- makeImmutable() ;
- }
-
- public IIOPProfileTemplateImpl( InputStream istr )
- {
- byte major = istr.read_octet() ;
- byte minor = istr.read_octet() ;
- giopVersion = GIOPVersion.getInstance( major, minor ) ;
- primary = new IIOPAddressImpl( istr ) ;
- orb = (ORB)(istr.orb()) ;
- // Handle any tagged components (if applicable)
- if (minor > 0)
- EncapsulationUtility.readIdentifiableSequence(
- this, orb.getTaggedComponentFactoryFinder(), istr ) ;
-
- makeImmutable() ;
- }
-
- public void write( ObjectKeyTemplate okeyTemplate, ObjectId id, OutputStream os)
- {
- giopVersion.write( os ) ;
- primary.write( os ) ;
-
- // Note that this is NOT an encapsulation: do not marshal
- // the endianness flag. However, the length is required.
- // Note that this cannot be accomplished with a codec!
-
- // Use the byte order of the given stream
- OutputStream encapsulatedOS =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(
- (ORB)os.orb(), ((CDROutputStream)os).isLittleEndian() ) ;
-
- okeyTemplate.write( id, encapsulatedOS ) ;
- EncapsulationUtility.writeOutputStream( encapsulatedOS, os ) ;
-
- if (giopVersion.getMinor() > 0)
- EncapsulationUtility.writeIdentifiableSequence( this, os ) ;
- }
-
- /** Write out this IIOPProfileTemplateImpl only.
- */
- public void writeContents( OutputStream os)
- {
- giopVersion.write( os ) ;
- primary.write( os ) ;
-
- if (giopVersion.getMinor() > 0)
- EncapsulationUtility.writeIdentifiableSequence( this, os ) ;
- }
-
- public int getId()
- {
- return TAG_INTERNET_IOP.value ;
- }
-
- public boolean isEquivalent( TaggedProfileTemplate temp )
- {
- if (!(temp instanceof IIOPProfileTemplateImpl))
- return false ;
-
- IIOPProfileTemplateImpl tempimp = (IIOPProfileTemplateImpl)temp ;
-
- return primary.equals( tempimp.primary ) ;
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/JavaCodebaseComponentImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/JavaCodebaseComponentImpl.java
deleted file mode 100644
index 9fefb01..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/JavaCodebaseComponentImpl.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, 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.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.IOP.TAG_JAVA_CODEBASE ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.TaggedComponentBase ;
-
-import com.sun.corba.se.spi.ior.iiop.JavaCodebaseComponent ;
-
-/**
- * @author
- */
-public class JavaCodebaseComponentImpl extends TaggedComponentBase
- implements JavaCodebaseComponent
-{
- private String URLs ;
-
- public boolean equals( Object obj )
- {
- if (obj == null)
- return false ;
-
- if (!(obj instanceof JavaCodebaseComponentImpl))
- return false ;
-
- JavaCodebaseComponentImpl other = (JavaCodebaseComponentImpl)obj ;
-
- return URLs.equals( other.getURLs() ) ;
- }
-
- public int hashCode()
- {
- return URLs.hashCode() ;
- }
-
- public String toString()
- {
- return "JavaCodebaseComponentImpl[URLs=" + URLs + "]" ;
- }
-
- public String getURLs()
- {
- return URLs ;
- }
-
- public JavaCodebaseComponentImpl( String URLs )
- {
- this.URLs = URLs ;
- }
-
- public void writeContents(OutputStream os)
- {
- os.write_string( URLs ) ;
- }
-
- public int getId()
- {
- return TAG_JAVA_CODEBASE.value ; // 25 in CORBA 2.3.1 13.6.3
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/JavaSerializationComponent.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/JavaSerializationComponent.java
deleted file mode 100644
index a89ea21..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/JavaSerializationComponent.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.ior.TaggedComponentBase;
-
-/**
- * Tagged component that contains a value that indicates the Java
- * serialization version supported by the ORB.
- *
- * ORB Java serialization uses IIOP as the transport protocol, but uses
- * Java serialization mechanism and its accompanying encodings, instead
- * of IIOP CDR serialization mechanism. Java serialization is generally
- * observed to be faster than CDR.
- */
-public class JavaSerializationComponent extends TaggedComponentBase {
-
- private byte version;
-
- private static JavaSerializationComponent singleton;
-
- public static JavaSerializationComponent singleton() {
- if (singleton == null) {
- synchronized (JavaSerializationComponent.class) {
- singleton =
- new JavaSerializationComponent(Message.JAVA_ENC_VERSION);
- }
- }
- return singleton;
- }
-
- public JavaSerializationComponent(byte version) {
- this.version = version;
- }
-
- public byte javaSerializationVersion() {
- return this.version;
- }
-
- public void writeContents(OutputStream os) {
- os.write_octet(version);
- }
-
- public int getId() {
- return ORBConstants.TAG_JAVA_SERIALIZATION_ID;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof JavaSerializationComponent)) {
- return false;
- }
- JavaSerializationComponent other = (JavaSerializationComponent) obj;
- return this.version == other.version;
- }
-
- public int hashCode() {
- return this.version;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java
deleted file mode 100644
index dcf5b2e..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, 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.
- */
-
-/**
- */
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.IOP.TAG_RMI_CUSTOM_MAX_STREAM_FORMAT;
-
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandler;
-import javax.rmi.CORBA.ValueHandlerMultiFormat;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-
-import com.sun.corba.se.spi.ior.TaggedComponentBase;
-
-import com.sun.corba.se.spi.ior.iiop.MaxStreamFormatVersionComponent;
-
-// Java to IDL ptc 02-01-12 1.4.11
-// TAG_RMI_CUSTOM_MAX_STREAM_FORMAT
-public class MaxStreamFormatVersionComponentImpl extends TaggedComponentBase
- implements MaxStreamFormatVersionComponent
-{
- private byte version;
-
- public static final MaxStreamFormatVersionComponentImpl singleton
- = new MaxStreamFormatVersionComponentImpl();
-
- public boolean equals(Object obj)
- {
- if (!(obj instanceof MaxStreamFormatVersionComponentImpl))
- return false ;
-
- MaxStreamFormatVersionComponentImpl other =
- (MaxStreamFormatVersionComponentImpl)obj ;
-
- return version == other.version ;
- }
-
- public int hashCode()
- {
- return version ;
- }
-
- public String toString()
- {
- return "MaxStreamFormatVersionComponentImpl[version=" + version + "]" ;
- }
-
- public MaxStreamFormatVersionComponentImpl()
- {
- version = ORBUtility.getMaxStreamFormatVersion();
- }
-
- public MaxStreamFormatVersionComponentImpl(byte streamFormatVersion) {
- version = streamFormatVersion;
- }
-
- public byte getMaxStreamFormatVersion()
- {
- return version;
- }
-
- public void writeContents(OutputStream os)
- {
- os.write_octet(version);
- }
-
- public int getId()
- {
- return TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/ORBTypeComponentImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/ORBTypeComponentImpl.java
deleted file mode 100644
index 68a4f9b..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/ORBTypeComponentImpl.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, 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.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.IOP.TAG_ORB_TYPE ;
-
-import com.sun.corba.se.spi.ior.TaggedComponentBase ;
-
-import com.sun.corba.se.spi.ior.iiop.ORBTypeComponent ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-/**
- * @author Ken Cavanaugh
- */
-public class ORBTypeComponentImpl extends TaggedComponentBase
- implements ORBTypeComponent
-{
- private int ORBType;
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof ORBTypeComponentImpl))
- return false ;
-
- ORBTypeComponentImpl other = (ORBTypeComponentImpl)obj ;
-
- return ORBType == other.ORBType ;
- }
-
- public int hashCode()
- {
- return ORBType ;
- }
-
- public String toString()
- {
- return "ORBTypeComponentImpl[ORBType=" + ORBType + "]" ;
- }
-
- public ORBTypeComponentImpl(int ORBType)
- {
- this.ORBType = ORBType ;
- }
-
- public int getId()
- {
- return TAG_ORB_TYPE.value ; // 0 in CORBA 2.3.1 13.6.3
- }
-
- public int getORBType()
- {
- return ORBType ;
- }
-
- public void writeContents(OutputStream os)
- {
- os.write_ulong( ORBType ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/iiop/RequestPartitioningComponentImpl.java b/src/share/classes/com/sun/corba/se/impl/ior/iiop/RequestPartitioningComponentImpl.java
deleted file mode 100644
index 84b3703..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/RequestPartitioningComponentImpl.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-/**
- */
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.ior.TaggedComponentBase;
-import com.sun.corba.se.spi.ior.iiop.RequestPartitioningComponent;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-
-public class RequestPartitioningComponentImpl extends TaggedComponentBase
- implements RequestPartitioningComponent
-{
- private static ORBUtilSystemException wrapper =
- ORBUtilSystemException.get( CORBALogDomains.OA_IOR ) ;
-
- private int partitionToUse;
-
- public boolean equals(Object obj)
- {
- if (!(obj instanceof RequestPartitioningComponentImpl))
- return false ;
-
- RequestPartitioningComponentImpl other =
- (RequestPartitioningComponentImpl)obj ;
-
- return partitionToUse == other.partitionToUse ;
- }
-
- public int hashCode()
- {
- return partitionToUse;
- }
-
- public String toString()
- {
- return "RequestPartitioningComponentImpl[partitionToUse=" + partitionToUse + "]" ;
- }
-
- public RequestPartitioningComponentImpl()
- {
- partitionToUse = 0;
- }
-
- public RequestPartitioningComponentImpl(int thePartitionToUse) {
- if (thePartitionToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
- thePartitionToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
- throw wrapper.invalidRequestPartitioningComponentValue(
- new Integer(thePartitionToUse),
- new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
- new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
- }
- partitionToUse = thePartitionToUse;
- }
-
- public int getRequestPartitioningId()
- {
- return partitionToUse;
- }
-
- public void writeContents(OutputStream os)
- {
- os.write_ulong(partitionToUse);
- }
-
- public int getId()
- {
- return ORBConstants.TAG_REQUEST_PARTITIONING_ID;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/ior/notes b/src/share/classes/com/sun/corba/se/impl/ior/notes
deleted file mode 100644
index 7f66ce5..0000000
--- a/src/share/classes/com/sun/corba/se/impl/ior/notes
+++ /dev/null
@@ -1,317 +0,0 @@
-Notes on IOR implementation
-
-1. Writeable is an interface that can write itself to an OutputStream.
-
-2. IdEncapsulation is a particular kind of Writeable that has an Id and
- an Encapsulation (a sequence of bytes) representing some other structure
- in a CDR encapsulation.
-
-3. ContainerBase is a base class for containers of IdEncapsulations.
-
-4. An IOR is a ContainerBase.
-
-5. A TaggedComponent is not a ContainerBase.
-
-6. Some (not all) Profiles are ContainerBases.
-
-7. IIOPAddress contains (host, port)
- IIOPServerLocation contains:
- - A primary IIOPAddress
- - 0 or more secondary IIOPAddresses (these get placed in
- TAG_ALTERNATE_IIOP_ADDRESS components)
-
-8. IIOPProfileTemplate:
- - major, minor version
- - 0 or more TaggedComponents
- - ObjectKeyTemplate
-
-9. ObjectKeyTemplate:
- - contains only wire data, not internal structures
-
- write( object id, output stream ): write the object key out
- to the output stream with the given object id
-
-10. Significant problem: must of the dispatch path code is written in terms of
- IORs when it should be based on profiles. Only a single profile is used in
- a request, and that is what should be passed around. This needs fixing soon
- to accommodate the eventual implementation of CORBA FT, and also to work
- properly with the new IOR.
-
-11. Another question: since profile contains key which contains scid, what if
- we have multiple profiles with different scids?
- One answer: create a cluster subcontract that invokes the individual
- profiles for FT. This may not mesh well with the FT spec.
-
-12. Uses of IORs in the ORB:
-
-Activation/ServerManagerImpl.java
- - Construct IOR for bad ID handler location forward
-corba/ClientDelegate.java
- - marshal, getIOR, unmarshal are all questionable and make
- poor use of IOR.
- - gets forwarded IOR from response
- - IORs handled in some service contexts
- - createRequest needs to parse IOR
- - gets the (one) IIOP profile that we care about
- - gets the object key
-corba/InitialNamingClient.java
- - constructs IOR from address info, object key
- - current implementation should use AlternateIIOPAddress components
- - constructs IOR with key "INIT" for old bootstrap
-corba/ORB.java
- - stringify and destringify IOR
-corba/ServerDelegate.java
- - access IOR from sending context service context
- - destroyObjref directly access transient key from a known offset.
- - creation sets up key inline with known offsets
-core/IOR.java
- - IOR sometimes stores a servant
- - IOR contains the following
- - Object servant
- - Endpoint ep
- - String codebase
- - boolean cachedCodebase
- - TaggedComponent localCodeBaseTC
- - InternetIOPTag
- - The two constructors that take full args also
- construct tagged components
- - will need alternate address components for INS
-core/SendingContextServiceContext.java
- - reads IOR from input stream
-iiop/CDRInputStream.java
- - needs type id, code base from IOR
-iiop/IIOPOutputStream.java
- - needs to access objkey as a sequence of bytes to realing requests.
-POA/GenericPOAClientSC.java
- - needs to pull POA ID out of object key
- - needs to created a new IOR that has an updated scid
-POA/GenericPOAServerSC.java
- - creates IORs
-TransactionalPOA/TransactionalServerSC.java
- - inline access to known offset in object key to
- determine whether transactional
-
-Guide to the files:
-
-Basic Interfaces:
- Identifiable.java (Object has an Id)
- Writeable.java (Object can write to OutputStream)
- IdEncapsulation.java (Writeable, Identifiable interface)
- IdEncapsulationFactory.java (Factory interface for IdEncapsulation)
- IdEncapsulationFactoryFinder.java (Finder interface for IdEncapsulationFactoryFinder)
-
- IIOPAddress.java (class containing host and port for IIOP)
-
-Basic support for IdEncapsulations (shared for components and profiles):
- GenericIdEncapsulation.java (Has id, octet sequence: used for generic
- TaggedComponent and TaggedProfile objects)
- FreezableList.java (Delegated implementation of List that can be made
- immutable after construction)
- IdentifiableContainerBase.java (extends FreezableList: container of Identifiable:
- supports iteratorById.)
- IdEncapsulationContainerBase.java (extends IdenitifableContainerBase:
- container of IdEncapsulation: supports read/write IdEncapsulationSequence)
-
-Object Keys:
- ObjectKeyFactory.java
- ObjectKeyTemplate.java (interface for the following:)
- JIDLObjectKeyTemplate.java (object key used in *Delegate)
- POAObjectKeyTemplate.java (object key used in GenericPOA*SC)
- WireObjectKeyTemplate.java (used for non-Sun ORB IORs)
- ObjectId.java (a simple wrapper for byte[])
- ObjectKey.java (contains ObjectId and ObjectKeyTemplate)
-
-Components:
- TaggedComponentFactories.java (contains method for registering factories)
- TaggedComponentFactoryFinder.java (contains registered factories)
- TaggedComponent.java (interface of all tagged components)
- AlternateIIOPAddressComponent.java
- CodeSetsComponent.java
- JavaCodebaseComponent.java
- ORBTypeComponent.java
- PoliciesComponent.java
-
-Profiles:
- IIOPProfile.java (IIOPProfileTemplate and ObjectId)
- IIOPProfileTemplate.java (contains version, address, ObjectKeyTemplate,
- list of TaggedComponent)
- TaggedProfile.java (interface for all TaggedProfiles)
- TaggedProfileFactoryFinder.java
- TaggedProfileTemplate.java
-
-IOR:
- IOR.java
- IORTemplate.java (List of IIOPProfileTemplate
- ObjectIds.java (List of ObjectId: needed for an IOR constructor)
-
-Notes from integration code review:
-
-General:
- - Look at making IOR API public, or
- move everything into com.sun.corba.se.impl.ior
- (don't hold up putback for this)
- Making public:
- - Writeable needs getBytes() as well as write()
- methods.
- - codec can be used with an Any to convert between
- IDL data type and sequence of bytes.
- - write() needs to use getBytes, then write id, length,
- octets to output stream.
- - getBytes() method needs to get typecode from IDL
- then create Any.
- - IdEncapsulations need to have constructor that takes
- byte[] (encapsulation of value).
- Why not?
- - Unencapsulated object keys can't be made portable
- - Lots of dependencies on ORB code in ObjectKey support
- Conclusion:
- - move to internal (DONE)
- - JAVA_MAGIC should move to ObjectKeyTemplates (DONE)
- - check for intToBytes/bytesToInt related to object key
- corba/ServerDelegate (DONE)
- POA/GenericPOAServerSC (DONE)
- POA/SubcontractResponseHandler (DONE)
- TransactionalPOA/TransactionalClientSC.java (DONE)
- TransactionalPOA/TransactionalServerSC.java (DONE)
-
-./com/sun/corba/se/impl/cosnaming/BootstrapServer.java
- - remove sc_init_key_* (DONE)
-
-./com/sun/corba/se/impl/poa/POAImpl.java
- - remove line 130: comment on other endpoints, e.g. SSL (DONE)
- - add revisit comment on line 133: use multiple server port API (DONE)
-
-./com/sun/corba/se/impl/corba/ORB.java
- - object_to_string: add comment that connect only takes place in
- non-POA cases. (DONE)
-
-./com/sun/corba/se/impl/corba/ServerDelegate.java
- - chase down the object key offsets (DONE)
- (search for bytesToInt and intToBytes)
-
-./com/sun/corba/se/impl/core/SubcontractRegistry.java
- - getServerSubcontract: add b-e l-e comment and history on INIT, TINI (DONE)
- - getServerSubcontract: reference to constants (May not do this?)
- - getServerSubcontract: return null at end IS reachable, in the
- case where we have essentially a name in the key that isn't
- one of the ones we support. Throw an exception? (DONE)
- - add minor code for INTERNAL (and string) (DONE)
- - remove setId calls in callers to getClientSubcontract (DONE)
- - throw INTERNAL exception for temp.size() != 1 case (DONE)
- Think about INST corbaloc problems (multi-profile IORs)
- both return nulls should throw exceptions (DONE)
-
-./com/sun/corba/se/impl/core/IOR.java
- - Add some comments to getIORfromString about 4/2 constants (DONE)
- - fix name: should be getIORFromString (DONE)
- - IOR( InputStream ) has a problem with cachedCodeBase:
- is should not call getCodeBase: must refactor to
- an internal implementation method. (DONE)
- - isEquivalent and isLocal should assert failure
- if multiple profiles (through exception in getProfile) (DONE)
- (add comments about multi case)
-
-./com/sun/corba/se/impl/iiop/CDRInputStream_1_0.java
- - read_Object: add assert in case servant is not Tie or objref (DONE)
-
-./com/sun/corba/se/internal/TransactionalPOA/TransactionalPOAImpl.java
- - add comment about transactionalIortemplate: goes away after
- we get to OTS 1.2 transactional policy. (DONE)
- - change transactionalClone( ObjectKeyTemplate ) so that
- we get an error (INTERNAL) if NOT POAObjectKeyTemplate (DONE)
- - line 138: get string constant from
- org.omg.CosTransactions.TransactionalObject (DONE)
- - remove Delegate d decl. (DONE)
-
-We need to assign minor codes for all exceptions!
-
-We need to clean up the minor code base usage! (DONE)
-
-Add equals/toString to:
- Do not try to develop a reflective universal equals: too slow!
- Do we really want equals on lists?
- If we do, define collectionEqual on FreezableList
-
-CodeSetsComponent: toString
-FreezableList: basic toString, equals methods
-IIOPProfile: toString
-IIOPProfileTemplate: toString
-IOR: toString
-IORTemplate.java: toString, equals (inherit?)
-IdEncapsulationContainerBase.java: make abstract, but provide base toString/equals
-IdentifiableContainerBase.java: make abstract (no other changes)
- (ContainerBase classes need some explanation)
-ObjectIds.java needs toString, equals (use FreezableList?)
-ObjectKey: toString
-ObjectKeyFactory.java: singleton: don't add toString or equals
-PoliciesComponent.java: should finish this sometime (after we figure out
- exactly what to do with it)
-TaggedComponentBase.java: should be abstract
-TaggedComponentFactories.java: a singelton
-TaggedComponentFactoryFinder.java: a singleton
-TaggedProfileFactoryFinder.java: a singleton
-JIDLObjectKeyTemplate: toString
-POAObjectKeyTemplate: toString
-WireObjectKeyTemplate: toString uninteresting: no data, equals not useful
-
-use util/Utility.objectToString to implement toString methods.
-
-Other changes:
-
- IIOPAddress.toString should include class name (DONE)
-
- New tests needed:
- IIOPProfile.getIOPComponents
- IIOPProfile.getIOPProfile
- GenericTaggedProfile.getIOPComponents
- GenericTaggedProfile.getIOPProfile
- GenericTaggedComponent.getIOPComponent
- ObjectKeyTemplate.getAdapterId
-
- Plus, do a read/write test for IOP stuff:
- construct profile
- convert to IOP.TaggedProfile
- write to stream
- get input stream
- construct profile
- check for equal
-
- do some tests on IOR.toString() just to see what gets printed.
-
- Add getAdapterId to *ObjectKeyTemplate.java (DONE)
- Add some tests for this:
- - WireObjectKeyTemplate throws an exception
- - Identically constructed ObjectKeyTemplates produce identical Adapter Ids.
- - Different OKTs produce different adapter IDs.
-
-New tests for versioning support:
-
-ORBVersionFactory:
- - for create array methods (DONE)
- - returns expected values for version encodings
- - throws INTERNAL for negative version
- - test one case for create stream method (DONE)
- - getORBVersion returns correct version (DONE)
-ORBVersionImpl:
- - check equals on some ORBVersions (DONE)
- - check that each ORBVersion returns correct orbtype (DONE)
-JIDLObjectKeyTemplate:
- - non-key constructor gives NEWER version (DONE)
-POAObjectKeyTemplate:
- - non-key constructor gives NEWER version (DONE)
-OldJIDLObjectKeyTemplate: (DONE)
- - non-key constructor with OLD, NEW MAGIC and check version
- - other values throw exception
-OldPOAObjectKeyTemplate: (DONE)
- - non-key constructor with OLD, NEW MAGIC and check version (DONE)
- - other values throw exception (DONE)
-WireObjectKeyTemplate (DONE)
- - version is FOREIGN
-ObjectKeyFactory (DONE)
- create the following keys and check results:
- JIDL OLD OldJIDL with correct magic, version
- JIDL NEW OldJIDL
- JIDL NEWER JIDL
- POA OLD OldPOA
- POA NEW OldPOA
- POA NEWER POA
diff --git a/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java b/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java
deleted file mode 100644
index 5ac8283..0000000
--- a/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.javax.rmi.CORBA;
-
-import java.io.IOException;
-
-import java.rmi.RemoteException;
-
-import javax.rmi.CORBA.Tie;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.BAD_INV_ORDER;
-
-import org.omg.CORBA.portable.Delegate;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.CORBA.portable.InputStream;
-
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.util.Utility;
-
-import com.sun.corba.se.impl.ior.StubIORImpl ;
-import com.sun.corba.se.impl.presentation.rmi.StubConnectImpl ;
-
-import com.sun.corba.se.impl.logging.UtilSystemException ;
-
-/**
- * Base class from which all static RMI-IIOP stubs must inherit.
- */
-public class StubDelegateImpl implements javax.rmi.CORBA.StubDelegate
-{
- static UtilSystemException wrapper = UtilSystemException.get(
- CORBALogDomains.RMIIIOP ) ;
-
- private StubIORImpl ior ;
-
- public StubIORImpl getIOR()
- {
- return ior ;
- }
-
- public StubDelegateImpl()
- {
- ior = null ;
- }
-
- /**
- * Sets the IOR components if not already set.
- */
- private void init (javax.rmi.CORBA.Stub self)
- {
- // If the Stub is not connected to an ORB, BAD_OPERATION exception
- // will be raised by the code below.
- if (ior == null)
- ior = new StubIORImpl( self ) ;
- }
-
- /**
- * Returns a hash code value for the object which is the same for all stubs
- * that represent the same remote object.
- * @return the hash code value.
- */
- public int hashCode(javax.rmi.CORBA.Stub self)
- {
- init(self);
- return ior.hashCode() ;
- }
-
- /**
- * Compares two stubs for equality. Returns <code>true</code> when used to compare stubs
- * that represent the same remote object, and <code>false</code> otherwise.
- * @param obj the reference object with which to compare.
- * @return <code>true</code> if this object is the same as the <code>obj</code>
- * argument; <code>false</code> otherwise.
- */
- public boolean equals(javax.rmi.CORBA.Stub self, java.lang.Object obj)
- {
- if (self == obj) {
- return true;
- }
-
- if (!(obj instanceof javax.rmi.CORBA.Stub)) {
- return false;
- }
-
- // no need to call init() because of calls to hashCode() below
-
- javax.rmi.CORBA.Stub other = (javax.rmi.CORBA.Stub) obj;
- if (other.hashCode() != self.hashCode()) {
- return false;
- }
-
- // hashCodes being the same does not mean equality. The stubs still
- // could be pointing to different IORs. So, do a literal comparison.
- // Apparently the ONLY way to do this (other than using private
- // reflection) toString, because it is not possible to directly
- // access the StubDelegateImpl from the Stub.
- return self.toString().equals( other.toString() ) ;
- }
-
- public boolean equals( Object obj )
- {
- if (this == obj)
- return true ;
-
- if (!(obj instanceof StubDelegateImpl))
- return false ;
-
- StubDelegateImpl other = (StubDelegateImpl)obj ;
-
- if (ior == null)
- return ior == other.ior ;
- else
- return ior.equals( other.ior ) ;
- }
-
- public int hashCode() {
- if (ior == null) {
- return 0;
- } else {
- return ior.hashCode();
- }
- }
-
- /**
- * Returns a string representation of this stub. Returns the same string
- * for all stubs that represent the same remote object.
- * @return a string representation of this stub.
- */
- public String toString(javax.rmi.CORBA.Stub self)
- {
- if (ior == null)
- return null ;
- else
- return ior.toString() ;
- }
-
- /**
- * Connects this stub to an ORB. Required after the stub is deserialized
- * but not after it is demarshalled by an ORB stream. If an unconnected
- * stub is passed to an ORB stream for marshalling, it is implicitly
- * connected to that ORB. Application code should not call this method
- * directly, but should call the portable wrapper method
- * {@link javax.rmi.PortableRemoteObject#connect}.
- * @param orb the ORB to connect to.
- * @exception RemoteException if the stub is already connected to a different
- * ORB, or if the stub does not represent an exported remote or local object.
- */
- public void connect(javax.rmi.CORBA.Stub self, ORB orb)
- throws RemoteException
- {
- ior = StubConnectImpl.connect( ior, self, self, orb ) ;
- }
-
- /**
- * Serialization method to restore the IOR state.
- */
- public void readObject(javax.rmi.CORBA.Stub self,
- java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException
- {
- if (ior == null)
- ior = new StubIORImpl() ;
-
- ior.doRead( stream ) ;
- }
-
- /**
- * Serialization method to save the IOR state.
- * @serialData The length of the IOR type ID (int), followed by the IOR type ID
- * (byte array encoded using ISO8859-1), followed by the number of IOR profiles
- * (int), followed by the IOR profiles. Each IOR profile is written as a
- * profile tag (int), followed by the length of the profile data (int), followed
- * by the profile data (byte array).
- */
- public void writeObject(javax.rmi.CORBA.Stub self,
- java.io.ObjectOutputStream stream) throws IOException
- {
- init(self);
- ior.doWrite( stream ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java b/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java
deleted file mode 100644
index 7829d52..0000000
--- a/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java
+++ /dev/null
@@ -1,776 +0,0 @@
-/*
- * 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.javax.rmi.CORBA; // Util (sed marker, don't remove!)
-
-import java.rmi.RemoteException;
-import java.rmi.UnexpectedException;
-import java.rmi.MarshalException;
-
-import java.rmi.server.RMIClassLoader;
-
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Properties;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import java.io.Serializable;
-import java.io.NotSerializableException;
-
-import java.lang.reflect.Constructor;
-
-import javax.rmi.CORBA.ValueHandler;
-import javax.rmi.CORBA.Tie;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import java.rmi.MarshalException;
-import java.rmi.NoSuchObjectException;
-import java.rmi.AccessException;
-import java.rmi.Remote;
-import java.rmi.ServerError;
-import java.rmi.ServerException;
-import java.rmi.ServerRuntimeException;
-
-import javax.transaction.TransactionRequiredException;
-import javax.transaction.TransactionRolledbackException;
-import javax.transaction.InvalidTransactionException;
-
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.COMM_FAILURE;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.INV_OBJREF;
-import org.omg.CORBA.NO_PERMISSION;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.OBJECT_NOT_EXIST;
-import org.omg.CORBA.TRANSACTION_REQUIRED;
-import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
-import org.omg.CORBA.INVALID_TRANSACTION;
-import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.ACTIVITY_REQUIRED;
-import org.omg.CORBA.ACTIVITY_COMPLETED;
-import org.omg.CORBA.INVALID_ACTIVITY;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.portable.UnknownException;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-// This class must be able to function with non-Sun ORBs.
-// This means that any of the following com.sun.corba classes
-// must only occur in contexts that also handle the non-Sun case.
-
-import com.sun.corba.se.pept.transport.ContactInfoList ;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orb.ORBVersionFactory;
-import com.sun.corba.se.spi.protocol.CorbaClientDelegate;
-import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
-import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
-import com.sun.corba.se.spi.copyobject.ReflectiveCopyException ;
-import com.sun.corba.se.spi.copyobject.CopierManager ;
-import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-import com.sun.corba.se.impl.io.ValueHandlerImpl;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.util.IdentityHashtable;
-import com.sun.corba.se.impl.util.JDKBridge;
-import com.sun.corba.se.impl.logging.UtilSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import sun.corba.SharedSecrets;
-
-/**
- * Provides utility methods that can be used by stubs and ties to
- * perform common operations.
- */
-public class Util implements javax.rmi.CORBA.UtilDelegate
-{
- // Runs as long as there are exportedServants
- private static KeepAlive keepAlive = null;
-
- // Maps targets to ties.
- private static IdentityHashtable exportedServants = new IdentityHashtable();
-
- private static final ValueHandlerImpl valueHandlerSingleton =
- SharedSecrets.getJavaCorbaAccess().newValueHandlerImpl();
-
- private UtilSystemException utilWrapper = UtilSystemException.get(
- CORBALogDomains.RPC_ENCODING);
-
- private static Util instance = null;
-
- public Util() {
- setInstance(this);
- }
-
- private static void setInstance( Util util ) {
- assert instance == null : "Instance already defined";
- instance = util;
- }
-
- public static Util getInstance() {
- return instance;
- }
-
- public static boolean isInstanceDefined() {
- return instance != null;
- }
-
- // Used by TOAFactory.shutdown to unexport all targets for this
- // particular ORB. This happens during ORB shutdown.
- public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
- {
- for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
- {
- java.lang.Object key = e.nextElement();
- Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);
-
- // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
- // We can ignore this because it means the tie is not connected to an ORB.
- try {
- if (orb == getTie(target).orb()) {
- try {
- unexportObject(target);
- } catch( java.rmi.NoSuchObjectException ex ) {
- // We neglect this exception if at all if it is
- // raised. It is not harmful.
- }
- }
- } catch (BAD_OPERATION bad) {
- /* Ignore */
- }
- }
- }
-
- /**
- * Maps a SystemException to a RemoteException.
- * @param ex the SystemException to map.
- * @return the mapped exception.
- */
- public RemoteException mapSystemException(SystemException ex)
- {
- if (ex instanceof UnknownException) {
- Throwable orig = ((UnknownException)ex).originalEx;
- if (orig instanceof Error) {
- return new ServerError("Error occurred in server thread",(Error)orig);
- } else if (orig instanceof RemoteException) {
- return new ServerException("RemoteException occurred in server thread",
- (Exception)orig);
- } else if (orig instanceof RuntimeException) {
- throw (RuntimeException) orig;
- }
- }
-
- // Build the message string...
- String name = ex.getClass().getName();
- String corbaName = name.substring(name.lastIndexOf('.')+1);
- String status;
- switch (ex.completed.value()) {
- case CompletionStatus._COMPLETED_YES:
- status = "Yes";
- break;
- case CompletionStatus._COMPLETED_NO:
- status = "No";
- break;
- case CompletionStatus._COMPLETED_MAYBE:
- default:
- status = "Maybe";
- break;
- }
-
- String message = "CORBA " + corbaName + " " + ex.minor + " " + status;
-
- // Now map to the correct RemoteException type...
- if (ex instanceof COMM_FAILURE) {
- return new MarshalException(message, ex);
- } else if (ex instanceof INV_OBJREF) {
- RemoteException newEx = new NoSuchObjectException(message);
- newEx.detail = ex;
- return newEx;
- } else if (ex instanceof NO_PERMISSION) {
- return new AccessException(message, ex);
- } else if (ex instanceof MARSHAL) {
- return new MarshalException(message, ex);
- } else if (ex instanceof OBJECT_NOT_EXIST) {
- RemoteException newEx = new NoSuchObjectException(message);
- newEx.detail = ex;
- return newEx;
- } else if (ex instanceof TRANSACTION_REQUIRED) {
- RemoteException newEx = new TransactionRequiredException(message);
- newEx.detail = ex;
- return newEx;
- } else if (ex instanceof TRANSACTION_ROLLEDBACK) {
- RemoteException newEx = new TransactionRolledbackException(message);
- newEx.detail = ex;
- return newEx;
- } else if (ex instanceof INVALID_TRANSACTION) {
- RemoteException newEx = new InvalidTransactionException(message);
- newEx.detail = ex;
- return newEx;
- } else if (ex instanceof BAD_PARAM) {
- Exception inner = ex;
-
- // Pre-Merlin Sun ORBs used the incorrect minor code for
- // this case. See Java to IDL ptc-00-01-08 1.4.8.
- if (ex.minor == ORBConstants.LEGACY_SUN_NOT_SERIALIZABLE ||
- ex.minor == OMGSystemException.NOT_SERIALIZABLE) {
-
- if (ex.getMessage() != null)
- inner = new NotSerializableException(ex.getMessage());
- else
- inner = new NotSerializableException();
-
- inner.initCause( ex ) ;
- }
-
- return new MarshalException(message,inner);
- } else if (ex instanceof ACTIVITY_REQUIRED) {
- try {
- Class<?> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
- "javax.activity.ActivityRequiredException");
- Class[] params = new Class[2];
- params[0] = java.lang.String.class;
- params[1] = java.lang.Throwable.class;
- Constructor cr = cl.getConstructor(params);
- Object[] args = new Object[2];
- args[0] = message;
- args[1] = ex;
- return (RemoteException) cr.newInstance(args);
- } catch (Throwable e) {
- utilWrapper.classNotFound(
- e, "javax.activity.ActivityRequiredException");
- }
- } else if (ex instanceof ACTIVITY_COMPLETED) {
- try {
- Class<?> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
- "javax.activity.ActivityCompletedException");
- Class[] params = new Class[2];
- params[0] = java.lang.String.class;
- params[1] = java.lang.Throwable.class;
- Constructor cr = cl.getConstructor(params);
- Object[] args = new Object[2];
- args[0] = message;
- args[1] = ex;
- return (RemoteException) cr.newInstance(args);
- } catch (Throwable e) {
- utilWrapper.classNotFound(
- e, "javax.activity.ActivityCompletedException");
- }
- } else if (ex instanceof INVALID_ACTIVITY) {
- try {
- Class<?> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
- "javax.activity.InvalidActivityException");
- Class[] params = new Class[2];
- params[0] = java.lang.String.class;
- params[1] = java.lang.Throwable.class;
- Constructor cr = cl.getConstructor(params);
- Object[] args = new Object[2];
- args[0] = message;
- args[1] = ex;
- return (RemoteException) cr.newInstance(args);
- } catch (Throwable e) {
- utilWrapper.classNotFound(
- e, "javax.activity.InvalidActivityException");
- }
- }
-
- // Just map to a generic RemoteException...
- return new RemoteException(message, ex);
- }
-
- /**
- * Writes any java.lang.Object as a CORBA any.
- * @param out the stream in which to write the any.
- * @param obj the object to write as an any.
- */
- public void writeAny( org.omg.CORBA.portable.OutputStream out,
- java.lang.Object obj)
- {
- org.omg.CORBA.ORB orb = out.orb();
-
- // Create Any
- Any any = orb.create_any();
-
- // Make sure we have a connected object...
- java.lang.Object newObj = Utility.autoConnect(obj,orb,false);
-
- if (newObj instanceof org.omg.CORBA.Object) {
- any.insert_Object((org.omg.CORBA.Object)newObj);
- } else {
- if (newObj == null) {
- // Handle the null case, including backwards
- // compatibility issues
- any.insert_Value(null, createTypeCodeForNull(orb));
- } else {
- if (newObj instanceof Serializable) {
- // If they're our Any and ORB implementations,
- // we may want to do type code related versioning.
- TypeCode tc = createTypeCode((Serializable)newObj, any, orb);
- if (tc == null)
- any.insert_Value((Serializable)newObj);
- else
- any.insert_Value((Serializable)newObj, tc);
- } else if (newObj instanceof Remote) {
- ORBUtility.throwNotSerializableForCorba(newObj.getClass().getName());
- } else {
- ORBUtility.throwNotSerializableForCorba(newObj.getClass().getName());
- }
- }
- }
-
- out.write_any(any);
- }
-
- /**
- * When using our own ORB and Any implementations, we need to get
- * the ORB version and create the type code appropriately. This is
- * to overcome a bug in which the JDK 1.3.x ORBs used a tk_char
- * rather than a tk_wchar to describe a Java char field.
- *
- * This only works in RMI-IIOP with Util.writeAny since we actually
- * know what ORB and stream we're writing with when we insert
- * the value.
- *
- * Returns null if it wasn't possible to create the TypeCode (means
- * it wasn't our ORB or Any implementation).
- *
- * This does not handle null objs.
- */
- private TypeCode createTypeCode(Serializable obj,
- org.omg.CORBA.Any any,
- org.omg.CORBA.ORB orb) {
-
- if (any instanceof com.sun.corba.se.impl.corba.AnyImpl &&
- orb instanceof ORB) {
-
- com.sun.corba.se.impl.corba.AnyImpl anyImpl
- = (com.sun.corba.se.impl.corba.AnyImpl)any;
-
- ORB ourORB = (ORB)orb;
-
- return anyImpl.createTypeCodeForClass(obj.getClass(), ourORB);
-
- } else
- return null;
- }
-
-
- /**
- * This is used to create the TypeCode for a null reference.
- * It also handles backwards compatibility with JDK 1.3.x.
- *
- * This method will not return null.
- */
- private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
- {
- if (orb instanceof ORB) {
-
- ORB ourORB = (ORB)orb;
-
- // Preserve backwards compatibility with Kestrel and Ladybird
- // by not fully implementing interop issue resolution 3857,
- // and returning a null TypeCode with a tk_value TCKind.
- // If we're not talking to Kestrel or Ladybird, fall through
- // to the abstract interface case (also used for foreign ORBs).
- if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
- ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {
-
- return orb.get_primitive_tc(TCKind.tk_value);
- }
- }
-
- // Use tk_abstract_interface as detailed in the resolution
-
- // REVISIT: Define this in IDL and get the ID in generated code
- String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";
-
- return orb.create_abstract_interface_tc(abstractBaseID, "");
- }
-
- /**
- * Reads a java.lang.Object as a CORBA any.
- * @param in the stream from which to read the any.
- * @return the object read from the stream.
- */
- public Object readAny(InputStream in)
- {
- Any any = in.read_any();
- if ( any.type().kind().value() == TCKind._tk_objref )
- return any.extract_Object ();
- else
- return any.extract_Value();
- }
-
- /**
- * Writes a java.lang.Object as a CORBA Object. If <code>obj</code> is
- * an exported RMI-IIOP server object, the tie is found
- * and wired to <code>obj</code>, then written to <code>out.write_Object(org.omg.CORBA.Object)</code>.
- * If <code>obj</code> is a CORBA Object, it is written to
- * <code>out.write_Object(org.omg.CORBA.Object)</code>.
- * @param out the stream in which to write the object.
- * @param obj the object to write.
- */
- public void writeRemoteObject(OutputStream out, java.lang.Object obj)
- {
- // Make sure we have a connected object, then
- // write it out...
-
- Object newObj = Utility.autoConnect(obj,out.orb(),false);
- out.write_Object((org.omg.CORBA.Object)newObj);
- }
-
- /**
- * Writes a java.lang.Object as either a value or a CORBA Object.
- * If <code>obj</code> is a value object or a stub object, it is written to
- * <code>out.write_abstract_interface(java.lang.Object)</code>. If <code>obj</code> is an exported
- * RMI-IIOP server object, the tie is found and wired to <code>obj</code>,
- * then written to <code>out.write_abstract_interface(java.lang.Object)</code>.
- * @param out the stream in which to write the object.
- * @param obj the object to write.
- */
- public void writeAbstractObject( OutputStream out, java.lang.Object obj )
- {
- // Make sure we have a connected object, then
- // write it out...
-
- Object newObj = Utility.autoConnect(obj,out.orb(),false);
- ((org.omg.CORBA_2_3.portable.OutputStream)out).write_abstract_interface(newObj);
- }
-
- /**
- * Registers a target for a tie. Adds the tie to an internal table and calls
- * {@link Tie#setTarget} on the tie object.
- * @param tie the tie to register.
- * @param target the target for the tie.
- */
- public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target)
- {
- synchronized (exportedServants) {
- // Do we already have this target registered?
- if (lookupTie(target) == null) {
- // No, so register it and set the target...
- exportedServants.put(target,tie);
- tie.setTarget(target);
-
- // Do we need to instantiate our keep-alive thread?
- if (keepAlive == null) {
- // Yes. Instantiate our keep-alive thread and start
- // it up...
- keepAlive = (KeepAlive)AccessController.doPrivileged(new PrivilegedAction() {
- public java.lang.Object run() {
- return new KeepAlive();
- }
- });
- keepAlive.start();
- }
- }
- }
- }
-
- /**
- * Removes the associated tie from an internal table and calls {@link Tie#deactivate}
- * to deactivate the object.
- * @param target the object to unexport.
- */
- public void unexportObject(java.rmi.Remote target)
- throws java.rmi.NoSuchObjectException
- {
- synchronized (exportedServants) {
- Tie cachedTie = lookupTie(target);
- if (cachedTie != null) {
- exportedServants.remove(target);
- Utility.purgeStubForTie(cachedTie);
- Utility.purgeTieAndServant(cachedTie);
- try {
- cleanUpTie(cachedTie);
- } catch (BAD_OPERATION e) {
- // ignore
- } catch (org.omg.CORBA.OBJ_ADAPTER e) {
- // This can happen when the target was never associated with a POA.
- // We can safely ignore this case.
- }
-
- // Is it time to shut down our keep alive thread?
- if (exportedServants.isEmpty()) {
- keepAlive.quit();
- keepAlive = null;
- }
- } else {
- throw new java.rmi.NoSuchObjectException("Tie not found" );
- }
- }
- }
-
- protected void cleanUpTie(Tie cachedTie)
- throws java.rmi.NoSuchObjectException
- {
- cachedTie.setTarget(null);
- cachedTie.deactivate();
- }
-
- /**
- * Returns the tie (if any) for a given target object.
- * @return the tie or null if no tie is registered for the given target.
- */
- public Tie getTie (Remote target)
- {
- synchronized (exportedServants) {
- return lookupTie(target);
- }
- }
-
- /**
- * An unsynchronized version of getTie() for internal use.
- */
- private static Tie lookupTie (Remote target)
- {
- Tie result = (Tie)exportedServants.get(target);
- if (result == null && target instanceof Tie) {
- if (exportedServants.contains(target)) {
- result = (Tie)target;
- }
- }
- return result;
- }
-
- /**
- * Returns a singleton instance of a class that implements the
- * {@link ValueHandler} interface.
- * @return a class which implements the ValueHandler interface.
- */
- public ValueHandler createValueHandler()
- {
- return valueHandlerSingleton;
- }
-
- /**
- * Returns the codebase, if any, for the given class.
- * @param clz the class to get a codebase for.
- * @return a space-separated list of URLs, or null.
- */
- public String getCodebase(java.lang.Class clz) {
- return RMIClassLoader.getClassAnnotation(clz);
- }
-
- /**
- * Returns a class instance for the specified class.
- * @param className the name of the class.
- * @param remoteCodebase a space-separated list of URLs at which
- * the class might be found. May be null.
- * @param loadingContext a class whose ClassLoader may be used to
- * load the class if all other methods fail.
- * @return the <code>Class</code> object representing the loaded class.
- * @exception ClassNotFoundException if class cannot be loaded.
- */
- public Class loadClass( String className, String remoteCodebase,
- ClassLoader loader) throws ClassNotFoundException
- {
- return JDKBridge.loadClass(className,remoteCodebase,loader);
- }
-
- /**
- * The <tt>isLocal</tt> method has the same semantics as the
- * ObjectImpl._is_local method, except that it can throw a RemoteException.
- * (no it doesn't but the spec says it should.)
- *
- * The <tt>_is_local()</tt> method is provided so that stubs may determine
- * if a particular object is implemented by a local servant and hence local
- * invocation APIs may be used.
- *
- * @param stub the stub to test.
- *
- * @return The <tt>_is_local()</tt> method returns true if
- * the servant incarnating the object is located in the same process as
- * the stub and they both share the same ORB instance. The <tt>_is_local()</tt>
- * method returns false otherwise. The default behavior of <tt>_is_local()</tt> is
- * to return false.
- *
- * @throws RemoteException The Java to IDL specification does to
- * specify the conditions that cause a RemoteException to be thrown.
- */
- public boolean isLocal(javax.rmi.CORBA.Stub stub) throws RemoteException
- {
- boolean result = false ;
-
- try {
- org.omg.CORBA.portable.Delegate delegate = stub._get_delegate() ;
- if (delegate instanceof CorbaClientDelegate) {
- // For the Sun ORB
- CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
- ContactInfoList cil = cdel.getContactInfoList() ;
- if (cil instanceof CorbaContactInfoList) {
- CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
- LocalClientRequestDispatcher lcs = ccil.getLocalClientRequestDispatcher() ;
- result = lcs.useLocalInvocation( null ) ;
- }
- } else {
- // For a non-Sun ORB
- result = delegate.is_local( stub ) ;
- }
- } catch (SystemException e) {
- throw javax.rmi.CORBA.Util.mapSystemException(e);
- }
-
- return result ;
- }
-
- /**
- * Wraps an exception thrown by an implementation
- * method. It returns the corresponding client-side exception.
- * @param orig the exception to wrap.
- * @return the wrapped exception.
- */
- public RemoteException wrapException(Throwable orig)
- {
- if (orig instanceof SystemException) {
- return mapSystemException((SystemException)orig);
- }
-
- if (orig instanceof Error) {
- return new ServerError("Error occurred in server thread",(Error)orig);
- } else if (orig instanceof RemoteException) {
- return new ServerException("RemoteException occurred in server thread",
- (Exception)orig);
- } else if (orig instanceof RuntimeException) {
- throw (RuntimeException) orig;
- }
-
- if (orig instanceof Exception)
- return new UnexpectedException( orig.toString(), (Exception)orig );
- else
- return new UnexpectedException( orig.toString());
- }
-
- /**
- * Copies or connects an array of objects. Used by local stubs
- * to copy any number of actual parameters, preserving sharing
- * across parameters as necessary to support RMI semantics.
- * @param obj the objects to copy or connect.
- * @param orb the ORB.
- * @return the copied or connected objects.
- * @exception RemoteException if any object could not be copied or connected.
- */
- public Object[] copyObjects (Object[] obj, org.omg.CORBA.ORB orb)
- throws RemoteException
- {
- if (obj == null)
- // Bug fix for 5018613: JCK test expects copyObjects to throw
- // NPE when obj==null. This is actually not in the spec, since
- // obj is not really an RMI-IDL data type, but we follow our
- // test here, and force this error to be thrown.
- throw new NullPointerException() ;
-
- Class compType = obj.getClass().getComponentType() ;
- if (Remote.class.isAssignableFrom( compType ) && !compType.isInterface()) {
- // obj is an array of remote impl types. This
- // causes problems with stream copier, so we copy
- // it over to an array of Remotes instead.
- Remote[] result = new Remote[obj.length] ;
- System.arraycopy( (Object)obj, 0, (Object)result, 0, obj.length ) ;
- return (Object[])copyObject( result, orb ) ;
- } else
- return (Object[])copyObject( obj, orb ) ;
- }
-
- /**
- * Copies or connects an object. Used by local stubs to copy
- * an actual parameter, result object, or exception.
- * @param obj the object to copy.
- * @param orb the ORB.
- * @return the copy or connected object.
- * @exception RemoteException if the object could not be copied or connected.
- */
- public Object copyObject (Object obj, org.omg.CORBA.ORB orb)
- throws RemoteException
- {
- if (orb instanceof ORB) {
- ORB lorb = (ORB)orb ;
-
- try {
- try {
- // This gets the copier for the current invocation, which was
- // previously set by preinvoke.
- return lorb.peekInvocationInfo().getCopierFactory().make().copy( obj ) ;
- } catch (java.util.EmptyStackException exc) {
- // copyObject was invoked outside of an invocation, probably by
- // a test. Get the default copier from the ORB.
- // XXX should we just make the default copier available directly
- // and avoid constructing one on each call?
- CopierManager cm = lorb.getCopierManager() ;
- ObjectCopier copier = cm.getDefaultObjectCopierFactory().make() ;
- return copier.copy( obj ) ;
- }
- } catch (ReflectiveCopyException exc) {
- RemoteException rexc = new RemoteException() ;
- rexc.initCause( exc ) ;
- throw rexc ;
- }
- } else {
- org.omg.CORBA_2_3.portable.OutputStream out =
- (org.omg.CORBA_2_3.portable.OutputStream)orb.create_output_stream();
- out.write_value((Serializable)obj);
- org.omg.CORBA_2_3.portable.InputStream in =
- (org.omg.CORBA_2_3.portable.InputStream)out.create_input_stream();
- return in.read_value();
- }
- }
-}
-
-class KeepAlive extends Thread
-{
- boolean quit = false;
-
- public KeepAlive ()
- {
- setDaemon(false);
- }
-
- public synchronized void run ()
- {
- while (!quit) {
- try {
- wait();
- } catch (InterruptedException e) {}
- }
- }
-
- public synchronized void quit ()
- {
- quit = true;
- notifyAll();
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/javax/rmi/PortableRemoteObject.java b/src/share/classes/com/sun/corba/se/impl/javax/rmi/PortableRemoteObject.java
deleted file mode 100644
index 822de35..0000000
--- a/src/share/classes/com/sun/corba/se/impl/javax/rmi/PortableRemoteObject.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.javax.rmi;
-
-import java.lang.reflect.Method ;
-
-import javax.rmi.CORBA.Tie;
-import javax.rmi.CORBA.Util;
-
-import java.rmi.RemoteException;
-import java.rmi.NoSuchObjectException;
-import java.rmi.Remote;
-
-import java.util.Properties;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.portable.Delegate;
-import org.omg.CORBA.SystemException;
-
-import java.rmi.server.UnicastRemoteObject;
-import java.rmi.server.RemoteStub;
-import java.rmi.server.ExportException;
-
-import java.net.URL;
-
-import com.sun.corba.se.impl.util.JDKBridge;
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.util.RepositoryId;
-
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-
-import java.security.AccessController;
-import com.sun.corba.se.impl.orbutil.GetPropertyAction;
-
-/**
- * Server implementation objects may either inherit from
- * javax.rmi.PortableRemoteObject or they may implement a remote interface
- * and then use the exportObject method to register themselves as a server object.
- * The toStub method takes a server implementation and returns a stub that
- * can be used to access that server object.
- * The connect method makes a Remote object ready for remote communication.
- * The unexportObject method is used to deregister a server object, allowing it to become
- * available for garbage collection.
- * The narrow method takes an object reference or abstract interface type and
- * attempts to narrow it to conform to
- * the given interface. If the operation is successful the result will be an
- * object of the specified type, otherwise an exception will be thrown.
- */
-public class PortableRemoteObject
- implements javax.rmi.CORBA.PortableRemoteObjectDelegate {
-
- /**
- * Makes a server object ready to receive remote calls. Note
- * that subclasses of PortableRemoteObject do not need to call this
- * method, as it is called by the constructor.
- * @param obj the server object to export.
- * @exception RemoteException if export fails.
- */
- public void exportObject(Remote obj)
- throws RemoteException {
-
- if (obj == null) {
- throw new NullPointerException("invalid argument");
- }
-
- // Has this object already been exported to IIOP?
-
- if (Util.getTie(obj) != null) {
-
- // Yes, so this is an error...
-
- throw new ExportException (obj.getClass().getName() + " already exported");
- }
-
- // Can we load a Tie?
-
- Tie theTie = Utility.loadTie(obj);
-
- if (theTie != null) {
-
- // Yes, so export it to IIOP...
-
- Util.registerTarget(theTie,obj);
-
- } else {
-
- // No, so export to JRMP. If this is called twice for the
- // same object, it will throw an ExportException...
-
- UnicastRemoteObject.exportObject(obj);
- }
- }
-
- /**
- * Returns a stub for the given server object.
- * @param obj the server object for which a stub is required. Must either be a subclass
- * of PortableRemoteObject or have been previously the target of a call to
- * {@link #exportObject}.
- * @return the most derived stub for the object.
- * @exception NoSuchObjectException if a stub cannot be located for the given server object.
- */
- public Remote toStub (Remote obj)
- throws NoSuchObjectException
- {
- Remote result = null;
- if (obj == null) {
- throw new NullPointerException("invalid argument");
- }
-
- // If the class is already an IIOP stub then return it.
- if (StubAdapter.isStub( obj )) {
- return obj;
- }
-
- // If the class is already a JRMP stub then return it.
- if (obj instanceof java.rmi.server.RemoteStub) {
- return obj;
- }
-
- // Has it been exported to IIOP?
- Tie theTie = Util.getTie(obj);
-
- if (theTie != null) {
- result = Utility.loadStub(theTie,null,null,true);
- } else {
- if (Utility.loadTie(obj) == null) {
- result = java.rmi.server.RemoteObject.toStub(obj);
- }
- }
-
- if (result == null) {
- throw new NoSuchObjectException("object not exported");
- }
-
- return result;
- }
-
- /**
- * Deregisters a server object from the runtime, allowing the object to become
- * available for garbage collection.
- * @param obj the object to unexport.
- * @exception NoSuchObjectException if the remote object is not
- * currently exported.
- */
- public void unexportObject(Remote obj)
- throws NoSuchObjectException {
-
- if (obj == null) {
- throw new NullPointerException("invalid argument");
- }
-
- if (StubAdapter.isStub(obj) ||
- obj instanceof java.rmi.server.RemoteStub) {
- throw new NoSuchObjectException(
- "Can only unexport a server object.");
- }
-
- Tie theTie = Util.getTie(obj);
- if (theTie != null) {
- Util.unexportObject(obj);
- } else {
- if (Utility.loadTie(obj) == null) {
- UnicastRemoteObject.unexportObject(obj,true);
- } else {
- throw new NoSuchObjectException("Object not exported.");
- }
- }
- }
-
- /**
- * Checks to ensure that an object of a remote or abstract interface type
- * can be cast to a desired type.
- * @param narrowFrom the object to check.
- * @param narrowTo the desired type.
- * @return an object which can be cast to the desired type.
- * @throws ClassCastException if narrowFrom cannot be cast to narrowTo.
- */
- public java.lang.Object narrow ( java.lang.Object narrowFrom,
- java.lang.Class narrowTo) throws ClassCastException
- {
- java.lang.Object result = null;
-
- if (narrowFrom == null)
- return null;
-
- if (narrowTo == null)
- throw new NullPointerException("invalid argument");
-
- try {
- if (narrowTo.isAssignableFrom(narrowFrom.getClass()))
- return narrowFrom;
-
- // Is narrowTo an interface that might be
- // implemented by a servant running on iiop?
- if (narrowTo.isInterface() &&
- narrowTo != java.io.Serializable.class &&
- narrowTo != java.io.Externalizable.class) {
-
- org.omg.CORBA.Object narrowObj
- = (org.omg.CORBA.Object) narrowFrom;
-
- // Create an id from the narrowTo type...
- String id = RepositoryId.createForAnyType(narrowTo);
-
- if (narrowObj._is_a(id)) {
- return Utility.loadStub(narrowObj,narrowTo);
- } else {
- throw new ClassCastException( "Object is not of remote type " +
- narrowTo.getName() ) ;
- }
- } else {
- throw new ClassCastException( "Class " + narrowTo.getName() +
- " is not a valid remote interface" ) ;
- }
- } catch(Exception error) {
- ClassCastException cce = new ClassCastException() ;
- cce.initCause( error ) ;
- throw cce ;
- }
- }
-
- /**
- * Makes a Remote object ready for remote communication. This normally
- * happens implicitly when the object is sent or received as an argument
- * on a remote method call, but in some circumstances it is useful to
- * perform this action by making an explicit call. See the
- * {@link Stub#connect} method for more information.
- * @param target the object to connect.
- * @param source a previously connected object.
- * @throws RemoteException if <code>source</code> is not connected
- * or if <code>target</code> is already connected to a different ORB than
- * <code>source</code>.
- */
- public void connect (Remote target, Remote source)
- throws RemoteException
- {
- if (target == null || source == null) {
- throw new NullPointerException("invalid argument");
- }
-
- ORB orb = null;
- try {
- if (StubAdapter.isStub( source )) {
- orb = StubAdapter.getORB( source ) ;
- } else {
- // Is this a servant that was exported to iiop?
- Tie tie = Util.getTie(source);
- if (tie == null) {
- /* loadTie always succeeds for dynamic RMI-IIOP
- // No, can we get a tie for it? If not,
- // assume that source is a JRMP object...
- if (Utility.loadTie(source) != null) {
- // Yes, so it is an iiop object which
- // has not been exported...
- throw new RemoteException(
- "'source' object not exported");
- }
- */
- } else {
- orb = tie.orb();
- }
- }
- } catch (SystemException e) {
- throw new RemoteException("'source' object not connected", e );
- }
-
- boolean targetIsIIOP = false ;
- Tie targetTie = null;
- if (StubAdapter.isStub(target)) {
- targetIsIIOP = true;
- } else {
- targetTie = Util.getTie(target);
- if (targetTie != null) {
- targetIsIIOP = true;
- } else {
- /* loadTie always succeeds for dynamic RMI-IIOP
- if (Utility.loadTie(target) != null) {
- throw new RemoteException("'target' servant not exported");
- }
- */
- }
- }
-
- if (!targetIsIIOP) {
- // Yes. Do we have an ORB from the source object?
- // If not, we're done - there is nothing to do to
- // connect a JRMP object. If so, it is an error because
- // the caller mixed JRMP and IIOP...
- if (orb != null) {
- throw new RemoteException(
- "'source' object exported to IIOP, 'target' is JRMP");
- }
- } else {
- // The target object is IIOP. Make sure we have a
- // valid ORB from the source object...
- if (orb == null) {
- throw new RemoteException(
- "'source' object is JRMP, 'target' is IIOP");
- }
-
- // And, finally, connect it up...
- try {
- if (targetTie != null) {
- // Is the tie already connected?
- try {
- ORB existingOrb = targetTie.orb();
-
- // Yes. Is it the same orb?
- if (existingOrb == orb) {
-
- // Yes, so nothing to do...
- return;
- } else {
- // No, so this is an error...
- throw new RemoteException(
- "'target' object was already connected");
- }
- } catch (SystemException e) {}
-
- // No, so do it...
- targetTie.orb(orb);
- } else {
- StubAdapter.connect( target, orb ) ;
- }
- } catch (SystemException e) {
-
- // The stub or tie was already connected...
- throw new RemoteException(
- "'target' object was already connected", e );
- }
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/legacy/connection/DefaultSocketFactory.java b/src/share/classes/com/sun/corba/se/impl/legacy/connection/DefaultSocketFactory.java
deleted file mode 100644
index 93f6e3f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/legacy/connection/DefaultSocketFactory.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, 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.
- */
-package com.sun.corba.se.impl.legacy.connection;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.nio.channels.ServerSocketChannel;
-import java.nio.channels.SocketChannel;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.COMM_FAILURE;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;
-import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.transport.SocketInfo;
-
-import com.sun.corba.se.impl.legacy.connection.EndPointInfoImpl;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-public class DefaultSocketFactory
- implements
- ORBSocketFactory
-{
- private com.sun.corba.se.spi.orb.ORB orb;
- private static ORBUtilSystemException wrapper = ORBUtilSystemException.get(
- CORBALogDomains.RPC_TRANSPORT ) ;
-
- public DefaultSocketFactory()
- {
- }
-
- public void setORB(com.sun.corba.se.spi.orb.ORB orb)
- {
- this.orb = orb;
- }
-
- public ServerSocket createServerSocket(String type, int port)
- throws
- IOException
- {
- if (! type.equals(ORBSocketFactory.IIOP_CLEAR_TEXT)) {
- throw wrapper.defaultCreateServerSocketGivenNonIiopClearText( type ) ;
- }
-
- ServerSocket serverSocket;
-
- if (orb.getORBData().acceptorSocketType().equals(ORBConstants.SOCKETCHANNEL)) {
- ServerSocketChannel serverSocketChannel =
- ServerSocketChannel.open();
- serverSocket = serverSocketChannel.socket();
- } else {
- serverSocket = new ServerSocket();
- }
- serverSocket.bind(new InetSocketAddress(port));
- return serverSocket;
- }
-
- public SocketInfo getEndPointInfo(ORB orb,
- IOR ior,
- SocketInfo socketInfo)
- {
- IIOPProfileTemplate temp =
- (IIOPProfileTemplate)ior.getProfile().getTaggedProfileTemplate() ;
- IIOPAddress primary = temp.getPrimaryAddress() ;
-
- return new EndPointInfoImpl(ORBSocketFactory.IIOP_CLEAR_TEXT,
- primary.getPort(),
- primary.getHost().toLowerCase());
- }
-
- public Socket createSocket(SocketInfo socketInfo)
- throws
- IOException,
- GetEndPointInfoAgainException
- {
- Socket socket;
-
- if (orb.getORBData().acceptorSocketType().equals(ORBConstants.SOCKETCHANNEL)) {
- InetSocketAddress address =
- new InetSocketAddress(socketInfo.getHost(),
- socketInfo.getPort());
- SocketChannel socketChannel = SocketChannel.open(address);
- socket = socketChannel.socket();
- } else {
- socket = new Socket(socketInfo.getHost(),
- socketInfo.getPort());
- }
-
- // REVISIT - this is done in SocketOrChannelConnectionImpl
- try {
- socket.setTcpNoDelay(true);
- } catch (Exception e) {
- ;
- }
- return socket;
- }
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/legacy/connection/EndPointInfoImpl.java b/src/share/classes/com/sun/corba/se/impl/legacy/connection/EndPointInfoImpl.java
deleted file mode 100644
index 76711e1..0000000
--- a/src/share/classes/com/sun/corba/se/impl/legacy/connection/EndPointInfoImpl.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 1998, 2004, 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.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
-import com.sun.corba.se.spi.transport.SocketInfo;
-
-public class EndPointInfoImpl
- implements
- SocketInfo,
- LegacyServerSocketEndPointInfo
-{
-
- protected String type;
- protected String hostname;
- protected int port;
- protected int locatorPort;
- protected String name;
-
- public EndPointInfoImpl(String type, int port, String hostname) {
- this.type = type;
- this.port = port;
- this.hostname = hostname;
- this.locatorPort = -1;
- this.name = LegacyServerSocketEndPointInfo.NO_NAME;
- }
-
- public String getType() {
- return type;
- }
-
- public String getHost() {
- return hostname;
- }
-
- public String getHostName() {
- return hostname;
- }
-
- public int getPort() {
- return port;
- }
-
- public int getLocatorPort ()
- {
- return locatorPort;
- }
-
- public void setLocatorPort (int port)
- {
- locatorPort = port;
- }
-
- public String getName()
- {
- return name;
- }
-
- public int hashCode() {
- return type.hashCode() ^ hostname.hashCode() ^ port;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof EndPointInfoImpl)) {
- return false;
- }
- EndPointInfoImpl other = (EndPointInfoImpl)obj;
- if (type == null) {
- if (other.type != null) {
- return false;
- }
- } else if (!type.equals(other.type)) {
- return false;
- }
- if (port != other.port) {
- return false;
- }
- if (!hostname.equals(other.hostname)) {
- return false;
- }
- return true;
- }
-
- public String toString ()
- {
- return
- type + " " +
- name + " " +
- hostname + " " +
- port;
- }
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/legacy/connection/LegacyServerSocketManagerImpl.java b/src/share/classes/com/sun/corba/se/impl/legacy/connection/LegacyServerSocketManagerImpl.java
deleted file mode 100644
index 3a5ca90..0000000
--- a/src/share/classes/com/sun/corba/se/impl/legacy/connection/LegacyServerSocketManagerImpl.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, 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.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import java.net.ServerSocket;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.omg.CORBA.INITIALIZE;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.pept.transport.Acceptor;
-import com.sun.corba.se.pept.transport.ByteBufferPool;
-import com.sun.corba.se.pept.transport.ContactInfo;
-import com.sun.corba.se.pept.transport.Selector;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.transport.CorbaTransportManager;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
-import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.encoding.EncapsOutputStream;
-import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl;
-import com.sun.corba.se.impl.legacy.connection.USLPort;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-public class LegacyServerSocketManagerImpl
- implements
- LegacyServerSocketManager
-{
- protected ORB orb;
- private ORBUtilSystemException wrapper ;
-
- public LegacyServerSocketManagerImpl(ORB orb)
- {
- this.orb = orb;
- wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_TRANSPORT ) ;
- }
-
- ////////////////////////////////////////////////////
- //
- // LegacyServerSocketManager
- //
-
- // Only used in ServerManagerImpl.
- public int legacyGetTransientServerPort(String type)
- {
- return legacyGetServerPort(type, false);
- }
-
- // Only used by POAPolicyMediatorBase.
- public synchronized int legacyGetPersistentServerPort(String socketType)
- {
- if (orb.getORBData().getServerIsORBActivated()) {
- // this server is activated by orbd
- return legacyGetServerPort(socketType, true);
- } else if (orb.getORBData().getPersistentPortInitialized()) {
- // this is a user-activated server
- return orb.getORBData().getPersistentServerPort();
- } else {
- throw wrapper.persistentServerportNotSet(
- CompletionStatus.COMPLETED_MAYBE);
- }
- }
-
- // Only used by PI IORInfoImpl.
- public synchronized int legacyGetTransientOrPersistentServerPort(
- String socketType)
- {
- return legacyGetServerPort(socketType,
- orb.getORBData()
- .getServerIsORBActivated());
- }
-
- // Used in RepositoryImpl, ServerManagerImpl, POAImpl,
- // POAPolicyMediatorBase, TOAImpl.
- // To get either default or bootnaming endpoint.
- public synchronized LegacyServerSocketEndPointInfo legacyGetEndpoint(
- String name)
- {
- Iterator iterator = getAcceptorIterator();
- while (iterator.hasNext()) {
- LegacyServerSocketEndPointInfo endPoint = cast(iterator.next());
- if (endPoint != null && name.equals(endPoint.getName())) {
- return endPoint;
- }
- }
- throw new INTERNAL("No acceptor for: " + name);
- }
-
- // Check to see if the given port is equal to any of the ORB Server Ports.
- // XXX Does this need to change for the multi-homed case?
- // Used in IIOPProfileImpl, ORBImpl.
- public boolean legacyIsLocalServerPort(int port)
- {
- Iterator iterator = getAcceptorIterator();
- while (iterator.hasNext()) {
- LegacyServerSocketEndPointInfo endPoint = cast(iterator.next());
- if (endPoint != null && endPoint.getPort() == port) {
- return true;
- }
- }
- return false;
- }
-
- ////////////////////////////////////////////////////
- //
- // Implementation.
- //
-
- private int legacyGetServerPort (String socketType, boolean isPersistent)
- {
- Iterator endpoints = getAcceptorIterator();
- while (endpoints.hasNext()) {
- LegacyServerSocketEndPointInfo ep = cast(endpoints.next());
- if (ep != null && ep.getType().equals(socketType)) {
- if (isPersistent) {
- return ep.getLocatorPort();
- } else {
- return ep.getPort();
- }
- }
- }
- return -1;
- }
-
- private Iterator getAcceptorIterator()
- {
- Collection acceptors =
- orb.getCorbaTransportManager().getAcceptors(null, null);
- if (acceptors != null) {
- return acceptors.iterator();
- }
-
- throw wrapper.getServerPortCalledBeforeEndpointsInitialized() ;
- }
-
- private LegacyServerSocketEndPointInfo cast(Object o)
- {
- if (o instanceof LegacyServerSocketEndPointInfo) {
- return (LegacyServerSocketEndPointInfo) o;
- }
- return null;
- }
-
- protected void dprint(String msg)
- {
- ORBUtility.dprint("LegacyServerSocketManagerImpl", msg);
- }
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryAcceptorImpl.java b/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryAcceptorImpl.java
deleted file mode 100644
index f62d7f6..0000000
--- a/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryAcceptorImpl.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, 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.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INTERNAL;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl;
-import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
-
-/**
- * @author Harold Carr
- */
-public class SocketFactoryAcceptorImpl
- extends
- SocketOrChannelAcceptorImpl
-{
- public SocketFactoryAcceptorImpl(ORB orb, int port,
- String name, String type)
- {
- super(orb, port, name, type);
- }
-
- ////////////////////////////////////////////////////
- //
- // pept Acceptor
- //
-
- public boolean initialize()
- {
- if (initialized) {
- return false;
- }
- if (orb.transportDebugFlag) {
- dprint("initialize: " + this);
- }
- try {
- serverSocket = orb.getORBData()
- .getLegacySocketFactory().createServerSocket(type, port);
- internalInitialize();
- } catch (Throwable t) {
- throw wrapper.createListenerFailed( t, Integer.toString(port) ) ;
- }
- initialized = true;
- return true;
- }
-
- ////////////////////////////////////////////////////
- //
- // Implementation.
- //
-
- protected String toStringName()
- {
- return "SocketFactoryAcceptorImpl";
- }
-
- protected void dprint(String msg)
- {
- ORBUtility.dprint(toStringName(), msg);
- }
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryConnectionImpl.java b/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryConnectionImpl.java
deleted file mode 100644
index af96c92..0000000
--- a/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryConnectionImpl.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, 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.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import java.net.Socket;
-import java.nio.channels.SocketChannel;
-import java.util.Collections;
-
-import org.omg.CORBA.COMM_FAILURE;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.pept.transport.Acceptor;
-import com.sun.corba.se.pept.transport.ContactInfo;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.transport.CorbaConnection;
-import com.sun.corba.se.spi.transport.CorbaContactInfo;
-import com.sun.corba.se.spi.transport.SocketInfo;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl;
-import com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl;
-
-/**
- * @author Harold Carr
- */
-public class SocketFactoryConnectionImpl
- extends
- SocketOrChannelConnectionImpl
-{
- // Socket-factory client constructor.
- public SocketFactoryConnectionImpl(ORB orb,
- CorbaContactInfo contactInfo,
- boolean useSelectThreadToWait,
- boolean useWorkerThread)
- {
- super(orb, useSelectThreadToWait, useWorkerThread);
-
- // REVISIT - probably need a contact info for both
- // client and server for removing connections from cache?
- this.contactInfo = contactInfo;
-
- boolean isBlocking = !useSelectThreadToWait;
- SocketInfo socketInfo =
- // REVISIT - case - needs interface method
- ((SocketFactoryContactInfoImpl)contactInfo).socketInfo;
- try {
- socket =
- orb.getORBData().getLegacySocketFactory().createSocket(socketInfo);
- socketChannel = socket.getChannel();
- if (socketChannel != null) {
- socketChannel.configureBlocking(isBlocking);
- } else {
- // IMPORTANT: non-channel-backed sockets must use
- // dedicated reader threads.
- setUseSelectThreadToWait(false);
- }
- if (orb.transportDebugFlag) {
- dprint(".initialize: connection created: " + socket);
- }
- } catch (GetEndPointInfoAgainException ex) {
- throw wrapper.connectFailure(
- ex, socketInfo.getType(), socketInfo.getHost(),
- Integer.toString(socketInfo.getPort())) ;
- } catch (Exception ex) {
- throw wrapper.connectFailure(
- ex, socketInfo.getType(), socketInfo.getHost(),
- Integer.toString(socketInfo.getPort())) ;
- }
- state = OPENING;
- }
-
- public String toString()
- {
- synchronized ( stateEvent ){
- return
- "SocketFactoryConnectionImpl[" + " "
- + (socketChannel == null ?
- socket.toString() : socketChannel.toString()) + " "
- + getStateString( state ) + " "
- + shouldUseSelectThreadToWait() + " "
- + shouldUseWorkerThreadForEvent()
- + "]" ;
- }
- }
-
- // Note: public to override parent.
- public void dprint(String msg)
- {
- ORBUtility.dprint("SocketFactoryConnectionImpl", msg);
- }
-
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoImpl.java b/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoImpl.java
deleted file mode 100644
index 52d287e..0000000
--- a/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoImpl.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, 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.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import com.sun.corba.se.pept.transport.Connection;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.transport.CorbaContactInfoList;
-import com.sun.corba.se.spi.transport.SocketInfo;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl;
-
-
-/**
- * @author Harold Carr
- */
-public class SocketFactoryContactInfoImpl
- extends
- SocketOrChannelContactInfoImpl
-{
- protected ORBUtilSystemException wrapper;
- protected SocketInfo socketInfo;
-
- // XREVISIT
- // See SocketOrChannelAcceptorImpl.createMessageMediator
- // See SocketFactoryContactInfoImpl.constructor()
- // See SocketOrChannelContactInfoImpl.constructor()
- public SocketFactoryContactInfoImpl()
- {
- }
-
- public SocketFactoryContactInfoImpl(
- ORB orb,
- CorbaContactInfoList contactInfoList,
- IOR effectiveTargetIOR,
- short addressingDisposition,
- SocketInfo cookie)
- {
- super(orb, contactInfoList);
- this.effectiveTargetIOR = effectiveTargetIOR;
- this.addressingDisposition = addressingDisposition;
-
- wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_TRANSPORT ) ;
-
- socketInfo =
- orb.getORBData().getLegacySocketFactory()
- .getEndPointInfo(orb, effectiveTargetIOR, cookie);
-
- socketType = socketInfo.getType();
- hostname = socketInfo.getHost();
- port = socketInfo.getPort();
- }
-
- ////////////////////////////////////////////////////
- //
- // pept.transport.ContactInfo
- //
-
- public Connection createConnection()
- {
- Connection connection =
- new SocketFactoryConnectionImpl(
- orb, this,
- orb.getORBData().connectionSocketUseSelectThreadToWait(),
- orb.getORBData().connectionSocketUseWorkerThreadForEvent());
- return connection;
- }
-
- ////////////////////////////////////////////////////
- //
- // java.lang.Object
- //
-
- public String toString()
- {
- return
- "SocketFactoryContactInfoImpl["
- + socketType + " "
- + hostname + " "
- + port
- + "]";
- }
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListImpl.java b/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListImpl.java
deleted file mode 100644
index 4f209d0..0000000
--- a/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListImpl.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import java.util.Iterator;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.transport.CorbaContactInfoListImpl;
-import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl;
-
-/**
- * @author Harold Carr
- */
-public class SocketFactoryContactInfoListImpl
- extends
- CorbaContactInfoListImpl
-{
- // XREVISIT - is this used?
- public SocketFactoryContactInfoListImpl(ORB orb)
- {
- super(orb);
- }
-
- public SocketFactoryContactInfoListImpl(ORB orb, IOR targetIOR)
- {
- super(orb, targetIOR);
- }
-
- ////////////////////////////////////////////////////
- //
- // pept.transport.ContactInfoList
- //
-
- public Iterator iterator()
- {
- return new SocketFactoryContactInfoListIteratorImpl(orb, this);
- }
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java b/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java
deleted file mode 100644
index 63081b1..0000000
--- a/src/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, 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.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.SystemException;
-
-import com.sun.corba.se.pept.transport.ContactInfo;
-
-import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.transport.CorbaContactInfo;
-import com.sun.corba.se.spi.transport.CorbaContactInfoList;
-import com.sun.corba.se.spi.transport.SocketInfo;
-
-import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl;
-import com.sun.corba.se.impl.transport.SharedCDRContactInfoImpl;
-
-public class SocketFactoryContactInfoListIteratorImpl
- extends CorbaContactInfoListIteratorImpl
-{
- private SocketInfo socketInfoCookie;
-
- public SocketFactoryContactInfoListIteratorImpl(
- ORB orb,
- CorbaContactInfoList corbaContactInfoList)
- {
- super(orb, corbaContactInfoList, null, null);
- }
-
- ////////////////////////////////////////////////////
- //
- // java.util.Iterator
- //
-
- public boolean hasNext()
- {
- return true;
- }
-
- public Object next()
- {
- if (contactInfoList.getEffectiveTargetIOR().getProfile().isLocal()){
- return new SharedCDRContactInfoImpl(
- orb, contactInfoList,
- contactInfoList.getEffectiveTargetIOR(),
- orb.getORBData().getGIOPAddressDisposition());
- } else {
- // REVISIT:
- // on comm_failure maybe need to give IOR instead of located.
- return new SocketFactoryContactInfoImpl(
- orb, contactInfoList,
- contactInfoList.getEffectiveTargetIOR(),
- orb.getORBData().getGIOPAddressDisposition(),
- socketInfoCookie);
- }
- }
-
- ////////////////////////////////////////////////////
- //
- // pept.ContactInfoListIterator
- //
-
- public boolean reportException(ContactInfo contactInfo,
- RuntimeException ex)
- {
- this.failureContactInfo = (CorbaContactInfo)contactInfo;
- this.failureException = ex;
- if (ex instanceof org.omg.CORBA.COMM_FAILURE) {
-
- if (ex.getCause() instanceof GetEndPointInfoAgainException) {
- socketInfoCookie =
- ((GetEndPointInfoAgainException) ex.getCause())
- .getEndPointInfo();
- return true;
- }
-
- SystemException se = (SystemException) ex;
- if (se.completed == CompletionStatus.COMPLETED_NO) {
- if (contactInfoList.getEffectiveTargetIOR() !=
- contactInfoList.getTargetIOR())
- {
- // retry from root ior
- contactInfoList.setEffectiveTargetIOR(
- contactInfoList.getTargetIOR());
- return true;
- }
- }
- }
- return false;
- }
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/legacy/connection/USLPort.java b/src/share/classes/com/sun/corba/se/impl/legacy/connection/USLPort.java
deleted file mode 100644
index fb50957..0000000
--- a/src/share/classes/com/sun/corba/se/impl/legacy/connection/USLPort.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-public class USLPort
-{
- private String type;
- private int port;
-
- public USLPort (String type, int port)
- {
- this.type = type;
- this.port = port;
- }
-
- public String getType () { return type; }
- public int getPort () { return port; }
- public String toString () { return type + ":" + port; }
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoFactoryImpl.java b/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoFactoryImpl.java
deleted file mode 100644
index 087fc1f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoFactoryImpl.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.monitoring;
-
-import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfoFactory;
-import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfo;
-
-public class MonitoredAttributeInfoFactoryImpl
- implements MonitoredAttributeInfoFactory
-{
- public MonitoredAttributeInfo createMonitoredAttributeInfo(
- String description, Class type, boolean isWritable,
- boolean isStatistic )
- {
- return new MonitoredAttributeInfoImpl( description, type,
- isWritable, isStatistic );
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoImpl.java b/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoImpl.java
deleted file mode 100644
index 3b7539e..0000000
--- a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoImpl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.monitoring;
-
-import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfo;
-
-public class MonitoredAttributeInfoImpl implements MonitoredAttributeInfo {
- private final String description;
- private final Class type;
- private final boolean writableFlag, statisticFlag;
-
- MonitoredAttributeInfoImpl( String description, Class type,
- boolean isWritable, boolean isStatistic )
- {
- this.description = description;
- this.type = type;
- this.writableFlag = isWritable;
- this.statisticFlag = isStatistic;
- }
-
- public String getDescription( ) {
- return this.description;
- }
-
- public Class type( ) {
- return this.type;
- }
-
- public boolean isWritable( ) {
- return this.writableFlag;
- }
-
- public boolean isStatistic( ) {
- return this.statisticFlag;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectFactoryImpl.java b/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectFactoryImpl.java
deleted file mode 100644
index 3e99aff..0000000
--- a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectFactoryImpl.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.monitoring;
-
-import com.sun.corba.se.spi.monitoring.MonitoredObjectFactory;
-import com.sun.corba.se.spi.monitoring.MonitoredObject;
-
-public class MonitoredObjectFactoryImpl implements MonitoredObjectFactory {
-
- public MonitoredObject createMonitoredObject( String name,
- String description )
- {
- return new MonitoredObjectImpl( name, description );
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectImpl.java b/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectImpl.java
deleted file mode 100644
index edec5b7..0000000
--- a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectImpl.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.monitoring;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collection;
-import java.util.Iterator;
-
-import com.sun.corba.se.spi.monitoring.MonitoredObject;
-import com.sun.corba.se.spi.monitoring.MonitoredAttribute;
-
-public class MonitoredObjectImpl implements MonitoredObject {
- private final String name;
- private final String description;
-
- // List of all child Monitored Objects
- private Map children = new HashMap();
-
- // All the Attributes of this Monitored Object instance
- private Map monitoredAttributes = new HashMap();
-
- private MonitoredObject parent = null;
-
-
- // Constructor
- MonitoredObjectImpl( String name, String description ) {
- this.name = name;
- this.description = description;
- }
-
- public MonitoredObject getChild( String name ) {
- synchronized( this ) {
- return (MonitoredObject) children.get( name );
- }
- }
-
- public Collection getChildren( ) {
- synchronized( this ) {
- return children.values();
- }
- }
-
- public void addChild( MonitoredObject m ) {
- if (m != null){
- synchronized( this ) {
- children.put( m.getName(), m);
- m.setParent( this );
- }
- }
- }
-
- public void removeChild( String name ) {
- if (name != null){
- synchronized( this ) {
- children.remove( name );
- }
- }
- }
-
- public synchronized MonitoredObject getParent( ) {
- return parent;
- }
-
- public synchronized void setParent( MonitoredObject p ) {
- parent = p;
- }
-
- public MonitoredAttribute getAttribute( String name ) {
- synchronized( this ) {
- return (MonitoredAttribute) monitoredAttributes.get( name );
- }
- }
-
- public Collection getAttributes( ) {
- synchronized( this ) {
- return monitoredAttributes.values();
- }
- }
-
- public void addAttribute( MonitoredAttribute value ) {
- if (value != null) {
- synchronized( this ) {
- monitoredAttributes.put( value.getName(), value );
- }
- }
- }
-
- public void removeAttribute( String name ) {
- if (name != null) {
- synchronized( this ) {
- monitoredAttributes.remove( name );
- }
- }
- }
-
- /**
- * calls clearState() on all the registered children MonitoredObjects and
- * MonitoredAttributes.
- */
- public void clearState( ) {
- synchronized( this ) {
- Iterator i = monitoredAttributes.values().iterator();
- // First call clearState on all the local attributes
- while( i.hasNext( ) ) {
- ((MonitoredAttribute)i.next()).clearState();
- }
- i = children.values().iterator();
- // next call clearState on all the children MonitoredObjects
- while( i.hasNext() ) {
- ((MonitoredObject)i.next()).clearState();
- }
- }
- }
-
- public String getName( ) {
- return name;
- }
-
- public String getDescription( ) {
- return description;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerFactoryImpl.java b/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerFactoryImpl.java
deleted file mode 100644
index a88d2f2..0000000
--- a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerFactoryImpl.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.monitoring;
-
-import java.util.HashMap;
-import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory;
-import com.sun.corba.se.spi.monitoring.MonitoringManager;
-
-public class MonitoringManagerFactoryImpl implements MonitoringManagerFactory {
-
- private HashMap monitoringManagerTable = new HashMap();
-
- public synchronized MonitoringManager createMonitoringManager(
- String nameOfTheRoot, String description)
- {
- MonitoringManagerImpl m = null;
- m = (MonitoringManagerImpl)monitoringManagerTable.get(nameOfTheRoot);
- if (m == null) {
- m = new MonitoringManagerImpl(nameOfTheRoot, description);
- monitoringManagerTable.put(nameOfTheRoot, m);
- }
- return m;
- }
-
- public synchronized void remove(String nameOfTheRoot) {
- monitoringManagerTable.remove(nameOfTheRoot);
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerImpl.java b/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerImpl.java
deleted file mode 100644
index b7e676e..0000000
--- a/src/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.monitoring;
-
-import com.sun.corba.se.spi.monitoring.MonitoringManager;
-import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory;
-import com.sun.corba.se.spi.monitoring.MonitoredObject;
-import com.sun.corba.se.spi.monitoring.MonitoredObjectFactory;
-import com.sun.corba.se.spi.monitoring.MonitoringFactories;
-
-public class MonitoringManagerImpl implements MonitoringManager {
- private final MonitoredObject rootMonitoredObject;
-
- MonitoringManagerImpl(String nameOfTheRoot, String description) {
- MonitoredObjectFactory f =
- MonitoringFactories.getMonitoredObjectFactory();
- rootMonitoredObject =
- f.createMonitoredObject(nameOfTheRoot, description);
- }
-
- public void clearState() {
- rootMonitoredObject.clearState();
- }
-
- public MonitoredObject getRootMonitoredObject() {
- return rootMonitoredObject;
- }
-
- public void close() {
- MonitoringManagerFactory f =
- MonitoringFactories.getMonitoringManagerFactory();
- f.remove(rootMonitoredObject.getName());
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/BindingIteratorImpl.java b/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/BindingIteratorImpl.java
deleted file mode 100644
index 956d41b..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/BindingIteratorImpl.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-// Import general CORBA classes
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.Object;
-
-// Import org.omg.CosNaming classes
-import org.omg.CosNaming.Binding;
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingHolder;
-import org.omg.CosNaming.BindingListHolder;
-import org.omg.CosNaming.BindingIteratorHolder;
-import org.omg.CosNaming.BindingIteratorPOA;
-import org.omg.CORBA.BAD_PARAM;
-
-/**
- * Class BindingIteratorImpl implements the org.omg.CosNaming::BindingIterator
- * interface, but does not implement the method to retrieve the next
- * binding in the NamingContext for which it was created. This is left
- * to a subclass, which is why this class is abstract; BindingIteratorImpl
- * provides an implementation of the interface operations on top of two
- * subclass methods, allowing multiple implementations of iterators that
- * differ in storage and access to the contents of a NamingContext
- * implementation.
- * <p>
- * The operation next_one() is implemented by the subclass, whereas
- * next_n() is implemented on top of the next_one() implementation.
- * Destroy must also be implemented by the subclass.
- * <p>
- * A subclass must implement NextOne() and Destroy(); these
- * methods are invoked from synchronized methods and need therefore
- * not be synchronized themselves.
- */
-public abstract class BindingIteratorImpl extends BindingIteratorPOA
-{
- protected ORB orb ;
-
- /**
- * Create a binding iterator servant.
- * runs the super constructor.
- * @param orb an ORB object.
- * @exception java.lang.Exception a Java exception.
- */
- public BindingIteratorImpl(ORB orb)
- throws java.lang.Exception
- {
- super();
- this.orb = orb ;
- }
-
- /**
- * Return the next binding. It also returns true or false, indicating
- * whether there were more bindings.
- * @param b The Binding as an out parameter.
- * @return true if there were more bindings.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see NextOne
- */
- public synchronized boolean next_one(org.omg.CosNaming.BindingHolder b)
- {
- // NextOne actually returns the next one
- return NextOne(b);
- }
-
- /**
- * Return the next n bindings. It also returns true or false, indicating
- * whether there were more bindings.
- * @param how_many The number of requested bindings in the BindingList.
- * @param bl The BindingList as an out parameter.
- * @return true if there were more bindings.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see NextOne
- */
- public synchronized boolean next_n(int how_many,
- org.omg.CosNaming.BindingListHolder blh)
- {
- if( how_many == 0 ) {
- throw new BAD_PARAM( " 'how_many' parameter is set to 0 which is" +
- " invalid" );
- }
- return list( how_many, blh );
- }
-
- /**
- * lists next n bindings. It returns true or false, indicating
- * whether there were more bindings. This method has the package private
- * scope, It will be called from NamingContext.list() operation or
- * this.next_n().
- * @param how_many The number of requested bindings in the BindingList.
- * @param bl The BindingList as an out parameter.
- * @return true if there were more bindings.
- */
- public boolean list( int how_many, org.omg.CosNaming.BindingListHolder blh)
- {
- // Take the smallest of what's left and what's being asked for
- int numberToGet = Math.min(RemainingElements(),how_many);
-
- // Create a resulting BindingList
- Binding[] bl = new Binding[numberToGet];
- BindingHolder bh = new BindingHolder();
- int i = 0;
- // Keep iterating as long as there are entries
- while (i < numberToGet && this.NextOne(bh) == true) {
- bl[i] = bh.value;
- i++;
- }
- // Found any at all?
- if (i == 0) {
- // No
- blh.value = new Binding[0];
- return false;
- }
-
- // Set into holder
- blh.value = bl;
-
- return true;
- }
-
-
-
-
- /**
- * Destroy this BindingIterator object. The object corresponding to this
- * object reference is destroyed.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see Destroy
- */
- public synchronized void destroy()
- {
- // Destroy actually destroys
- this.Destroy();
- }
-
- /**
- * Abstract method for returning the next binding in the NamingContext
- * for which this BindingIterator was created.
- * @param b The Binding as an out parameter.
- * @return true if there were more bindings.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- protected abstract boolean NextOne(org.omg.CosNaming.BindingHolder b);
-
- /**
- * Abstract method for destroying this BindingIterator.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- protected abstract void Destroy();
-
- /**
- * Abstract method for returning the remaining number of elements.
- * @return the remaining number of elements in the iterator.
- */
- protected abstract int RemainingElements();
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/InterOperableNamingImpl.java b/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/InterOperableNamingImpl.java
deleted file mode 100644
index 74a44a9..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/InterOperableNamingImpl.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-import org.omg.CosNaming.NamingContextExtPackage.*;
-import java.io.StringWriter;
-
-// Import general CORBA classes
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.Object;
-
-// Import org.omg.CosNaming types
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-
-
-/**
- * Class InteroperableNamingImpl implements the methods defined
- * for NamingContextExt which is part of Interoperable Naming
- * Service specifications. This class is added for doing more
- * of Parsing and Building of Stringified names according to INS
- * Spec.
- */
-public class InterOperableNamingImpl
-{
- /**
- * Method which stringifies the Name Components given as the input
- * parameter.
- *
- * @param n Array of Name Components (Simple or Compound Names)
- * @return string which is the stringified reference.
- */
- public String convertToString( org.omg.CosNaming.NameComponent[]
- theNameComponents )
- {
- String theConvertedString =
- convertNameComponentToString( theNameComponents[0] );
- String temp;
- for( int i = 1; i < theNameComponents.length; i++ ) {
- temp = convertNameComponentToString( theNameComponents[i] );
- if( temp != null ) {
- theConvertedString =
- theConvertedString + "/" + convertNameComponentToString(
- theNameComponents[i] );
- }
- }
- return theConvertedString;
- }
-
- /** This method converts a single Namecomponent to String, By adding Escapes
- * If neccessary.
- */
- private String convertNameComponentToString(
- org.omg.CosNaming.NameComponent theNameComponent )
- {
- if( ( ( theNameComponent.id == null )
- ||( theNameComponent.id.length() == 0 ) )
- &&( ( theNameComponent.kind == null )
- ||( theNameComponent.kind.length() == 0 ) ) )
- {
- return ".";
- }
- else if( ( theNameComponent.id == null )
- ||( theNameComponent.id.length() == 0 ) )
- {
- String kind = addEscape( theNameComponent.kind );
- return "." + kind;
- }
- else if( ( theNameComponent.kind == null )
- ||( theNameComponent.kind.length() == 0 ) )
- {
- String id = addEscape( theNameComponent.id );
- return id;
- }
- else {
- String id = addEscape( theNameComponent.id );
- String kind = addEscape( theNameComponent.kind );
- return (id + "." + kind);
- }
- }
-
-
- /** This method adds escape '\' for the Namecomponent if neccessary
- */
- private String addEscape( String value )
- {
- StringBuffer theNewValue;
- if( (value != null) && ( (value.indexOf('.') != -1 ) ||
- (value.indexOf('/') != -1)))
- {
- char c;
- theNewValue = new StringBuffer( );
- for( int i = 0; i < value.length( ); i++ ) {
- c = value.charAt( i );
- if( ( c != '.' ) && (c != '/' ) )
- {
- theNewValue.append( c );
- }
- else {
- // Adding escape for the "."
- theNewValue.append( '\\' );
- theNewValue.append( c );
- }
- }
- }
- else {
- return value;
- }
- return new String( theNewValue );
- }
-
- /**
- * Method which converts the Stringified name into Array of Name Components.
- *
- * @param string which is the stringified name.
- * @return Array of Name Components (Simple or Compound Names)
- */
- public org.omg.CosNaming.NameComponent[] convertToNameComponent(
- String theStringifiedName )
- throws org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- String[] theStringifiedNameComponents =
- breakStringToNameComponents( theStringifiedName );
- if( ( theStringifiedNameComponents == null )
- || (theStringifiedNameComponents.length == 0 ) )
- {
- return null;
- }
- NameComponent[] theNameComponents =
- new NameComponent[theStringifiedNameComponents.length];
- for( int i = 0; i < theStringifiedNameComponents.length; i++ ) {
- theNameComponents[i] = createNameComponentFromString(
- theStringifiedNameComponents[i] );
- }
- return theNameComponents;
- }
-
- /** Step1 in converting Stringified name into array of Name Component
- * is breaking the String into multiple name components
- */
- private String[] breakStringToNameComponents( String theStringifiedName ) {
- int[] theIndices = new int[100];
- int theIndicesIndex = 0;
-
- for(int index = 0; index <= theStringifiedName.length(); ) {
- theIndices[theIndicesIndex] = theStringifiedName.indexOf( '/',
- index );
- if( theIndices[theIndicesIndex] == -1 ) {
- // This is the end of all the occurence of '/' and hence come
- // out of the loop
- index = theStringifiedName.length()+1;
- }
- else {
- // If the '/' is found, first check whether it is
- // preceded by escape '\'
- // If not then set theIndices and increment theIndicesIndex
- // and also set the index else just ignore the '/'
- if( (theIndices[theIndicesIndex] > 0 )
- && (theStringifiedName.charAt(
- theIndices[theIndicesIndex]-1) == '\\') )
- {
- index = theIndices[theIndicesIndex] + 1;
- theIndices[theIndicesIndex] = -1;
- }
- else {
- index = theIndices[theIndicesIndex] + 1;
- theIndicesIndex++;
- }
- }
- }
- if( theIndicesIndex == 0 ) {
- String[] tempString = new String[1];
- tempString[0] = theStringifiedName;
- return tempString;
- }
- if( theIndicesIndex != 0 ) {
- theIndicesIndex++;
- }
- return StringComponentsFromIndices( theIndices, theIndicesIndex,
- theStringifiedName );
- }
-
- /** This method breaks one big String into multiple substrings based
- * on the array of index passed in.
- */
- private String[] StringComponentsFromIndices( int[] theIndices,
- int indicesCount, String theStringifiedName )
- {
- String[] theStringComponents = new String[indicesCount];
- int firstIndex = 0;
- int lastIndex = theIndices[0];
- for( int i = 0; i < indicesCount; i++ ) {
- theStringComponents[i] = theStringifiedName.substring( firstIndex,
- lastIndex );
- if( ( theIndices[i] < theStringifiedName.length() - 1 )
- &&( theIndices[i] != -1 ) )
- {
- firstIndex = theIndices[i]+1;
- }
- else {
- firstIndex = 0;
- i = indicesCount;
- }
- if( (i+1 < theIndices.length)
- && (theIndices[i+1] < (theStringifiedName.length() - 1))
- && (theIndices[i+1] != -1) )
- {
- lastIndex = theIndices[i+1];
- }
- else {
- i = indicesCount;
- }
- // This is done for the last component
- if( firstIndex != 0 && i == indicesCount ) {
- theStringComponents[indicesCount-1] =
- theStringifiedName.substring( firstIndex );
- }
- }
- return theStringComponents;
- }
-
- /** Step 2: After Breaking the Stringified name into set of NameComponent
- * Strings, The next step is to create Namecomponents from the substring
- * by removing the escapes if there are any.
- */
- private NameComponent createNameComponentFromString(
- String theStringifiedNameComponent )
- throws org.omg.CosNaming.NamingContextPackage.InvalidName
-
- {
- String id = null;
- String kind = null;
- if( ( theStringifiedNameComponent == null )
- || ( theStringifiedNameComponent.length( ) == 0)
- || ( theStringifiedNameComponent.endsWith(".") ) )
- {
- // If any of the above is true, then we create an invalid Name
- // Component to indicate that it is an invalid name.
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName( );
- }
-
- int index = theStringifiedNameComponent.indexOf( '.', 0 );
- // The format could be XYZ (Without kind)
- if( index == -1 ) {
- id = theStringifiedNameComponent;
- }
- // The format is .XYZ (Without ID)
- else if( index == 0 ) {
- // This check is for the Namecomponent which is just "." meaning Id
- // and Kinds are null
- if( theStringifiedNameComponent.length( ) != 1 ) {
- kind = theStringifiedNameComponent.substring(1);
- }
- }
- else
- {
- if( theStringifiedNameComponent.charAt(index-1) != '\\' ) {
- id = theStringifiedNameComponent.substring( 0, index);
- kind = theStringifiedNameComponent.substring( index + 1 );
- }
- else {
- boolean kindfound = false;
- while( (index < theStringifiedNameComponent.length() )
- &&( kindfound != true ) )
- {
- index = theStringifiedNameComponent.indexOf( '.',index + 1);
- if( index > 0 ) {
- if( theStringifiedNameComponent.charAt(
- index - 1 ) != '\\' )
- {
- kindfound = true;
- }
- }
- else
- {
- // No more '.', which means there is no Kind
- index = theStringifiedNameComponent.length();
- }
- }
- if( kindfound == true ) {
- id = theStringifiedNameComponent.substring( 0, index);
- kind = theStringifiedNameComponent.substring(index + 1 );
- }
- else {
- id = theStringifiedNameComponent;
- }
- }
- }
- id = cleanEscapeCharacter( id );
- kind = cleanEscapeCharacter( kind );
- if( id == null ) {
- id = "";
- }
- if( kind == null ) {
- kind = "";
- }
- return new NameComponent( id, kind );
- }
-
-
- /** This method cleans the escapes in the Stringified name and returns the
- * correct String
- */
- private String cleanEscapeCharacter( String theString )
- {
- if( ( theString == null ) || (theString.length() == 0 ) ) {
- return theString;
- }
- int index = theString.indexOf( '\\' );
- if( index == 0 ) {
- return theString;
- }
- else {
- StringBuffer src = new StringBuffer( theString );
- StringBuffer dest = new StringBuffer( );
- char c;
- for( int i = 0; i < theString.length( ); i++ ) {
- c = src.charAt( i );
- if( c != '\\' ) {
- dest.append( c );
- } else {
- if( i+1 < theString.length() ) {
- char d = src.charAt( i + 1 );
- // If there is a AlphaNumeric character after a \
- // then include slash, as it is not intended as an
- // escape character.
- if( Character.isLetterOrDigit(d) ) {
- dest.append( c );
- }
- }
- }
- }
- return new String(dest);
- }
- }
-
- /**
- * Method which converts the Stringified name and Host Name Address into
- * a URL based Name
- *
- * @param address which is ip based host name
- * @param name which is the stringified name.
- * @return url based Name.
- */
- public String createURLBasedAddress( String address, String name )
- throws InvalidAddress
- {
- String theurl = null;
- if( ( address == null )
- ||( address.length() == 0 ) ) {
- throw new InvalidAddress();
- }
- else {
- theurl = "corbaname:" + address + "#" + encode( name );
- }
- return theurl;
- }
-
- /** Encodes the string according to RFC 2396 IETF spec required by INS.
- */
- private String encode( String stringToEncode ) {
- StringWriter theStringAfterEscape = new StringWriter();
- int byteCount = 0;
- for( int i = 0; i < stringToEncode.length(); i++ )
- {
- char c = stringToEncode.charAt( i ) ;
- if( Character.isLetterOrDigit( c ) ) {
- theStringAfterEscape.write( c );
- }
- // Do no Escape for characters in this list
- // RFC 2396
- else if((c == ';') || (c == '/') || (c == '?')
- || (c == ':') || (c == '@') || (c == '&') || (c == '=')
- || (c == '+') || (c == '$') || (c == ';') || (c == '-')
- || (c == '_') || (c == '.') || (c == '!') || (c == '~')
- || (c == '*') || (c == ' ') || (c == '(') || (c == ')') )
- {
- theStringAfterEscape.write( c );
- }
- else {
- // Add escape
- theStringAfterEscape.write( '%' );
- String hexString = Integer.toHexString( (int) c );
- theStringAfterEscape.write( hexString );
- }
- }
- return theStringAfterEscape.toString();
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingKey.java b/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingKey.java
deleted file mode 100644
index 8385c6c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingKey.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-import org.omg.CosNaming.NameComponent;
-
-/**
- * Class InternalBindingKey implements the necessary wrapper code
- * around the org.omg.CosNaming::NameComponent class to implement the proper
- * equals() method and the hashCode() method for use in a hash table.
- * It computes the hashCode once and stores it, and also precomputes
- * the lengths of the id and kind strings for faster comparison.
- */
-public class InternalBindingKey
-{
- // A key contains a name
- public NameComponent name;
- private int idLen;
- private int kindLen;
- private int hashVal;
-
- // Default Constructor
- public InternalBindingKey() {}
-
- // Normal constructor
- public InternalBindingKey(NameComponent n)
- {
- idLen = 0;
- kindLen = 0;
- setup(n);
- }
-
- // Setup the object
- protected void setup(NameComponent n) {
- this.name = n;
- // Precompute lengths and values since they will not change
- if( this.name.id != null ) {
- idLen = this.name.id.length();
- }
- if( this.name.kind != null ) {
- kindLen = this.name.kind.length();
- }
- hashVal = 0;
- if (idLen > 0)
- hashVal += this.name.id.hashCode();
- if (kindLen > 0)
- hashVal += this.name.kind.hashCode();
- }
-
- // Compare the keys by comparing name's id and kind
- public boolean equals(java.lang.Object o) {
- if (o == null)
- return false;
- if (o instanceof InternalBindingKey) {
- InternalBindingKey that = (InternalBindingKey)o;
- // Both lengths must match
- if (this.idLen != that.idLen || this.kindLen != that.kindLen) {
- return false;
- }
- // If id is set is must be equal
- if (this.idLen > 0 && this.name.id.equals(that.name.id) == false) {
- return false;
- }
- // If kind is set it must be equal
- if (this.kindLen > 0 && this.name.kind.equals(that.name.kind) == false) {
- return false;
- }
- // Must be the same
- return true;
- } else {
- return false;
- }
- }
- // Return precomputed value
- public int hashCode() {
- return this.hashVal;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingValue.java b/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingValue.java
deleted file mode 100644
index cf6322b..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingValue.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-import org.omg.CORBA.Object;
-import org.omg.CosNaming.Binding;
-import org.omg.CosNaming.NameComponent;
-
-/**
- * Class InternalBindingKey acts as a container for two objects, namely
- * a org.omg.CosNaming::Binding and an CORBA object reference, which are the two
- * components associated with the binding.
- */
-public class InternalBindingValue
-{
- public Binding theBinding;
- public String strObjectRef;
- public org.omg.CORBA.Object theObjectRef;
-
- // Default constructor
- public InternalBindingValue() {}
-
- // Normal constructor
- public InternalBindingValue(Binding b, String o) {
- theBinding = b;
- strObjectRef = o;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextDataStore.java b/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextDataStore.java
deleted file mode 100644
index 042f3a9..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextDataStore.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-// Import general CORBA classes
-import org.omg.CORBA.Object;
-
-// Import org.omg.CosNaming classes
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingTypeHolder;
-import org.omg.CosNaming.BindingListHolder;
-import org.omg.CosNaming.BindingIteratorHolder;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-import org.omg.PortableServer.POA;
-
-/**
- * This interface defines a set of methods that must be implemented by the
- * "data store" associated with a NamingContext implementation.
- * It allows for different implementations of naming contexts that
- * support the same API but differ in storage mechanism.
- */
-public interface NamingContextDataStore {
- /**
- * Method which implements binding a name to an object as
- * the specified binding type.
- * @param n a NameComponent which is the name under which the object
- * will be bound.
- * @param obj the object reference to be bound.
- * @param bt Type of binding (as object or as context).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- void Bind(NameComponent n, org.omg.CORBA.Object obj, BindingType bt)
- throws org.omg.CORBA.SystemException;
-
- /**
- * Method which implements resolving the specified name,
- * returning the type of the binding and the bound object reference.
- * If the id and kind of the NameComponent are both empty, the initial
- * naming context (i.e., the local root) must be returned.
- * @param n a NameComponent which is the name to be resolved.
- * @param bth the BindingType as an out parameter.
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- org.omg.CORBA.Object Resolve(NameComponent n,BindingTypeHolder bth)
- throws org.omg.CORBA.SystemException;
-
- /**
- * Method which implements unbinding a name.
- * @return the object reference bound to the name, or null if not found.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- org.omg.CORBA.Object Unbind(NameComponent n)
- throws org.omg.CORBA.SystemException;
-
- /**
- * Method which implements listing the contents of this
- * NamingContext and return a binding list and a binding iterator.
- * @param how_many The number of requested bindings in the BindingList.
- * @param bl The BindingList as an out parameter.
- * @param bi The BindingIterator as an out parameter.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- void List(int how_many, BindingListHolder bl, BindingIteratorHolder bi)
- throws org.omg.CORBA.SystemException;
-
- /**
- * Method which implements creating a new NamingContext.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- NamingContext NewContext()
- throws org.omg.CORBA.SystemException;
-
- /**
- * Method which implements destroying this NamingContext.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- void Destroy()
- throws org.omg.CORBA.SystemException;
-
- /**
- * Method which returns whether this NamingContext is empty
- * or not.
- * @return true if this NamingContext contains no bindings.
- */
- boolean IsEmpty();
-
- POA getNSPOA( );
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextImpl.java b/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextImpl.java
deleted file mode 100644
index b591aad..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextImpl.java
+++ /dev/null
@@ -1,1028 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-// Imports for Logging
-import java.util.logging.Logger;
-import java.util.logging.Level;
-import com.sun.corba.se.impl.orbutil.LogKeywords;
-
-// Import general CORBA classes
-import org.omg.CORBA.Object;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.Servant;
-
-// Import org.omg.CosNaming classes
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingTypeHolder;
-import org.omg.CosNaming.BindingListHolder;
-import org.omg.CosNaming.BindingIteratorHolder;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContextHelper;
-import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextPackage.*;
-import org.omg.CosNaming._NamingContextImplBase;
-import org.omg.CosNaming.NamingContextExtHelper;
-import org.omg.CosNaming.NamingContextExt;
-import org.omg.CosNaming.NamingContextExtPOA;
-import org.omg.CosNaming.NamingContextExtPackage.*;
-import org.omg.CosNaming.NamingContextPackage.NotFound;
-
-import com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore;
-
-import com.sun.corba.se.impl.naming.namingutil.INSURLHandler;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.NamingSystemException ;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-/**
- * Class NamingContextImpl implements the org.omg.CosNaming::NamingContext
- * interface, but does not implement the methods associated with
- * maintaining the "table" of current bindings in a NamingContext.
- * Instead, this implementation assumes that the derived implementation
- * implements the NamingContextDataStore interface, which has the necessary
- * methods. This allows multiple
- * NamingContext implementations that differ in storage of the bindings,
- * as well as implementations of interfaces derived from
- * CosNaming::NamingContext that still reuses the implementation.
- * <p>
- * The operations bind(), rebind(), bind_context() and rebind_context()
- * are all really implemented by doBind(). resolve() is really implemented
- * by doResolve(), unbind() by doUnbind(). list(), new_context() and
- * destroy() uses the NamingContextDataStore interface directly. All the
- * doX() methods are public static.
- * They synchronize on the NamingContextDataStore object.
- * <p>
- * An implementation a NamingContext must extend this class and implement
- * the NamingContextDataStore interface with the operations:
- * Bind(), Resolve(),
- * Unbind(), List(), NewContext() and Destroy(). Calls
- * to these methods are synchronized; these methods should
- * therefore not be synchronized.
- */
-public abstract class NamingContextImpl
- extends NamingContextExtPOA
- implements NamingContextDataStore
-{
-
- protected POA nsPOA;
- private Logger readLogger, updateLogger, lifecycleLogger;
- private NamingSystemException wrapper ;
- private static NamingSystemException staticWrapper =
- NamingSystemException.get( CORBALogDomains.NAMING_UPDATE ) ;
-
- // The grammer for Parsing and Building Interoperable Stringified Names
- // are implemented in this class
- private InterOperableNamingImpl insImpl;
- /**
- * Create a naming context servant.
- * Runs the super constructor.
- * @param orb an ORB object.
- * @exception java.lang.Exception a Java exception.
- */
- public NamingContextImpl(ORB orb, POA poa) throws java.lang.Exception {
- super();
- this.orb = orb;
- wrapper = NamingSystemException.get( orb,
- CORBALogDomains.NAMING_UPDATE ) ;
-
- insImpl = new InterOperableNamingImpl( );
- this.nsPOA = poa;
- readLogger = orb.getLogger( CORBALogDomains.NAMING_READ);
- updateLogger = orb.getLogger( CORBALogDomains.NAMING_UPDATE);
- lifecycleLogger = orb.getLogger(
- CORBALogDomains.NAMING_LIFECYCLE);
- }
-
- public POA getNSPOA( ) {
- return nsPOA;
- }
-
- /**
- * Bind an object under a name in this NamingContext. If the name
- * contains multiple (n) components, n-1 will be resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * An exception is thrown if a binding with the supplied name already
- * exists. If the
- * object to be bound is a NamingContext it will not participate in
- * a recursive resolve.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could
- * not proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
- * is already bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see doBind
- */
- public void bind(NameComponent[] n, org.omg.CORBA.Object obj)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound
- {
- if( obj == null )
- {
- updateLogger.warning( LogKeywords.NAMING_BIND +
- " unsuccessful because NULL Object cannot be Bound " );
- throw wrapper.objectIsNull() ;
- }
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,obj,false,BindingType.nobject);
- if( updateLogger.isLoggable( Level.FINE ) ) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS + " Name = " +
- NamingUtils.getDirectoryStructuredName( n ) );
- }
- }
-
-
- /**
- * Bind a NamingContext under a name in this NamingContext. If the name
- * contains multiple (n) components, n-1 will be resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * An exception is thrown if a binding with the supplied name already
- * exists. The NamingContext will participate in recursive resolving.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the NamingContect object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could
- * not proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
- * is already bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see doBind
- */
- public void bind_context(NameComponent[] n, NamingContext nc)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound
- {
- if( nc == null ) {
- updateLogger.warning( LogKeywords.NAMING_BIND_FAILURE +
- " NULL Context cannot be Bound " );
- throw new BAD_PARAM( "Naming Context should not be null " );
- }
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,nc,false,BindingType.ncontext);
- if( updateLogger.isLoggable( Level.FINE ) ) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS + " Name = " +
- NamingUtils.getDirectoryStructuredName( n ) );
- }
- }
-
- /**
- * Bind an object under a name in this NamingContext. If the name
- * contains multiple (n) components, n-1 will be resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * If a binding under the supplied name already exists it will be
- * unbound first. If the
- * object to be bound is a NamingContext it will not participate in
- * a recursive resolve.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
- * proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see doBind
- */
- public void rebind(NameComponent[] n, org.omg.CORBA.Object obj)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- if( obj == null )
- {
- updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
- " NULL Object cannot be Bound " );
- throw wrapper.objectIsNull() ;
- }
- try {
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,obj,true,BindingType.nobject);
- } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
- updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
- NamingUtils.getDirectoryStructuredName( n ) +
- " is already bound to a Naming Context" );
- // This should not happen
- throw wrapper.namingCtxRebindAlreadyBound( ex ) ;
- }
- if( updateLogger.isLoggable( Level.FINE ) ) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
- NamingUtils.getDirectoryStructuredName( n ) );
- }
- }
-
- /**
- * Bind a NamingContext under a name in this NamingContext. If the name
- * contains multiple (n) components, the first n-1 components will be
- * resolved in this NamingContext and the object bound in resulting
- * NamingContext. If a binding under the supplied name already exists it
- * will be unbound first. The NamingContext will participate in recursive
- * resolving.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
- * proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see doBind
- */
- public void rebind_context(NameComponent[] n, NamingContext nc)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- if( nc == null )
- {
- updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
- " NULL Context cannot be Bound " );
- throw wrapper.objectIsNull() ;
- }
- try {
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,nc,true,BindingType.ncontext);
- } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
- // This should not happen
- updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
- NamingUtils.getDirectoryStructuredName( n ) +
- " is already bound to a CORBA Object" );
- throw wrapper.namingCtxRebindctxAlreadyBound( ex ) ;
- }
- if( updateLogger.isLoggable( Level.FINE ) ) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
- NamingUtils.getDirectoryStructuredName( n ) );
- }
- }
-
- /**
- * Resolve a name in this NamingContext and return the object reference
- * bound to the name. If the name contains multiple (n) components,
- * the first component will be resolved in this NamingContext and the
- * remaining components resolved in the resulting NamingContext, provided
- * that the NamingContext bound to the first component of the name was
- * bound with bind_context().
- * @param n a sequence of NameComponents which is the name to be resolved.
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
- * proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see doResolve
- */
- public org.omg.CORBA.Object resolve(NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // doResolve actually resolves
- NamingContextDataStore impl = (NamingContextDataStore)this;
- org.omg.CORBA.Object obj = doResolve(impl,n);
- if( obj != null ) {
- if( readLogger.isLoggable( Level.FINE ) ) {
- readLogger.fine( LogKeywords.NAMING_RESOLVE_SUCCESS +
- " Name: " + NamingUtils.getDirectoryStructuredName( n ) );
- }
- } else {
- readLogger.warning( LogKeywords.NAMING_RESOLVE_FAILURE +
- " Name: " + NamingUtils.getDirectoryStructuredName( n ) );
- }
- return obj;
- }
-
-
- /**
- * Remove a binding from this NamingContext. If the name contains
- * multiple (n) components, the first n-1 components will be resolved
- * from this NamingContext and the final component unbound in
- * the resulting NamingContext.
- * @param n a sequence of NameComponents which is the name to be unbound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
- * proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see doUnbind
- */
- public void unbind(NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // doUnbind actually unbinds
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doUnbind(impl,n);
- if( updateLogger.isLoggable( Level.FINE ) ) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
- " Name: " + NamingUtils.getDirectoryStructuredName( n ) );
- }
- }
-
- /**
- * List the contents of this NamingContest. A sequence of bindings
- * is returned (a BindingList) containing up to the number of requested
- * bindings, and a BindingIterator object reference is returned for
- * iterating over the remaining bindings.
- * @param how_many The number of requested bindings in the BindingList.
- * @param bl The BindingList as an out parameter.
- * @param bi The BindingIterator as an out parameter.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see BindingListHolder
- * @see BindingIteratorImpl
- */
- public void list(int how_many, BindingListHolder bl,
- BindingIteratorHolder bi)
- {
- // List actually generates the list
- NamingContextDataStore impl = (NamingContextDataStore)this;
- synchronized (impl) {
- impl.List(how_many,bl,bi);
- }
- if( readLogger.isLoggable( Level.FINE ) && (bl.value != null )) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- readLogger.fine ( LogKeywords.NAMING_LIST_SUCCESS +
- "list(" + how_many + ") -> bindings[" + bl.value.length +
- "] + iterator: " + bi.value);
- }
- }
-
- /**
- * Create a NamingContext object and return its object reference.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public synchronized NamingContext new_context()
- {
- // Create actually creates a new naming context
- lifecycleLogger.fine( "Creating New Naming Context " );
- NamingContextDataStore impl = (NamingContextDataStore)this;
- synchronized (impl) {
- NamingContext nctx = impl.NewContext();
- if( nctx != null ) {
- lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
- } else {
- // If naming context is null, then that must be a serious
- // error.
- lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
- }
- return nctx;
- }
- }
-
- /**
- * Create a new NamingContext, bind it in this Naming Context and return
- * its object reference. This is equivalent to using new_context() followed
- * by bind_context() with the supplied name and the object reference for
- * the newly created NamingContext.
- * @param n a sequence of NameComponents which is the name to be unbound.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server, bound to the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
- * is already bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
- * proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see new_context
- * @see bind_context
- */
- public NamingContext bind_new_context(NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- NamingContext nc = null;
- NamingContext rnc = null;
- try {
- if (debug)
- dprint("bind_new_context " + nameToString(n));
- // The obvious solution:
- nc = this.new_context();
- this.bind_context(n,nc);
- rnc = nc;
- nc = null;
- } finally {
- try {
- if(nc != null)
- nc.destroy();
- } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) {
- }
- }
- if( updateLogger.isLoggable( Level.FINE ) ) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- updateLogger.fine ( LogKeywords.NAMING_BIND +
- "New Context Bound To " +
- NamingUtils.getDirectoryStructuredName( n ) );
- }
- return rnc;
- }
-
- /**
- * Destroy this NamingContext object. If this NamingContext contains
- * no bindings, the NamingContext is deleted.
- * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This
- * NamingContext is not empty (i.e., contains bindings).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public void destroy()
- throws org.omg.CosNaming.NamingContextPackage.NotEmpty
- {
- lifecycleLogger.fine( "Destroying Naming Context " );
- NamingContextDataStore impl = (NamingContextDataStore)this;
- synchronized (impl) {
- if (impl.IsEmpty() == true) {
- // The context is empty so it can be destroyed
- impl.Destroy();
- lifecycleLogger.fine ( LogKeywords.LIFECYCLE_DESTROY_SUCCESS );
- }
- else {
- // This context is not empty!
- // Not a fatal error, warning should do.
- lifecycleLogger.warning( LogKeywords.LIFECYCLE_DESTROY_FAILURE +
- " NamingContext children are not destroyed still.." );
- throw new NotEmpty();
- }
- }
- }
-
- /**
- * Implements all four flavors of binding. It uses Resolve() to
- * check if a binding already exists (for bind and bind_context), and
- * unbind() to ensure that a binding does not already exist.
- * If the length of the name is 1, then Bind() is called with
- * the name and the object to bind. Otherwise, the first component
- * of the name is resolved in this NamingContext and the appropriate
- * form of bind passed to the resulting NamingContext.
- * This method is static for maximal reuse - even for extended naming
- * context implementations where the recursive semantics still apply.
- * @param impl an implementation of NamingContextDataStore
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @param rebind Replace an existing binding or not.
- * @param bt Type of binding (as object or as context).
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not * proceed
- * in resolving the first component of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
- * is already bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see resolve
- * @see unbind
- * @see bind
- * @see bind_context
- * @see rebind
- * @see rebind_context
- */
- public static void doBind(NamingContextDataStore impl,
- NameComponent[] n,
- org.omg.CORBA.Object obj,
- boolean rebind,
- org.omg.CosNaming.BindingType bt)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound
- {
- // Valid name?
- if (n.length < 1)
- throw new InvalidName();
-
- // At bottom level?
- if (n.length == 1) {
- // The identifier must be set
- if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) ) {
- throw new InvalidName();
- }
-
- // Ensure synchronization of backend
- synchronized (impl) {
- // Yes: bind object in this context under the name
- BindingTypeHolder bth = new BindingTypeHolder();
- if (rebind) {
- org.omg.CORBA.Object objRef = impl.Resolve( n[0], bth );
- if( objRef != null ) {
- // Refer Naming Service Doc:00-11-01 section 2.2.3.4
- // If there is an object already bound with the name
- // and the binding type is not ncontext a NotFound
- // Exception with a reason of not a context has to be
- // raised.
- // Fix for bug Id: 4384628
- if ( bth.value.value() == BindingType.nobject.value() ){
- if ( bt.value() == BindingType.ncontext.value() ) {
- throw new NotFound(
- NotFoundReason.not_context, n);
- }
- } else {
- // Previously a Context was bound and now trying to
- // bind Object. It is invalid.
- if ( bt.value() == BindingType.nobject.value() ) {
- throw new NotFound(
- NotFoundReason.not_object, n);
- }
- }
- impl.Unbind(n[0]);
- }
-
- } else {
- if (impl.Resolve(n[0],bth) != null)
- // "Resistence is futile." [Borg pickup line]
- throw new AlreadyBound();
- }
-
- // Now there are no other bindings under this name
- impl.Bind(n[0],obj,bt);
- }
- } else {
- // No: bind in a different context
- NamingContext context = resolveFirstAsContext(impl,n);
-
- // Compute tail
- NameComponent[] tail = new NameComponent[n.length - 1];
- System.arraycopy(n,1,tail,0,n.length-1);
-
- // How should we propagate the bind
- switch (bt.value()) {
- case BindingType._nobject:
- {
- // Bind as object
- if (rebind)
- context.rebind(tail,obj);
- else
- context.bind(tail,obj);
- }
- break;
- case BindingType._ncontext:
- {
- // Narrow to a naming context using Java casts. It must
- // work.
- NamingContext objContext = (NamingContext)obj;
- // Bind as context
- if (rebind)
- context.rebind_context(tail,objContext);
- else
- context.bind_context(tail,objContext);
- }
- break;
- default:
- // This should not happen
- throw staticWrapper.namingCtxBadBindingtype() ;
- }
- }
- }
-
- /**
- * Implements resolving names in this NamingContext. The first component
- * of the supplied name is resolved in this NamingContext by calling
- * Resolve(). If there are no more components in the name, the
- * resulting object reference is returned. Otherwise, the resulting object
- * reference must have been bound as a context and be narrowable to
- * a NamingContext. If this is the case, the remaining
- * components of the name is resolved in the resulting NamingContext.
- * This method is static for maximal reuse - even for extended naming
- * context implementations where the recursive semantics still apply.
- * @param impl an implementation of NamingContextDataStore
- * @param n a sequence of NameComponents which is the name to be resolved.
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
- * proceed
- * in resolving the first component of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied
- * name is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system
- * exceptions.
- * @see resolve
- */
- public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl,
- NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- org.omg.CORBA.Object obj = null;
- BindingTypeHolder bth = new BindingTypeHolder();
-
-
- // Length must be greater than 0
- if (n.length < 1)
- throw new InvalidName();
-
- // The identifier must be set
- if (n.length == 1) {
- synchronized (impl) {
- // Resolve first level in this context
- obj = impl.Resolve(n[0],bth);
- }
- if (obj == null) {
- // Object was not found
- throw new NotFound(NotFoundReason.missing_node,n);
- }
- return obj;
- } else {
- // n.length > 1
- if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0) ) {
- throw new InvalidName();
- }
-
- NamingContext context = resolveFirstAsContext(impl,n);
-
- // Compute restOfName = name[1..length]
- NameComponent[] tail = new NameComponent[n.length -1];
- System.arraycopy(n,1,tail,0,n.length-1);
-
- // Resolve rest of name in context
- try {
- // First try to resolve using the local call, this should work
- // most of the time unless there are federated naming contexts.
- Servant servant = impl.getNSPOA().reference_to_servant(
- context );
- return doResolve(((NamingContextDataStore)servant), tail) ;
- } catch( Exception e ) {
- return context.resolve(tail);
- }
- }
- }
-
- /**
- * Implements unbinding bound names in this NamingContext. If the
- * name contains only one component, the name is unbound in this
- * NamingContext using Unbind(). Otherwise, the first component
- * of the name is resolved in this NamingContext and
- * unbind passed to the resulting NamingContext.
- * This method is static for maximal reuse - even for extended naming
- * context implementations where the recursive semantics still apply.
- * @param impl an implementation of NamingContextDataStore
- * @param n a sequence of NameComponents which is the name to be unbound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see resolve
- */
- public static void doUnbind(NamingContextDataStore impl,
- NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if (n.length < 1)
- throw new InvalidName();
-
- // Unbind here?
- if (n.length == 1) {
- // The identifier must be set
- if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) ) {
- throw new InvalidName();
- }
-
- org.omg.CORBA.Object objRef = null;
- synchronized (impl) {
- // Yes: unbind in this context
- objRef = impl.Unbind(n[0]);
- }
-
- if (objRef == null)
- // It was not bound
- throw new NotFound(NotFoundReason.missing_node,n);
- // Done
- return;
- } else {
- // No: unbind in a different context
-
- // Resolve first - must be resolveable
- NamingContext context = resolveFirstAsContext(impl,n);
-
- // Compute tail
- NameComponent[] tail = new NameComponent[n.length - 1];
- System.arraycopy(n,1,tail,0,n.length-1);
-
- // Propagate unbind to this context
- context.unbind(tail);
- }
- }
-
- /**
- * Implements resolving a NameComponent in this context and
- * narrowing it to CosNaming::NamingContext. It will throw appropriate
- * exceptions if not found or not narrowable.
- * @param impl an implementation of NamingContextDataStore
- * @param n a NameComponents which is the name to be found.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound The
- * first component could not be resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the first component of the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see resolve
- */
- protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
- NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound {
- org.omg.CORBA.Object topRef = null;
- BindingTypeHolder bth = new BindingTypeHolder();
- NamingContext context = null;
-
- synchronized (impl) {
- // Resolve first - must be resolveable
- topRef = impl.Resolve(n[0],bth);
- if (topRef == null) {
- // It was not bound
- throw new NotFound(NotFoundReason.missing_node,n);
- }
- }
-
- // Was it bound as a context?
- if (bth.value != BindingType.ncontext) {
- // It was not a context
- throw new NotFound(NotFoundReason.not_context,n);
- }
-
- // Narrow to a naming context
- try {
- context = NamingContextHelper.narrow(topRef);
- } catch (org.omg.CORBA.BAD_PARAM ex) {
- // It was not a context
- throw new NotFound(NotFoundReason.not_context,n);
- }
-
- // Hmm. must be ok
- return context;
- }
-
-
- /**
- * This operation creates a stringified name from the array of Name
- * components.
- * @param n Name of the object <p>
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.<p>
- *
- */
- public String to_string(org.omg.CosNaming.NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if ( (n == null ) || (n.length == 0) )
- {
- throw new InvalidName();
- }
- NamingContextDataStore impl = (NamingContextDataStore)this;
-
- String theStringifiedName = insImpl.convertToString( n );
-
- if( theStringifiedName == null )
- {
- throw new InvalidName();
- }
-
- return theStringifiedName;
- }
-
-
- /**
- * This operation converts a Stringified Name into an equivalent array
- * of Name Components.
- * @param sn Stringified Name of the object <p>
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.<p>
- *
- */
- public org.omg.CosNaming.NameComponent[] to_name(String sn)
- throws org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if ( (sn == null ) || (sn.length() == 0) )
- {
- throw new InvalidName();
- }
- NamingContextDataStore impl = (NamingContextDataStore)this;
- org.omg.CosNaming.NameComponent[] theNameComponents =
- insImpl.convertToNameComponent( sn );
- if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
- {
- throw new InvalidName();
- }
- for( int i = 0; i < theNameComponents.length; i++ ) {
- // If there is a name component whose id and kind null or
- // zero length string, then an invalid name exception needs to be
- // raised.
- if ( ( ( theNameComponents[i].id == null )
- ||( theNameComponents[i].id.length() == 0 ) )
- &&( ( theNameComponents[i].kind == null )
- ||( theNameComponents[i].kind.length() == 0 ) ) ) {
- throw new InvalidName();
- }
- }
- return theNameComponents;
- }
-
- /**
- * This operation creates a URL based "iiopname://" format name
- * from the Stringified Name of the object.
- * @param addr internet based address of the host machine where
- * Name Service is running <p>
- * @param sn Stringified Name of the object <p>
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.<p>
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
- * Indicates the internet based address of the host machine is
- * incorrect <p>
- *
- */
-
- public String to_url(String addr, String sn)
- throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if ( (sn == null ) || (sn.length() == 0) )
- {
- throw new InvalidName();
- }
- if( addr == null )
- {
- throw new
- org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
- }
- NamingContextDataStore impl = (NamingContextDataStore)this;
- String urlBasedAddress = null;
- urlBasedAddress = insImpl.createURLBasedAddress( addr, sn );
- // Extra check to see that corba name url created is valid as per
- // INS spec grammer.
- try {
- INSURLHandler.getINSURLHandler( ).parseURL( urlBasedAddress );
- } catch( BAD_PARAM e ) {
- throw new
- org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
- }
- return urlBasedAddress;
- }
-
- /**
- * This operation resolves the Stringified name into the object
- * reference.
- * @param sn Stringified Name of the object <p>
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * Indicates there is no object reference for the given name. <p>
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * Indicates that the given compound name is incorrect <p>
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.<p>
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
- * Indicates the name is already bound.<p>
- *
- */
- public org.omg.CORBA.Object resolve_str(String sn)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- org.omg.CORBA.Object theObject = null;
- // Name valid?
- if ( (sn == null ) || (sn.length() == 0) )
- {
- throw new InvalidName();
- }
- NamingContextDataStore impl = (NamingContextDataStore)this;
- org.omg.CosNaming.NameComponent[] theNameComponents =
- insImpl.convertToNameComponent( sn );
-
- if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
- {
- throw new InvalidName();
- }
- theObject = resolve( theNameComponents );
- return theObject;
- }
-
-
- transient protected ORB orb;
-
- public static String nameToString(NameComponent[] name)
- {
- StringBuffer s = new StringBuffer("{");
- if (name != null || name.length > 0) {
- for (int i=0;i<name.length;i++) {
- if (i>0)
- s.append(",");
- s.append("[").
- append(name[i].id).
- append(",").
- append(name[i].kind).
- append("]");
- }
- }
- s.append("}");
- return s.toString();
- }
-
- // Debugging aids.
- public static final boolean debug = false;
-
- private static void dprint(String msg) {
- NamingUtils.dprint("NamingContextImpl(" +
- Thread.currentThread().getName() + " at " +
- System.currentTimeMillis() +
- " ems): " + msg);
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingUtils.java b/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingUtils.java
deleted file mode 100644
index 4bcc774..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingUtils.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-import java.io.*;
-import org.omg.CosNaming.NameComponent;
-
-
-public class NamingUtils {
- // Do not instantiate this class
- private NamingUtils() {};
-
- /**
- * Debug flag which must be true for debug streams to be created and
- * dprint output to be generated.
- */
- public static boolean debug = false;
-
- /**
- * Prints the message to the debug stream if debugging is enabled.
- * @param msg the debug message to print.
- */
- public static void dprint(String msg) {
- if (debug && debugStream != null)
- debugStream.println(msg);
- }
-
- /**
- * Prints the message to the error stream (System.err is default).
- * @param msg the error message to print.
- */
- public static void errprint(String msg) {
- if (errStream != null)
- errStream.println(msg);
- else
- System.err.println(msg);
- }
-
- /**
- * Prints the stacktrace of the supplied exception to the error stream.
- * @param e any Java exception.
- */
- public static void printException(java.lang.Exception e) {
- if (errStream != null)
- e.printStackTrace(errStream);
- else
- e.printStackTrace();
- }
-
- /**
- * Create a debug print stream to the supplied log file.
- * @param logFile the file to which debug output will go.
- * @exception IOException thrown if the file cannot be opened for output.
- */
- public static void makeDebugStream(File logFile)
- throws java.io.IOException {
- // Create an outputstream for debugging
- java.io.OutputStream logOStream =
- new java.io.FileOutputStream(logFile);
- java.io.DataOutputStream logDStream =
- new java.io.DataOutputStream(logOStream);
- debugStream = new java.io.PrintStream(logDStream);
-
- // Emit first message
- debugStream.println("Debug Stream Enabled.");
- }
-
- /**
- * Create a error print stream to the supplied file.
- * @param logFile the file to which error messages will go.
- * @exception IOException thrown if the file cannot be opened for output.
- */
- public static void makeErrStream(File errFile)
- throws java.io.IOException {
- if (debug) {
- // Create an outputstream for errors
- java.io.OutputStream errOStream =
- new java.io.FileOutputStream(errFile);
- java.io.DataOutputStream errDStream =
- new java.io.DataOutputStream(errOStream);
- errStream = new java.io.PrintStream(errDStream);
- dprint("Error stream setup completed.");
- }
- }
-
-
- /**
- * A utility method that takes Array of NameComponent and converts
- * into a directory structured name in the format of /id1.kind1/id2.kind2..
- * This is used mainly for Logging.
- */
- static String getDirectoryStructuredName( NameComponent[] name ) {
- StringBuffer directoryStructuredName = new StringBuffer("/");
- for( int i = 0; i < name.length; i++ ) {
- directoryStructuredName.append( name[i].id + "." + name[i].kind );
- }
- return directoryStructuredName.toString( );
- }
-
- /**
- * The debug printstream.
- */
- public static java.io.PrintStream debugStream;
-
- /**
- * The error printstream.
- */
- public static java.io.PrintStream errStream;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientBindingIterator.java b/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientBindingIterator.java
deleted file mode 100644
index 736b353..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientBindingIterator.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-// Import general CORBA classes
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.ORB;
-import org.omg.PortableServer.POA;
-
-// Get org.omg.CosNaming Types
-import org.omg.CosNaming.Binding;
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingTypeHolder;
-import org.omg.CosNaming.NameComponent;
-
-// Get base implementation
-import com.sun.corba.se.impl.naming.cosnaming.NamingContextImpl;
-import com.sun.corba.se.impl.naming.cosnaming.InternalBindingValue;
-
-// Get a hash table
-import java.util.Hashtable;
-import java.util.Enumeration;
-
-/**
- * Class TransientBindingIterator implements the abstract methods
- * defined by BindingIteratorImpl, to use with the TransientNamingContext
- * implementation of the NamingContextImpl. The TransientBindingIterator
- * implementation receives a hash table of InternalBindingValues, and uses
- * an Enumeration to iterate over the contents of the hash table.
- * @see BindingIteratorImpl
- * @see TransientNamingContext
- */
-public class TransientBindingIterator extends BindingIteratorImpl
-{
- // There is only one POA used for both TransientNamingContext and
- // TransientBindingIteraor servants.
- private POA nsPOA;
- /**
- * Constructs a new TransientBindingIterator object.
- * @param orb a org.omg.CORBA.ORB object.
- * @param aTable A hashtable containing InternalBindingValues which is
- * the content of the TransientNamingContext.
- * @param java.lang.Exception a Java exception.
- * @exception Exception a Java exception thrown of the base class cannot
- * initialize.
- */
- public TransientBindingIterator(ORB orb, Hashtable aTable,
- POA thePOA )
- throws java.lang.Exception
- {
- super(orb);
- theHashtable = aTable;
- theEnumeration = this.theHashtable.elements();
- currentSize = this.theHashtable.size();
- this.nsPOA = thePOA;
- }
-
- /**
- * Returns the next binding in the NamingContext. Uses the enumeration
- * object to determine if there are more bindings and if so, returns
- * the next binding from the InternalBindingValue.
- * @param b The Binding as an out parameter.
- * @return true if there were more bindings.
- */
- final public boolean NextOne(org.omg.CosNaming.BindingHolder b)
- {
- // If there are more elements get the next element
- boolean hasMore = theEnumeration.hasMoreElements();
- if (hasMore) {
- b.value =
- ((InternalBindingValue)theEnumeration.nextElement()).theBinding;
- currentSize--;
- } else {
- // Return empty but marshalable binding
- b.value = new Binding(new NameComponent[0],BindingType.nobject);
- }
- return hasMore;
- }
-
- /**
- * Destroys this BindingIterator by disconnecting from the ORB
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- final public void Destroy()
- {
- // Remove the object from the Active Object Map.
- try {
- byte[] objectId = nsPOA.servant_to_id( this );
- if( objectId != null ) {
- nsPOA.deactivate_object( objectId );
- }
- }
- catch( Exception e ) {
- NamingUtils.errprint("BindingIterator.Destroy():caught exception:");
- NamingUtils.printException(e);
- }
- }
-
- /**
- * Returns the remaining number of elements in the iterator.
- * @return the remaining number of elements in the iterator.
- */
- public final int RemainingElements() {
- return currentSize;
- }
-
- private int currentSize;
- private Hashtable theHashtable;
- private Enumeration theEnumeration;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameServer.java b/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameServer.java
deleted file mode 100644
index c9e250f..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameServer.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-import java.util.Properties;
-import java.net.InetAddress;
-
-import org.omg.CORBA.ORB;
-
-import org.omg.CosNaming.NamingContext;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.naming.cosnaming.TransientNameService;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.CorbaResourceUtil;
-import com.sun.corba.se.impl.logging.NamingSystemException;
-
-/**
- * Class TransientNameServer is a standalone application which
- * implements a transient name service. It uses the TransientNameService
- * class for the name service implementation, and the BootstrapServer
- * for implementing bootstrapping, i.e., to get the initial NamingContext.
- * <p>
- * The BootstrapServer uses a Properties object specify the initial service
- * object references supported; such as Properties object is created containing
- * only a "NameService" entry together with the stringified object reference
- * for the initial NamingContext. The BootstrapServer's listening port
- * is set by first checking the supplied arguments to the name server
- * (-ORBInitialPort), and if not set, defaults to the standard port number.
- * The BootstrapServer is created supplying the Properties object, using no
- * external File object for storage, and the derived initial port number.
- * @see TransientNameService
- * @see BootstrapServer
- */
-public class TransientNameServer
-{
- static private boolean debug = false ;
- static NamingSystemException wrapper = NamingSystemException.get(
- CORBALogDomains.NAMING ) ;
-
- static public void trace( String msg ) {
- if (debug)
- System.out.println( msg ) ;
- }
-
- static public void initDebug( String[] args ) {
- // If debug was compiled to be true for testing purposes,
- // don't change it.
- if (debug)
- return ;
-
- for (int ctr=0; ctr<args.length; ctr++)
- if (args[ctr].equalsIgnoreCase( "-debug" )) {
- debug = true ;
- return ;
- }
- debug = false ;
- }
-
- private static org.omg.CORBA.Object initializeRootNamingContext( ORB orb ) {
- org.omg.CORBA.Object rootContext = null;
- try {
- com.sun.corba.se.spi.orb.ORB coreORB =
- (com.sun.corba.se.spi.orb.ORB)orb ;
-
- TransientNameService tns = new TransientNameService(coreORB );
- return tns.initialNamingContext();
- } catch (org.omg.CORBA.SystemException e) {
- throw wrapper.transNsCannotCreateInitialNcSys( e ) ;
- } catch (Exception e) {
- throw wrapper.transNsCannotCreateInitialNc( e ) ;
- }
- }
-
- /**
- * Main startup routine. It instantiates a TransientNameService
- * object and a BootstrapServer object, and then allows invocations to
- * happen.
- * @param args an array of strings representing the startup arguments.
- */
- public static void main(String args[]) {
- initDebug( args ) ;
-
- boolean invalidHostOption = false;
- boolean orbInitialPort0 = false;
-
- // Determine the initial bootstrap port to use
- int initialPort = 0;
- try {
- trace( "Transient name server started with args " + args ) ;
-
- // Create an ORB object
- Properties props = System.getProperties() ;
-
- props.put( ORBConstants.SERVER_ID_PROPERTY, ORBConstants.NAME_SERVICE_SERVER_ID ) ;
- props.put( "org.omg.CORBA.ORBClass",
- "com.sun.corba.se.impl.orb.ORBImpl" );
-
- try {
- // Try environment
- String ips = System.getProperty( ORBConstants.INITIAL_PORT_PROPERTY ) ;
- if (ips != null && ips.length() > 0 ) {
- initialPort = java.lang.Integer.parseInt(ips);
- // -Dorg.omg.CORBA.ORBInitialPort=0 is invalid
- if( initialPort == 0 ) {
- orbInitialPort0 = true;
- throw wrapper.transientNameServerBadPort() ;
- }
- }
- String hostName =
- System.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ;
- if( hostName != null ) {
- invalidHostOption = true;
- throw wrapper.transientNameServerBadHost() ;
- }
- } catch (java.lang.NumberFormatException e) {
- // do nothing
- }
-
- // Let arguments override
- for (int i=0;i<args.length;i++) {
- // Was the initial port specified?
- if (args[i].equals("-ORBInitialPort") &&
- i < args.length-1) {
- initialPort = java.lang.Integer.parseInt(args[i+1]);
- // -ORBInitialPort 0 is invalid
- if( initialPort == 0 ) {
- orbInitialPort0 = true;
- throw wrapper.transientNameServerBadPort() ;
- }
- }
- if (args[i].equals("-ORBInitialHost" ) ) {
- invalidHostOption = true;
- throw wrapper.transientNameServerBadHost() ;
- }
- }
-
- // If initialPort is not set, then we need to set the Default
- // Initial Port Property for the ORB
- if( initialPort == 0 ) {
- initialPort = ORBConstants.DEFAULT_INITIAL_PORT;
- props.put( ORBConstants.INITIAL_PORT_PROPERTY,
- java.lang.Integer.toString(initialPort) );
- }
-
- // Set -ORBInitialPort = Persistent Server Port so that ORBImpl
- // will start Boot Strap.
- props.put( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
- java.lang.Integer.toString(initialPort) );
-
- org.omg.CORBA.ORB corb = ORB.init( args, props ) ;
- trace( "ORB object returned from init: " + corb ) ;
-
- org.omg.CORBA.Object ns = initializeRootNamingContext( corb ) ;
- ((com.sun.corba.se.org.omg.CORBA.ORB)corb).register_initial_reference(
- "NamingService", ns ) ;
-
- String stringifiedIOR = null;
-
- if( ns != null ) {
- stringifiedIOR = corb.object_to_string(ns) ;
- } else {
- NamingUtils.errprint(CorbaResourceUtil.getText(
- "tnameserv.exception", initialPort));
- NamingUtils.errprint(CorbaResourceUtil.getText(
- "tnameserv.usage"));
- System.exit( 1 );
- }
-
- trace( "name service created" ) ;
-
- // This is used for handshaking by the IBM test framework!
- // Do not modify, unless another synchronization protocol is
- // used to replace this hack!
-
- System.out.println(CorbaResourceUtil.getText(
- "tnameserv.hs1", stringifiedIOR));
- System.out.println(CorbaResourceUtil.getText(
- "tnameserv.hs2", initialPort));
- System.out.println(CorbaResourceUtil.getText("tnameserv.hs3"));
-
- // Serve objects.
- java.lang.Object sync = new java.lang.Object();
- synchronized (sync) {sync.wait();}
- } catch (Exception e) {
- if( invalidHostOption ) {
- // Let the User Know that -ORBInitialHost is not valid for
- // tnameserver
- NamingUtils.errprint( CorbaResourceUtil.getText(
- "tnameserv.invalidhostoption" ) );
- } else if( orbInitialPort0 ) {
- // Let the User Know that -ORBInitialPort 0 is not valid for
- // tnameserver
- NamingUtils.errprint( CorbaResourceUtil.getText(
- "tnameserv.orbinitialport0" ));
- } else {
- NamingUtils.errprint(CorbaResourceUtil.getText(
- "tnameserv.exception", initialPort));
- NamingUtils.errprint(CorbaResourceUtil.getText(
- "tnameserv.usage"));
- }
-
- e.printStackTrace() ;
- }
- }
-
- /**
- * Private constructor since no object of this type should be instantiated.
- */
- private TransientNameServer() {}
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameService.java b/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameService.java
deleted file mode 100644
index 7291916..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameService.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-// Get CORBA type
-import org.omg.CORBA.INITIALIZE;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.CompletionStatus;
-
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.INTERNAL;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.LifespanPolicyValue;
-import org.omg.PortableServer.RequestProcessingPolicyValue;
-import org.omg.PortableServer.IdAssignmentPolicyValue;
-import org.omg.PortableServer.ServantRetentionPolicyValue;
-
-// Get org.omg.CosNaming types
-import org.omg.CosNaming.NamingContext;
-
-// Import transient naming context
-import com.sun.corba.se.impl.naming.cosnaming.TransientNamingContext;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.logging.NamingSystemException;
-
-/**
- * Class TransientNameService implements a transient name service
- * using TransientNamingContexts and TransientBindingIterators, which
- * implement the org.omg.CosNaming::NamingContext and org.omg.CosNaming::BindingIterator
- * interfaces specfied by the OMG Common Object Services Specification.
- * <p>
- * The TransientNameService creates the initial NamingContext object.
- * @see NamingContextImpl
- * @see BindingIteratorImpl
- * @see TransientNamingContext
- * @see TransientBindingIterator
- */
-public class TransientNameService
-{
- /**
- * Constructs a new TransientNameService, and creates an initial
- * NamingContext, whose object
- * reference can be obtained by the initialNamingContext method.
- * @param orb The ORB object
- * @exception org.omg.CORBA.INITIALIZE Thrown if
- * the TransientNameService cannot initialize.
- */
- public TransientNameService(com.sun.corba.se.spi.orb.ORB orb )
- throws org.omg.CORBA.INITIALIZE
- {
- // Default constructor uses "NameService" as the key for the Root Naming
- // Context. If default constructor is used then INS's object key for
- // Transient Name Service is "NameService"
- initialize( orb, "NameService" );
- }
-
- /**
- * Constructs a new TransientNameService, and creates an initial
- * NamingContext, whose object
- * reference can be obtained by the initialNamingContext method.
- * @param orb The ORB object
- * @param nameserviceName Stringified key used for INS Service registry
- * @exception org.omg.CORBA.INITIALIZE Thrown if
- * the TransientNameService cannot initialize.
- */
- public TransientNameService(com.sun.corba.se.spi.orb.ORB orb,
- String serviceName ) throws org.omg.CORBA.INITIALIZE
- {
- // This constructor gives the flexibility of providing the Object Key
- // for the Root Naming Context that is registered with INS.
- initialize( orb, serviceName );
- }
-
-
- /**
- * This method initializes Transient Name Service by associating Root
- * context with POA and registering the root context with INS Object Keymap.
- */
- private void initialize( com.sun.corba.se.spi.orb.ORB orb,
- String nameServiceName )
- throws org.omg.CORBA.INITIALIZE
- {
- NamingSystemException wrapper = NamingSystemException.get( orb,
- CORBALogDomains.NAMING ) ;
-
- try {
- POA rootPOA = (POA) orb.resolve_initial_references(
- ORBConstants.ROOT_POA_NAME );
- rootPOA.the_POAManager().activate();
-
- int i = 0;
- Policy[] poaPolicy = new Policy[3];
- poaPolicy[i++] = rootPOA.create_lifespan_policy(
- LifespanPolicyValue.TRANSIENT);
- poaPolicy[i++] = rootPOA.create_id_assignment_policy(
- IdAssignmentPolicyValue.SYSTEM_ID);
- poaPolicy[i++] = rootPOA.create_servant_retention_policy(
- ServantRetentionPolicyValue.RETAIN);
-
- POA nsPOA = rootPOA.create_POA( "TNameService", null, poaPolicy );
- nsPOA.the_POAManager().activate();
-
- // Create an initial context
- TransientNamingContext initialContext =
- new TransientNamingContext(orb, null, nsPOA);
- byte[] rootContextId = nsPOA.activate_object( initialContext );
- initialContext.localRoot =
- nsPOA.id_to_reference( rootContextId );
- theInitialNamingContext = initialContext.localRoot;
- orb.register_initial_reference( nameServiceName,
- theInitialNamingContext );
- } catch (org.omg.CORBA.SystemException e) {
- throw wrapper.transNsCannotCreateInitialNcSys( e ) ;
- } catch (Exception e) {
- throw wrapper.transNsCannotCreateInitialNc( e ) ;
- }
- }
-
-
- /**
- * Return the initial NamingContext.
- * @return the object reference for the initial NamingContext.
- */
- public org.omg.CORBA.Object initialNamingContext()
- {
- return theInitialNamingContext;
- }
-
-
- // The initial naming context for this name service
- private org.omg.CORBA.Object theInitialNamingContext;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNamingContext.java b/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNamingContext.java
deleted file mode 100644
index cef11cb..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNamingContext.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-// Import general CORBA classes
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.ORB;
-import org.omg.PortableServer.POA;
-
-// Import org.omg.CosNaming types
-import org.omg.CosNaming.Binding;
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingTypeHolder;
-import org.omg.CosNaming.BindingListHolder;
-import org.omg.CosNaming.BindingIteratorHolder;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-
-import java.util.logging.Logger;
-import java.util.logging.Level;
-
-import java.util.Hashtable;
-import com.sun.corba.se.impl.orbutil.LogKeywords;
-import com.sun.corba.se.impl.logging.NamingSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-/**
- * Class TransientNamingContext implements the methods defined
- * by NamingContextDataStore, and extends the NamingContextImpl class to
- * provide a servant implementation of CosNaming::NamingContext.
- * The TransientNamingContext uses a hash table
- * to store the mappings between bindings and object references and the
- * hash table is not persistent; thereby the name "transient".
- * This class should not be used directly; instead, the class
- * TransientNameService should be instantiated.
- * <p>
- * The keys in the hash table are InternalBindingKey objects, containing
- * a single NameComponent and implementing the proper functions, i.e.,
- * equals() and hashCode() in an efficient manner. The values in the hash
- * table are InternalBindingValues and store a org.omg.CosNaming::Binding and
- * the object reference associated with the binding. For iteration,
- * TransientBindingIterator objects are created, which are passed a cloned
- * copy of the hashtable. Since elements are inserted and deleted and
- * never modified, this provides stable iterators at the cost of cloning
- * the hash table.
- * <p>
- * To create and destroy object references, the TransientNamingContext
- * uses the orb.connect() and orb.disconnect() methods.
- *
- * @see NamingContextImpl
- * @see NamingContextDataStore
- * @see TransientBindingIterator
- * @see TransientNameService
- */
-public class TransientNamingContext extends NamingContextImpl implements NamingContextDataStore
-{
- private Logger readLogger, updateLogger, lifecycleLogger;
-
- // XXX: the wrapper calls are all preceded by logger updates.
- // These can be combined, and then we simply use 3 NamingSystemException wrappers,
- // for read, update, and lifecycl.
- private NamingSystemException wrapper ;
-
- /**
- * Constructs a new TransientNamingContext object.
- * @param orb an orb object.
- * @param initial the initial naming context.
- * @exception Exception a Java exception thrown of the base class cannot
- * initialize.
- */
- public TransientNamingContext(com.sun.corba.se.spi.orb.ORB orb,
- org.omg.CORBA.Object initial,
- POA nsPOA )
- throws java.lang.Exception
- {
- super(orb, nsPOA );
- wrapper = NamingSystemException.get( orb, CORBALogDomains.NAMING ) ;
-
- this.localRoot = initial;
- readLogger = orb.getLogger( CORBALogDomains.NAMING_READ);
- updateLogger = orb.getLogger( CORBALogDomains.NAMING_UPDATE);
- lifecycleLogger = orb.getLogger(
- CORBALogDomains.NAMING_LIFECYCLE);
- lifecycleLogger.fine( "Root TransientNamingContext LIFECYCLE.CREATED" );
- }
-
- /**
- * Binds the object to the name component as the specified binding type.
- * It creates a InternalBindingKey object and a InternalBindingValue
- * object and inserts them in the hash table.
- * @param n A single org.omg.CosNaming::NameComponent under which the
- * object will be bound.
- * @param obj An object reference to be bound under the supplied name.
- * @param bt The type of the binding (i.e., as object or as context).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public final void Bind(NameComponent n, org.omg.CORBA.Object obj,
- BindingType bt)
- throws org.omg.CORBA.SystemException
- {
- // Create a key and a value
- InternalBindingKey key = new InternalBindingKey(n);
- NameComponent[] name = new NameComponent[1];
- name[0] = n;
- Binding b = new Binding(name,bt);
- InternalBindingValue value = new InternalBindingValue(b,null);
- value.theObjectRef = obj;
- // insert it
- InternalBindingValue oldValue =
- (InternalBindingValue)this.theHashtable.put(key,value);
-
- if (oldValue != null) {
- updateLogger.warning( LogKeywords.NAMING_BIND + "Name " +
- getName( n ) + " Was Already Bound" );
- throw wrapper.transNcBindAlreadyBound() ;
- }
- if( updateLogger.isLoggable( Level.FINE ) ) {
- updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS +
- "Name Component: " + n.id + "." + n.kind );
- }
- }
-
- /**
- * Resolves the supplied name to an object reference and returns
- * the type of the resolved binding. It creates a InternalBindingKey
- * and uses the key for looking up in the hash table. If nothing
- * is found an exception is thrown, otherwise the object reference
- * is returned and the binding type set.
- * @param n a NameComponent which is the name to be resolved.
- * @param bth the BindingType as an out parameter.
- * @return the object reference bound under the supplied name, null if not
- * found.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public final org.omg.CORBA.Object Resolve(NameComponent n,
- BindingTypeHolder bth)
- throws org.omg.CORBA.SystemException
- {
- // Is the initial naming context requested?
- if ( (n.id.length() == 0)
- &&(n.kind.length() == 0 ) )
- {
- bth.value = BindingType.ncontext;
- return localRoot;
- }
-
- // Create a key and lookup the value
- InternalBindingKey key = new InternalBindingKey(n);
-
- InternalBindingValue value =
- (InternalBindingValue) this.theHashtable.get(key);
- if (value == null) return null;
- if( readLogger.isLoggable( Level.FINE ) ) {
- readLogger.fine( LogKeywords.NAMING_RESOLVE_SUCCESS
- + "Namecomponent :" + getName( n ) );
- }
-
- // Copy out binding type and object reference
- bth.value = value.theBinding.binding_type;
- return value.theObjectRef;
- }
-
- /**
- * Deletes the binding with the supplied name. It creates a
- * InternalBindingKey and uses it to remove the value associated
- * with the key. If nothing is found an exception is thrown, otherwise
- * the element is removed from the hash table.
- * @param n a NameComponent which is the name to unbind
- * @return the object reference bound to the name, or null if not found.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public final org.omg.CORBA.Object Unbind(NameComponent n)
- throws org.omg.CORBA.SystemException
- {
- // Create a key and remove it from the hashtable
- InternalBindingKey key = new InternalBindingKey(n);
- InternalBindingValue value =
- (InternalBindingValue)this.theHashtable.remove(key);
-
- // Return what was found
- if (value == null) {
- if( updateLogger.isLoggable( Level.FINE ) ) {
- updateLogger.fine( LogKeywords.NAMING_UNBIND_FAILURE +
- " There was no binding with the name " + getName( n ) +
- " to Unbind " );
- }
- return null;
- } else {
- if( updateLogger.isLoggable( Level.FINE ) ) {
- updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
- " NameComponent: " + getName( n ) );
- }
- return value.theObjectRef;
- }
- }
-
- /**
- * List the contents of this NamingContext. It creates a new
- * TransientBindingIterator object and passes it a clone of the
- * hash table and an orb object. It then uses the
- * newly created object to return the required number of bindings.
- * @param how_many The number of requested bindings in the BindingList.
- * @param bl The BindingList as an out parameter.
- * @param bi The BindingIterator as an out parameter.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public final void List(int how_many, BindingListHolder bl,
- BindingIteratorHolder bi)
- throws org.omg.CORBA.SystemException
- {
- try {
- // Create a new binding iterator servant with a copy of this
- // hashtable. nsPOA is passed to the object so that it can
- // de-activate itself from the Active Object Map when
- // Binding Iterator.destroy is called.
- TransientBindingIterator bindingIterator =
- new TransientBindingIterator(this.orb,
- (Hashtable)this.theHashtable.clone(), nsPOA);
- // Have it set the binding list
- bindingIterator.list(how_many,bl);
-
- byte[] objectId = nsPOA.activate_object( bindingIterator );
- org.omg.CORBA.Object obj = nsPOA.id_to_reference( objectId );
-
- // Get the object reference for the binding iterator servant
- org.omg.CosNaming.BindingIterator bindingRef =
- org.omg.CosNaming.BindingIteratorHelper.narrow( obj );
-
- bi.value = bindingRef;
- } catch (org.omg.CORBA.SystemException e) {
- readLogger.warning( LogKeywords.NAMING_LIST_FAILURE + e );
- throw e;
- } catch (Exception e) {
- // Convert to a CORBA system exception
- readLogger.severe( LogKeywords.NAMING_LIST_FAILURE + e );
- throw wrapper.transNcListGotExc( e ) ;
- }
- }
-
- /**
- * Create a new NamingContext. It creates a new TransientNamingContext
- * object, passing it the orb object.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public final org.omg.CosNaming.NamingContext NewContext()
- throws org.omg.CORBA.SystemException
- {
- try {
- // Create a new servant
- TransientNamingContext transContext =
- new TransientNamingContext(
- (com.sun.corba.se.spi.orb.ORB) orb,localRoot, nsPOA);
-
- byte[] objectId = nsPOA.activate_object( transContext );
- org.omg.CORBA.Object obj = nsPOA.id_to_reference( objectId );
- lifecycleLogger.fine( "TransientNamingContext " +
- "LIFECYCLE.CREATE SUCCESSFUL" );
- return org.omg.CosNaming.NamingContextHelper.narrow( obj );
-
- } catch (org.omg.CORBA.SystemException e) {
- lifecycleLogger.log(
- Level.WARNING, LogKeywords.LIFECYCLE_CREATE_FAILURE, e );
- throw e;
- } catch (Exception e) {
- lifecycleLogger.log(
- Level.WARNING, LogKeywords.LIFECYCLE_CREATE_FAILURE, e );
- throw wrapper.transNcNewctxGotExc( e ) ;
- }
- }
-
- /**
- * Destroys this NamingContext by disconnecting from the ORB.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public final void Destroy()
- throws org.omg.CORBA.SystemException
- {
- // Destroy the object reference by disconnecting from the ORB
- try {
- byte[] objectId = nsPOA.servant_to_id( this );
- if( objectId != null ) {
- nsPOA.deactivate_object( objectId );
- }
- if( lifecycleLogger.isLoggable( Level.FINE ) ) {
- lifecycleLogger.fine(
- LogKeywords.LIFECYCLE_DESTROY_SUCCESS );
- }
- } catch (org.omg.CORBA.SystemException e) {
- lifecycleLogger.log( Level.WARNING,
- LogKeywords.LIFECYCLE_DESTROY_FAILURE, e );
- throw e;
- } catch (Exception e) {
- lifecycleLogger.log( Level.WARNING,
- LogKeywords.LIFECYCLE_DESTROY_FAILURE, e );
- throw wrapper.transNcDestroyGotExc( e ) ;
- }
- }
-
- /**
- * A Utility Method For Logging..
- */
- private String getName( NameComponent n ) {
- return n.id + "." + n.kind;
- }
-
- /**
- * Return whether this NamingContext contains any bindings. It forwards
- * this request to the hash table.
- * @return true if this NamingContext contains no bindings.
- */
- public final boolean IsEmpty()
- {
- return this.theHashtable.isEmpty();
- }
-
- // A hashtable to store the bindings
- private final Hashtable theHashtable = new Hashtable();
-
- /**
- * The local root naming context.
- */
- public org.omg.CORBA.Object localRoot;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbalocURL.java b/src/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbalocURL.java
deleted file mode 100644
index eb911cd..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbalocURL.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.namingutil;
-
-import java.util.*;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.NamingSystemException ;
-
-/**
- * The corbaloc: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's
- * will be parsed and converted to this object. This object is capable of
- * storing multiple Host profiles as defined in the CorbaLoc grammer.
- *
- * @author Hemanth
- */
-public class CorbalocURL extends INSURLBase
-{
- static NamingSystemException wrapper = NamingSystemException.get(
- CORBALogDomains.NAMING_READ ) ;
-
- /**
- * This constructor parses the URL and initializes all the variables. Once
- * the URL Object is constructed it is immutable. URL parameter is a
- * corbaloc: URL string with 'corbaloc:' prefix stripped.
- */
- public CorbalocURL( String aURL ) {
- String url = aURL;
-
- if( url != null ) {
- try {
- // First Clean the URL Escapes if there are any
- url = Utility.cleanEscapes( url );
- } catch( Exception e ) {
- // There is something wrong with the URL escapes used
- // so throw an exception
- badAddress( e );
- }
- int endIndex = url.indexOf( '/' );
- if( endIndex == -1 ) {
- // If there is no '/' then the endIndex is at the end of the URL
- endIndex = url.length();
- }
- // _REVISIT_: Add a testcase to check 'corbaloc:/'
- if( endIndex == 0 ) {
- // The url starts with a '/', it's an error
- badAddress( null );
- }
- // Anything between corbaloc: and / is the host,port information
- // of the server where the Service Object is located
- StringTokenizer endpoints = new StringTokenizer(
- url.substring( 0, endIndex ), "," );
- // NOTE:
- // There should be atleast one token, because there are checks
- // to make sure that there is host information before the
- // delimiter '/'. So no need to explicitly check for number of
- // tokens != 0
- while( endpoints.hasMoreTokens( ) ) {
- String endpointInfo = endpoints.nextToken();
- IIOPEndpointInfo iiopEndpointInfo = null;
- if( endpointInfo.startsWith( "iiop:" ) ) {
- iiopEndpointInfo = handleIIOPColon( endpointInfo );
- } else if( endpointInfo.startsWith( "rir:" ) ) {
- handleRIRColon( endpointInfo );
- rirFlag = true;
- } else if( endpointInfo.startsWith( ":" ) ) {
- iiopEndpointInfo = handleColon( endpointInfo );
- } else {
- // Right now we are not allowing any other protocol
- // other than iiop:, rir: so raise exception indicating
- // that the URL is malformed
- badAddress( null );
- }
- if ( rirFlag == false ) {
- // Add the Host information if RIR flag is set,
- // If RIR is set then it means use the internal Boot
- // Strap protocol for Key String resolution
- if( theEndpointInfo == null ) {
- theEndpointInfo = new java.util.ArrayList( );
- }
- theEndpointInfo.add( iiopEndpointInfo );
- }
- }
- // If there is something after corbaloc:endpointInfo/
- // then that is the keyString
- if( url.length() > (endIndex + 1) ) {
- theKeyString = url.substring( endIndex + 1 );
- }
- }
- }
-
-
- /**
- * A Utility method to throw BAD_PARAM exception to signal malformed
- * INS URL.
- */
- private void badAddress( java.lang.Throwable e )
- {
- throw wrapper.insBadAddress( e ) ;
- }
-
- /**
- * If there is 'iiop:' token in the URL, this method will parses
- * and validates that host and port information.
- */
- private IIOPEndpointInfo handleIIOPColon( String iiopInfo )
- {
- // Check the iiop syntax
- iiopInfo = iiopInfo.substring( NamingConstants.IIOP_LENGTH );
- return handleColon( iiopInfo );
- }
-
-
- /**
- * This is to handle the case of host information with no 'iiop:' prefix.
- * instead if ':' is specified then iiop is assumed.
- */
- private IIOPEndpointInfo handleColon( String iiopInfo ) {
- // String after ":"
- iiopInfo = iiopInfo.substring( 1 );
- String hostandport = iiopInfo;
- // The format can be 1.2@<host>:<port>
- StringTokenizer tokenizer = new StringTokenizer( iiopInfo, "@" );
- IIOPEndpointInfo iiopEndpointInfo = new IIOPEndpointInfo( );
- int tokenCount = tokenizer.countTokens( );
- // There can be 1 or 2 tokens with '@' as the delimiter
- // - if there is only 1 token then there is no GIOP version
- // information. A Default GIOP version of 1.2 is used.
- // - if there are 2 tokens then there is GIOP version is specified
- // - if there are no tokens or more than 2 tokens, then that's an
- // error
- if( ( tokenCount == 0 )
- ||( tokenCount > 2 ))
- {
- badAddress( null );
- }
- if( tokenCount == 2 ) {
- // There is VersionInformation after iiop:
- String version = tokenizer.nextToken( );
- int dot = version.indexOf('.');
- // There is a version without ., which means
- // Malformed list
- if (dot == -1) {
- badAddress( null );
- }
- try {
- iiopEndpointInfo.setVersion(
- Integer.parseInt( version.substring( 0, dot )),
- Integer.parseInt( version.substring(dot+1)) );
- hostandport = tokenizer.nextToken( );
- } catch( Throwable e ) {
- badAddress( e );
- }
- }
- try {
- // A Hack to differentiate IPV6 address
- // from IPV4 address, Current Resolution
- // is to use [ ] to differentiate ipv6 host
- int squareBracketBeginIndex = hostandport.indexOf ( '[' );
- if( squareBracketBeginIndex != -1 ) {
- // ipv6Host should be enclosed in
- // [ ], if not it will result in a
- // BAD_PARAM exception
- String ipv6Port = getIPV6Port( hostandport );
- if( ipv6Port != null ) {
- iiopEndpointInfo.setPort( Integer.parseInt( ipv6Port ));
- }
- iiopEndpointInfo.setHost( getIPV6Host( hostandport ));
- return iiopEndpointInfo;
- }
- tokenizer = new StringTokenizer( hostandport, ":" );
- // There are three possible cases here
- // 1. Host and Port is explicitly specified by using ":" as a
- // a separator
- // 2. Only Host is specified without the port
- // 3. HostAndPort info is null
- if( tokenizer.countTokens( ) == 2 ) {
- // Case 1: There is Host and Port Info
- iiopEndpointInfo.setHost( tokenizer.nextToken( ) );
- iiopEndpointInfo.setPort( Integer.parseInt(
- tokenizer.nextToken( )));
- } else {
- if( ( hostandport != null )
- &&( hostandport.length() != 0 ) )
- {
- // Case 2: Only Host is specified. iiopEndpointInfo is
- // initialized to use the default INS port, if no port is
- // specified
- iiopEndpointInfo.setHost( hostandport );
- }
- // Case 3: If no Host and Port info is provided then we use the
- // the default LocalHost and INSPort. iiopEndpointInfo is
- // already initialized with this info.
- }
- } catch( Throwable e ) {
- // Any kind of Exception is bad here.
- // Possible causes: A Number Format exception because port info is
- // malformed
- badAddress( e );
- }
- Utility.validateGIOPVersion( iiopEndpointInfo );
- return iiopEndpointInfo;
- }
-
- /**
- * Validate 'rir:' case.
- */
- private void handleRIRColon( String rirInfo )
- {
- if( rirInfo.length() != NamingConstants.RIRCOLON_LENGTH ) {
- badAddress( null );
- }
- }
-
- /**
- * Returns an IPV6 Port that is after [<ipv6>]:. There is no validation
- * done here, if it is an incorrect port then the request through
- * this URL results in a COMM_FAILURE, otherwise malformed list will
- * result in BAD_PARAM exception thrown in checkcorbalocGrammer.
- */
- private String getIPV6Port( String endpointInfo )
- {
- int squareBracketEndIndex = endpointInfo.indexOf ( ']' );
- // If there is port information, then it has to be after ] bracket
- // indexOf returns the count from the index of zero as the base, so
- // equality check requires squareBracketEndIndex + 1.
- if( (squareBracketEndIndex + 1) != (endpointInfo.length( )) ) {
- if( endpointInfo.charAt( squareBracketEndIndex + 1 ) != ':' ) {
- throw new RuntimeException(
- "Host and Port is not separated by ':'" );
- }
- // PortInformation should be after ']:' delimiter
- // If there is an exception then it will be caught in
- // checkcorbaGrammer method and rethrown as BAD_PARAM
- return endpointInfo.substring( squareBracketEndIndex + 2 );
- }
- return null;
- }
-
-
- /**
- * Returns an IPV6 Host that is inside [ ] tokens. There is no validation
- * done here, if it is an incorrect IPV6 address then the request through
- * this URL results in a COMM_FAILURE, otherwise malformed list will
- * result in BAD_PARAM exception thrown in checkcorbalocGrammer.
- */
- private String getIPV6Host( String endpointInfo ) {
- // ipv6Host should be enclosed in
- // [ ], if not it will result in a
- // BAD_PARAM exception
- int squareBracketEndIndex = endpointInfo.indexOf ( ']' );
- // get the host between [ ]
- String ipv6Host = endpointInfo.substring( 1, squareBracketEndIndex );
- return ipv6Host;
- }
-
- /**
- * Will be true only in CorbanameURL class.
- */
- public boolean isCorbanameURL( ) {
- return false;
- }
-
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbanameURL.java b/src/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbanameURL.java
deleted file mode 100644
index 569468a..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbanameURL.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.namingutil;
-
-import com.sun.corba.se.impl.logging.NamingSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-/**
- * The corbaname: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's
- * will be stored in this object. This object is capable of storing CorbaLoc
- * profiles as defined in the CorbaName grammer.
- *
- * @Author Hemanth
- */
-public class CorbanameURL extends INSURLBase
-{
- private static NamingSystemException wrapper =
- NamingSystemException.get( CORBALogDomains.NAMING ) ;
-
- /**
- * This constructor takes a corbaname: url with 'corbaname:' prefix stripped
- * and initializes all the variables accordingly. If there are any parsing
- * errors then BAD_PARAM exception is raised.
- */
- public CorbanameURL( String aURL ) {
- String url = aURL;
-
- // First Clean the URL Escapes if there are any
- try {
- url = Utility.cleanEscapes( url );
- } catch( Exception e ) {
- badAddress( e );
- }
-
- int delimiterIndex = url.indexOf( '#' );
- String corbalocString = null;
- if( delimiterIndex != -1 ) {
- // Append corbaloc: for Grammar check, Get the string between
- // corbaname: and # which forms the corbaloc string
- corbalocString = "corbaloc:" +
- url.substring( 0, delimiterIndex ) + "/";
- } else {
- // Build a corbaloc string to check the grammar.
- // 10 is the length of corbaname:
- corbalocString = "corbaloc:" + url.substring( 0, url.length() );
- // If the string doesnot end with a / then add one to end the
- // URL correctly
- if( corbalocString.endsWith( "/" ) != true ) {
- corbalocString = corbalocString + "/";
- }
- }
- try {
- // Check the corbaloc grammar and set the returned corbaloc
- // object to the CorbaName Object
- INSURL insURL =
- INSURLHandler.getINSURLHandler().parseURL( corbalocString );
- copyINSURL( insURL );
- // String after '#' is the Stringified name used to resolve
- // the Object reference from the rootnaming context. If
- // the String is null then the Root Naming context is passed
- // back
- if((delimiterIndex > -1) &&
- (delimiterIndex < (aURL.length() - 1)))
- {
- int start = delimiterIndex + 1 ;
- String result = url.substring(start) ;
- theStringifiedName = result ;
- }
- } catch( Exception e ) {
- badAddress( e );
- }
- }
-
- /**
- * A Utility method to throw BAD_PARAM exception.
- */
- private void badAddress( java.lang.Throwable e )
- throws org.omg.CORBA.BAD_PARAM
- {
- throw wrapper.insBadAddress( e ) ;
- }
-
- /**
- * A Utility method to copy all the variables from CorbalocURL object to
- * this instance.
- */
- private void copyINSURL( INSURL url ) {
- rirFlag = url.getRIRFlag( );
- theEndpointInfo = (java.util.ArrayList) url.getEndpointInfo( );
- theKeyString = url.getKeyString( );
- theStringifiedName = url.getStringifiedName( );
- }
-
- public boolean isCorbanameURL( ) {
- return true;
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/IIOPEndpointInfo.java b/src/share/classes/com/sun/corba/se/impl/naming/namingutil/IIOPEndpointInfo.java
deleted file mode 100644
index f985cf2..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/IIOPEndpointInfo.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, 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.
- */
-
-package com.sun.corba.se.impl.naming.namingutil;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-/**
- * EndpointInfo is used internally by CorbaLoc object to store the
- * host information used in creating the Service Object reference
- * from the -ORBInitDef and -ORBDefaultInitDef definitions.
- *
- * @Author Hemanth
- */
-public class IIOPEndpointInfo
-{
- // Version information
- private int major, minor;
-
- // Host Name and Port Number
- private String host;
- private int port;
-
- IIOPEndpointInfo( ) {
- // Default IIOP Version
- major = ORBConstants.DEFAULT_INS_GIOP_MAJOR_VERSION;
- minor = ORBConstants.DEFAULT_INS_GIOP_MINOR_VERSION;
- // Default host is localhost
- host = ORBConstants.DEFAULT_INS_HOST;
- // Default INS Port
- port = ORBConstants.DEFAULT_INS_PORT;
- }
-
- public void setHost( String theHost ) {
- host = theHost;
- }
-
- public String getHost( ) {
- return host;
- }
-
- public void setPort( int thePort ) {
- port = thePort;
- }
-
- public int getPort( ) {
- return port;
- }
-
- public void setVersion( int theMajor, int theMinor ) {
- major = theMajor;
- minor = theMinor;
- }
-
- public int getMajor( ) {
- return major;
- }
-
- public int getMinor( ) {
- return minor;
- }
-
- /** Internal Debug Method.
- */
- public void dump( ) {
- System.out.println( " Major -> " + major + " Minor -> " + minor );
- System.out.println( "host -> " + host );
- System.out.println( "port -> " + port );
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURL.java b/src/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURL.java
deleted file mode 100644
index bdb68b2..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURL.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.namingutil;
-
-/**
- * INS URL is a generic interface for two different types of URL's specified
- * in INS spec.
- *
- * @Author Hemanth
- */
-public interface INSURL {
- public boolean getRIRFlag( );
-
- // There can be one or more Endpoint's in the URL, so the return value is
- // a List
- public java.util.List getEndpointInfo( );
-
- public String getKeyString( );
-
- public String getStringifiedName( );
-
- // This method will return true only in CorbanameURL, It is provided because
- // corbaname: URL needs special handling.
- public boolean isCorbanameURL( );
-
- // A debug method, which is not required for normal operation
- public void dPrint( );
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLBase.java b/src/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLBase.java
deleted file mode 100644
index 72471cf..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLBase.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.namingutil;
-
-/** The corbaloc: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's
- * will be stored in this object. This object is capable of storing multiple
- * Host profiles as defined in the CorbaLoc grammer.
- *
- * @author Hemanth
- */
-public abstract class INSURLBase implements INSURL {
-
- // If rirFlag is set to true that means internal
- // boot strapping technique will be used. If set to
- // false then the EndpointInfo will be used to create the
- // Service Object reference.
- protected boolean rirFlag = false ;
- protected java.util.ArrayList theEndpointInfo = null ;
- protected String theKeyString = "NameService" ;
- protected String theStringifiedName = null ;
-
- public boolean getRIRFlag( ) {
- return rirFlag;
- }
-
- public java.util.List getEndpointInfo( ) {
- return theEndpointInfo;
- }
-
- public String getKeyString( ) {
- return theKeyString;
- }
-
- public String getStringifiedName( ) {
- return theStringifiedName;
- }
-
- public abstract boolean isCorbanameURL( );
-
- public void dPrint( ) {
- System.out.println( "URL Dump..." );
- System.out.println( "Key String = " + getKeyString( ) );
- System.out.println( "RIR Flag = " + getRIRFlag( ) );
- System.out.println( "isCorbanameURL = " + isCorbanameURL() );
- for( int i = 0; i < theEndpointInfo.size( ); i++ ) {
- ((IIOPEndpointInfo) theEndpointInfo.get( i )).dump( );
- }
- if( isCorbanameURL( ) ) {
- System.out.println( "Stringified Name = " + getStringifiedName() );
- }
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLHandler.java b/src/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLHandler.java
deleted file mode 100644
index 424ed01..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLHandler.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-package com.sun.corba.se.impl.naming.namingutil;
-
-import org.omg.CORBA.CompletionStatus;
-import java.util.StringTokenizer;
-
-/**
- * This class is the entry point to parse different types of INS URL's.
- *
- * @Author Hemanth
- */
-
-public class INSURLHandler {
-
- private static INSURLHandler insURLHandler = null;
-
- // Length of corbaloc:
- private static final int CORBALOC_PREFIX_LENGTH = 9;
-
- // Length of corbaname:
- private static final int CORBANAME_PREFIX_LENGTH = 10;
-
- private INSURLHandler( ) {
- }
-
- public synchronized static INSURLHandler getINSURLHandler( ) {
- if( insURLHandler == null ) {
- insURLHandler = new INSURLHandler( );
- }
- return insURLHandler;
- }
-
- public INSURL parseURL( String aUrl ) {
- String url = aUrl;
- if ( url.startsWith( "corbaloc:" ) == true ) {
- return new CorbalocURL( url.substring( CORBALOC_PREFIX_LENGTH ) );
- } else if ( url.startsWith ( "corbaname:" ) == true ) {
- return new CorbanameURL( url.substring( CORBANAME_PREFIX_LENGTH ) );
- }
- return null;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/NamingConstants.java b/src/share/classes/com/sun/corba/se/impl/naming/namingutil/NamingConstants.java
deleted file mode 100644
index 5465ae9..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/NamingConstants.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, 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.
- */
-package com.sun.corba.se.impl.naming.namingutil;
-
-/**
- * Constants specific to INS parsing and validation.
- */
-public class NamingConstants {
-
- // iiop length
- public static final int IIOP_LENGTH = 4;
-
- // rir: length
- public static final int RIRCOLON_LENGTH = 4;
-
- public static final int MAJORNUMBER_SUPPORTED = 1;
-
- public static final int MINORNUMBERMAX = 2;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/Utility.java b/src/share/classes/com/sun/corba/se/impl/naming/namingutil/Utility.java
deleted file mode 100644
index 02f5c7a..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/namingutil/Utility.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.namingutil;
-
-import java.io.StringWriter;
-
-import org.omg.CORBA.DATA_CONVERSION;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.impl.logging.NamingSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-/**
- * Utility methods for Naming.
- *
- * @Author Hemanth
- */
-class Utility {
- private static NamingSystemException wrapper =
- NamingSystemException.get( CORBALogDomains.NAMING ) ;
-
- /**
- * cleanEscapes removes URL escapes as per IETF 2386 RFP.
- */
- static String cleanEscapes( String stringToDecode ) {
- StringWriter theStringWithoutEscape = new StringWriter();
- for( int i = 0; i < stringToDecode.length(); i++ ) {
- char c = stringToDecode.charAt( i ) ;
- if( c != '%' ) {
- theStringWithoutEscape.write( c );
- } else {
- // Get the two hexadecimal digits and convert that into int
- i++;
- int Hex1 = hexOf( stringToDecode.charAt(i) );
- i++;
- int Hex2 = hexOf( stringToDecode.charAt(i) );
- int value = (Hex1 * 16) + Hex2;
- // Convert the integer to ASCII
- theStringWithoutEscape.write( (char) value );
- }
- }
- return theStringWithoutEscape.toString();
- }
-
- /**
- * Converts an Ascii Character into Hexadecimal digit
- * NOTE: THIS METHOD IS DUPLICATED TO DELIVER NAMING AS A SEPARATE
- * COMPONENT TO RI.
- **/
- static int hexOf( char x )
- {
- int val;
-
- val = x - '0';
- if (val >=0 && val <= 9)
- return val;
-
- val = (x - 'a') + 10;
- if (val >= 10 && val <= 15)
- return val;
-
- val = (x - 'A') + 10;
- if (val >= 10 && val <= 15)
- return val;
-
- throw new DATA_CONVERSION( );
- }
-
- /**
- * If GIOP Version is not correct, This method throws a BAD_PARAM
- * Exception.
- **/
- static void validateGIOPVersion( IIOPEndpointInfo endpointInfo ) {
- if ((endpointInfo.getMajor() > NamingConstants.MAJORNUMBER_SUPPORTED) ||
- (endpointInfo.getMinor() > NamingConstants.MINORNUMBERMAX ) )
- {
- throw wrapper.insBadAddress() ;
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingKey.java b/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingKey.java
deleted file mode 100644
index d7aad37..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingKey.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-import java.io.Serializable;
-import org.omg.CosNaming.NameComponent;
-
-
-/**
- * Class InternalBindingKey implements the necessary wrapper code
- * around the org.omg.CosNaming::NameComponent class to implement the proper
- * equals() method and the hashCode() method for use in a hash table.
- * It computes the hashCode once and stores it, and also precomputes
- * the lengths of the id and kind strings for faster comparison.
- */
-public class InternalBindingKey
- implements Serializable
-{
-
- // computed by serialver tool
- private static final long serialVersionUID = -5410796631793704055L;
-
- public String id;
- public String kind;
-
- // Default Constructor
- public InternalBindingKey() {}
-
- // Normal constructor
- public InternalBindingKey(NameComponent n)
- {
- setup(n);
- }
-
- // Setup the object
- protected void setup(NameComponent n) {
- this.id = n.id;
- this.kind = n.kind;
- }
-
- // Compare the keys by comparing name's id and kind
- public boolean equals(java.lang.Object o) {
- if (o == null)
- return false;
- if (o instanceof InternalBindingKey) {
- InternalBindingKey that = (InternalBindingKey)o;
- if( this.id != null && that.id != null )
- {
- if (this.id.length() != that.id.length() )
- {
- return false;
- }
- // If id is set is must be equal
- if (this.id.length() > 0 && this.id.equals(that.id) == false)
- {
- return false;
- }
- }
- else
- {
- // If One is Null and the other is not then it's a mismatch
- // So, return false
- if( ( this.id == null && that.id != null )
- || ( this.id !=null && that.id == null ) )
- {
- return false;
- }
- }
- if( this.kind != null && that.kind != null )
- {
- if (this.kind.length() != that.kind.length() )
- {
- return false;
- }
- // If kind is set it must be equal
- if (this.kind.length() > 0 && this.kind.equals(that.kind) == false)
- {
- return false;
- }
- }
- else
- {
- // If One is Null and the other is not then it's a mismatch
- // So, return false
- if( ( this.kind == null && that.kind != null )
- || ( this.kind !=null && that.kind == null ) )
- {
- return false;
- }
- }
- // We have checked all the possibilities, so return true
- return true;
- } else {
- return false;
- }
- }
-
-
- // Return precomputed value
- public int hashCode() {
- int hashVal = 0;
- if (this.id.length() > 0)
- {
- hashVal += this.id.hashCode();
- }
- if (this.kind.length() > 0)
- {
- hashVal += this.kind.hashCode();
- }
- return hashVal;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingValue.java b/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingValue.java
deleted file mode 100644
index 26747ae..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingValue.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-import org.omg.CORBA.Object;
-import org.omg.CosNaming.BindingType;
-import java.io.Serializable;
-
-/**
- * Class InternalBindingKey acts as a container for two objects, namely
- * a org.omg.CosNaming::Binding and an CORBA object reference, which are the two
- * components associated with the binding.
- */
-public class InternalBindingValue
- implements Serializable
-{
- public BindingType theBindingType;
- // The value stores both Stringified Object Reference and
- // Non-Stringified Object Reference. This is done to avoid
- // calling orb.string_to_object( ) everytime. Instead it
- // will be set once and then the result will be used everytime.
- public String strObjectRef;
- transient private org.omg.CORBA.Object theObjectRef;
-
- // Default constructor
- public InternalBindingValue() {
- }
-
- // Normal constructor
- public InternalBindingValue(BindingType b, String o) {
- // Objectreference or Context
- theBindingType = b;
- strObjectRef = o;
- }
-
- public org.omg.CORBA.Object getObjectRef( )
- {
- return theObjectRef;
- }
-
- public void setObjectRef( org.omg.CORBA.Object ObjectRef )
- {
- theObjectRef = ObjectRef;
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameServer.java b/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameServer.java
deleted file mode 100644
index ef8dc58..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameServer.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-import java.io.File;
-import java.util.Properties;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.CorbaResourceUtil;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.activation.InitialNameService;
-import com.sun.corba.se.spi.activation.InitialNameServiceHelper;
-import org.omg.CosNaming.NamingContext;
-/**
- * Class NameServer is a standalone application which
- * implements a persistent and a transient name service.
- * It uses the PersistentNameService and TransientNameService
- * classes for the name service implementation.
- *
- * @author Hemanth Puttaswamy
- * @since JDK1.2
- */
-
-public class NameServer
-{
- private ORB orb;
-
- private File dbDir; // name server database directory
-
- private final static String dbName = "names.db";
-
- public static void main(String args[])
- {
- NameServer ns = new NameServer(args);
- ns.run();
- }
-
- protected NameServer(String args[])
- {
- // create the ORB Object
- java.util.Properties props = System.getProperties();
- props.put( ORBConstants.SERVER_ID_PROPERTY, "1000" ) ;
- props.put("org.omg.CORBA.ORBClass",
- "com.sun.corba.se.impl.orb.ORBImpl");
- orb = (ORB) org.omg.CORBA.ORB.init(args,props);
-
- // set up the database directory
- String dbDirName = props.getProperty( ORBConstants.DB_DIR_PROPERTY ) +
- props.getProperty("file.separator") + dbName +
- props.getProperty("file.separator");
-
- dbDir = new File(dbDirName);
- if (!dbDir.exists()) dbDir.mkdir();
- }
-
- protected void run()
- {
- try {
-
- // create the persistent name service
- NameService ns = new NameService(orb, dbDir);
-
- // add root naming context to initial naming
- NamingContext rootContext = ns.initialNamingContext();
- InitialNameService ins = InitialNameServiceHelper.narrow(
- orb.resolve_initial_references(
- ORBConstants.INITIAL_NAME_SERVICE_NAME ));
- ins.bind( "NameService", rootContext, true);
- System.out.println(CorbaResourceUtil.getText("pnameserv.success"));
-
- // wait for invocations
- orb.run();
-
- } catch (Exception ex) {
-
- ex.printStackTrace(System.err);
- }
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameService.java b/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameService.java
deleted file mode 100644
index 91106f4..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameService.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.omg.CORBA.Policy;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.LifespanPolicyValue;
-import org.omg.PortableServer.RequestProcessingPolicyValue;
-import org.omg.PortableServer.IdAssignmentPolicyValue;
-import org.omg.PortableServer.ServantRetentionPolicyValue;
-import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextHelper;
-import org.omg.PortableServer.*;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-/**
- * @author Hemanth Puttaswamy
- * @since JDK1.2
- */
-
-public class NameService
-{
- private NamingContext rootContext = null;
- private POA nsPOA = null;
- private ServantManagerImpl contextMgr;
- private ORB theorb;
-
- /**
- * Create NameService which starts the Root Naming Context in Persistent CosNaming
- * @param orb an ORB object.
- * @param logDir a File
- * @exception java.lang.Exception a Java exception.
- */
- public NameService(ORB orb, File logDir)
- throws Exception
- {
- theorb = orb;
-
- // Moved this to the creation of the ORB that is passed into this
- // constructor.
- //
- // This is required for creating Persistent Servants under this ORB
- // Right now the Persistent NameService and ORBD are launched together
- // Find out a better way of doing this, Since ORBD is an important
- // process which should not be killed because of some external process
- // orb.setPersistentServerId( (int) 1000 );
-
- // get and activate the root naming POA
- POA rootPOA = (POA)orb.resolve_initial_references(
- ORBConstants.ROOT_POA_NAME ) ;
- rootPOA.the_POAManager().activate();
-
- // create a new POA for persistent Naming Contexts
- // With Non-Retain policy, So that every time Servant Manager
- // will be contacted when the reference is made for the context
- // The id assignment is made by the NameServer, The Naming Context
- // id's will be in the format NC<Index>
- int i=0;
- Policy[] poaPolicy = new Policy[4];
- poaPolicy[i++] = rootPOA.create_lifespan_policy(
- LifespanPolicyValue.PERSISTENT);
- poaPolicy[i++] = rootPOA.create_request_processing_policy(
- RequestProcessingPolicyValue.USE_SERVANT_MANAGER);
- poaPolicy[i++] = rootPOA.create_id_assignment_policy(
- IdAssignmentPolicyValue.USER_ID);
- poaPolicy[i++] = rootPOA.create_servant_retention_policy(
- ServantRetentionPolicyValue.NON_RETAIN);
-
-
- nsPOA = rootPOA.create_POA("NameService", null, poaPolicy);
- nsPOA.the_POAManager().activate( );
-
- // create and set the servant manager
- contextMgr = new
- ServantManagerImpl(orb, logDir, this );
-
- // The RootObject key will be NC0
- String rootKey = contextMgr.getRootObjectKey( );
- // initialize the root Naming Context
- NamingContextImpl nc =
- new NamingContextImpl( orb, rootKey, this, contextMgr );
- nc = contextMgr.addContext( rootKey, nc );
- nc.setServantManagerImpl( contextMgr );
- nc.setORB( orb );
- nc.setRootNameService( this );
-
- nsPOA.set_servant_manager(contextMgr);
- rootContext = NamingContextHelper.narrow(
- nsPOA.create_reference_with_id( rootKey.getBytes( ),
- NamingContextHelper.id( ) ) );
- }
-
- /**
- * This method returns the Root Naming Context
- */
- public NamingContext initialNamingContext()
- {
- return rootContext;
- }
-
- /**
- * This method returns nsPOA which is the only POA that we use for
- * Persistent Naming Contexts.
- */
- POA getNSPOA( ) {
- return nsPOA;
- }
-
-
- /**
- * This method creates a NewContext, This will internally invoked from
- * NamingContextImpl. It is not a public API. NewContext is in this class
- * because a Persiten reference has to be created with Persistent NameService
- * POA.
- */
- public NamingContext NewContext( ) throws org.omg.CORBA.SystemException
- {
- try
- {
- // Get the new Naming Context Key from
- // the ServantManager
- String newKey =
- contextMgr.getNewObjectKey( );
- // Create the new Naming context and create the Persistent
- // reference
- NamingContextImpl theContext =
- new NamingContextImpl( theorb, newKey,
- this, contextMgr );
- NamingContextImpl tempContext = contextMgr.addContext( newKey,
- theContext );
- if( tempContext != null )
- {
- theContext = tempContext;
- }
- // If the context is read from the File, The following three entries
- // will be null. So a fresh setup may be required.
- theContext.setServantManagerImpl( contextMgr );
- theContext.setORB( theorb );
- theContext.setRootNameService( this );
- NamingContext theNewContext =
- NamingContextHelper.narrow(
- nsPOA.create_reference_with_id( newKey.getBytes( ),
- NamingContextHelper.id( )) );
- return theNewContext;
- }
- catch( org.omg.CORBA.SystemException e )
- {
- throw e;
- }
- catch( java.lang.Exception e )
- {
- //throw e;
- }
- return null;
- }
-
- /**
- * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
- * @param Object Key as String
- * @returns reference an CORBA.Object.
- */
- org.omg.CORBA.Object getObjectReferenceFromKey( String key )
- {
- org.omg.CORBA.Object theObject = null;
- try
- {
- theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
- }
- catch (Exception e )
- {
- theObject = null;
- }
- return theObject;
- }
-
- /**
- * getObjectKey gets the Object Key from the reference using POA.reference_to_id method
- * @param reference an CORBA.Object.
- * @returns Object Key as String
- */
- String getObjectKey( org.omg.CORBA.Object reference )
- {
- byte theId[];
- try
- {
- theId = nsPOA.reference_to_id( reference );
- }
- catch( org.omg.PortableServer.POAPackage.WrongAdapter e )
- {
- return null;
- }
- catch( org.omg.PortableServer.POAPackage.WrongPolicy e )
- {
- return null;
- }
- catch( Exception e )
- {
- return null;
- }
- String theKey = new String( theId );
- return theKey;
- }
-
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java b/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java
deleted file mode 100644
index 63f191d..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java
+++ /dev/null
@@ -1,1306 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-
-import org.omg.CORBA.Object;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.Policy;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.LifespanPolicyValue;
-import org.omg.PortableServer.RequestProcessingPolicyValue;
-import org.omg.PortableServer.IdAssignmentPolicyValue;
-import org.omg.PortableServer.ServantRetentionPolicyValue;
-
-import org.omg.CosNaming.*;
-import org.omg.CosNaming.NamingContextPackage.*;
-import org.omg.CosNaming.NamingContextExtPackage.*;
-
-import com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore;
-import com.sun.corba.se.impl.naming.cosnaming.NamingUtils;
-
-import com.sun.corba.se.impl.naming.namingutil.INSURLHandler;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.logging.NamingSystemException;
-
-import java.io.Serializable;
-import java.util.Hashtable;
-
-/**
- * Class NamingContextImpl implements the org.omg.CosNaming::NamingContext and
- * NamingContextExt interface.
- * <p>
- * The operations bind(), rebind(), bind_context() and rebind_context()
- * are all really implemented by doBind(). resolve() is really implemented
- * by doResolve(), unbind() by doUnbind(). list(), new_context() and
- * destroy() uses the NamingContextDataStore interface directly. All the
- * doX() methods are public static.
- * They synchronize on the NamingContextDataStore object.
- * <p>
- * None of the methods here are Synchronized because These methods will be
- * invoked from Super class's doBind( ), doResolve( ) which are already
- * Synchronized.
- */
-
-
-public class NamingContextImpl
- extends NamingContextExtPOA
- implements NamingContextDataStore, Serializable
-{
-
- // The ORB is required to do string_to_object() operations
- // All the references are stored in the files in the form of IOR strings
- private transient ORB orb;
-
- // The ObjectKey will be in the format NC<Index> which uniquely identifies
- // The NamingContext internaly
- private final String objKey;
-
- // Hash table contains all the entries in the NamingContexts. The
- // CORBA.Object references will be stored in the form of IOR strings
- // and the Child Naming Contexts will have it's key as the entry in the
- // table. This table is written into File everytime an update is made
- // on this context.
- private final Hashtable theHashtable = new Hashtable( );
-
- // The NameServiceHandle is required to get the ObjectId from the
- // NamingContext's references. These references are created using
- // POA in the NameService.
- private transient NameService theNameServiceHandle;
-
- // ServantManager is the single point of contact to Read, Write and
- // Update the NamingContextFile
- private transient ServantManagerImpl theServantManagerImplHandle;
-
- // All the INS (Interoperable Naming Service) methods are defined in this class
- // All the calls to INS will be delegated to this class.
- private transient com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl insImpl;
-
- private transient NamingSystemException readWrapper ;
-
- private transient NamingSystemException updateWrapper ;
-
- private static POA biPOA = null;
-
- /**
- * Create a naming context servant.
- * Runs the super constructor.
- * @param orb an ORB object.
- * @param objKey as String
- * @param TheNameService as NameService
- * @param TheServantManagerImpl as ServantManagerImpl
- * @exception java.lang.Exception a Java exception.
- */
-
- public NamingContextImpl(ORB orb, String objKey,
- NameService theNameService, ServantManagerImpl theServantManagerImpl )
- throws Exception
- {
- super();
-
- this.orb = orb;
- readWrapper = NamingSystemException.get( orb,
- CORBALogDomains.NAMING_READ ) ;
- updateWrapper = NamingSystemException.get( orb,
- CORBALogDomains.NAMING_UPDATE ) ;
-
- debug = true ; // orb.namingDebugFlag ;
- this.objKey = objKey;
- theNameServiceHandle = theNameService;
- theServantManagerImplHandle = theServantManagerImpl;
- insImpl =
- new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl();
- }
-
- com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl getINSImpl( )
- {
- if( insImpl == null )
- {
- // insImpl will be null if the NamingContext graph is rebuilt from
- // the persistence store.
- insImpl =
- new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl();
- }
- return insImpl;
- }
-
-
- public void setRootNameService( NameService theNameService ) {
- theNameServiceHandle = theNameService;
- }
-
- public void setORB( ORB theOrb ) {
- orb = theOrb;
- }
-
- public void setServantManagerImpl(
- ServantManagerImpl theServantManagerImpl )
- {
- theServantManagerImplHandle = theServantManagerImpl;
- }
-
- public POA getNSPOA( ) {
- return theNameServiceHandle.getNSPOA( );
- }
-
-
-
-
- /**
- * Bind an object under a name in this NamingContext. If the name
- * contains multiple (n) components, n-1 will be resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * An exception is thrown if a binding with the supplied name already
- * exists. If the
- * object to be bound is a NamingContext it will not participate in
- * a recursive resolve.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound The supplied name
- * is already bound.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see doBind
- */
- public void bind(NameComponent[] n, org.omg.CORBA.Object obj)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound
- {
- if( obj == null ) {
- throw updateWrapper.objectIsNull() ;
- }
-
- if (debug)
- dprint("bind " + nameToString(n) + " to " + obj);
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,obj,false,BindingType.nobject);
- }
-
- /**
- * Bind a NamingContext under a name in this NamingContext. If the name
- * contains multiple (n) components, n-1 will be resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * An exception is thrown if a binding with the supplied name already
- * exists. The NamingContext will participate in recursive resolving.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the NamingContect object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is
- * already bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see doBind
- */
- public void bind_context(NameComponent[] n, NamingContext nc)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound
- {
- if( nc == null ) {
- throw updateWrapper.objectIsNull() ;
- }
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,nc,false,BindingType.ncontext);
- }
-
- /**
- * Bind an object under a name in this NamingContext. If the name
- * contains multiple (n) components, n-1 will be resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * If a binding under the supplied name already exists it will be
- * unbound first. If the
- * object to be bound is a NamingContext it will not participate in
- * a recursive resolve.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see doBind
- */
- public void rebind(NameComponent[] n, org.omg.CORBA.Object obj)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- if( obj == null )
- {
- throw updateWrapper.objectIsNull() ;
- }
- try {
- if (debug)
- dprint("rebind " + nameToString(n) + " to " + obj);
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,obj,true,BindingType.nobject);
- } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
- // This should not happen
- throw updateWrapper.namingCtxRebindAlreadyBound( ex ) ;
- }
- }
-
- /**
- * Bind a NamingContext under a name in this NamingContext. If the name
- * contains multiple (n) components, the first n-1 components will be
- * resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * If a binding under the supplied name already exists it will be
- * unbound first. The NamingContext will participate in recursive resolving.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see doBind
- */
- public void rebind_context(NameComponent[] n, NamingContext nc)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- try {
- if (debug)
- dprint("rebind_context " + nameToString(n) + " to " + nc);
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,nc,true,BindingType.ncontext);
- } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
- // This should not happen
- throw updateWrapper.namingCtxRebindAlreadyBound( ex ) ;
- }
- }
-
- /**
- * Resolve a name in this NamingContext and return the object reference
- * bound to the name. If the name contains multiple (n) components,
- * the first component will be resolved in this NamingContext and the
- * remaining components resolved in the resulting NamingContext, provided
- * that the NamingContext bound to the first component of the name was
- * bound with bind_context().
- * @param n a sequence of NameComponents which is the name to be resolved.
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see doResolve
- */
- public org.omg.CORBA.Object resolve(NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- if (debug)
- dprint("resolve " + nameToString(n));
- // doResolve actually resolves
- NamingContextDataStore impl = (NamingContextDataStore)this;
- return doResolve(impl,n);
- }
-
- /**
- * Remove a binding from this NamingContext. If the name contains
- * multiple (n) components, the first n-1 components will be resolved
- * from this NamingContext and the final component unbound in
- * the resulting NamingContext.
- * @param n a sequence of NameComponents which is the name to be unbound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see doUnbind
- */
- public void unbind(NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- if (debug)
- dprint("unbind " + nameToString(n));
- // doUnbind actually unbinds
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doUnbind(impl,n);
- }
-
- /**
- * List the contents of this NamingContest. A sequence of bindings
- * is returned (a BindingList) containing up to the number of requested
- * bindings, and a BindingIterator object reference is returned for
- * iterating over the remaining bindings.
- * @param how_many The number of requested bindings in the BindingList.
- * @param bl The BindingList as an out parameter.
- * @param bi The BindingIterator as an out parameter.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see BindingListHolder
- * @see BindingIteratorImpl
- */
- public void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi)
- {
- if (debug)
- dprint("list(" + how_many + ")");
- // List actually generates the list
- NamingContextDataStore impl = (NamingContextDataStore)this;
- synchronized (impl) {
- impl.List(how_many,bl,bi);
- }
- if (debug && bl.value != null)
- dprint("list(" + how_many + ") -> bindings[" + bl.value.length +
- "] + iterator: " + bi.value);
- }
-
-
- /**
- * Create a NamingContext object and return its object reference.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- public synchronized NamingContext new_context()
- {
- // Create actually creates a new naming context
- if (debug)
- dprint("new_context()");
- NamingContextDataStore impl = (NamingContextDataStore)this;
- synchronized (impl) {
- return impl.NewContext();
- }
- }
-
-
- /**
- * Create a new NamingContext, bind it in this Naming Context and return
- * its object reference. This is equivalent to using new_context() followed
- * by bind_context() with the supplied name and the object reference for
- * the newly created NamingContext.
- * @param n a sequence of NameComponents which is the name to be unbound.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server, bound to the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is
- * already bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see new_context
- * @see bind_context
- */
- public NamingContext bind_new_context(NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- NamingContext nc = null;
- NamingContext rnc = null;
- try {
- if (debug)
- dprint("bind_new_context " + nameToString(n));
- // The obvious solution:
- nc = this.new_context();
- this.bind_context(n,nc);
- rnc = nc;
- nc = null;
- } finally {
- try {
- if(nc != null)
- nc.destroy();
- } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) {
- }
- }
- return rnc;
- }
-
- /**
- * Destroy this NamingContext object. If this NamingContext contains
- * no bindings, the NamingContext is deleted.
- * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This NamingContext
- * is not empty (i.e., contains bindings).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- public void destroy()
- throws org.omg.CosNaming.NamingContextPackage.NotEmpty
- {
- if (debug)
- dprint("destroy ");
- NamingContextDataStore impl = (NamingContextDataStore)this;
- synchronized (impl) {
- if (impl.IsEmpty() == true)
- // The context is empty so it can be destroyed
- impl.Destroy();
- else
- // This context is not empty!
- throw new org.omg.CosNaming.NamingContextPackage.NotEmpty();
- }
- }
-
- /**
- * Implements all four flavors of binding. It uses Resolve() to
- * check if a binding already exists (for bind and bind_context), and
- * unbind() to ensure that a binding does not already exist.
- * If the length of the name is 1, then Bind() is called with
- * the name and the object to bind. Otherwise, the first component
- * of the name is resolved in this NamingContext and the appropriate
- * form of bind passed to the resulting NamingContext.
- * This method is static for maximal reuse - even for extended naming
- * context implementations where the recursive semantics still apply.
- * @param impl an implementation of NamingContextDataStore
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @param rebind Replace an existing binding or not.
- * @param bt Type of binding (as object or as context).
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the first component of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is
- * already bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see resolve
- * @see unbind
- * @see bind
- * @see bind_context
- * @see rebind
- * @see rebind_context
- */
- private void doBind(NamingContextDataStore impl,
- NameComponent[] n,
- org.omg.CORBA.Object obj,
- boolean rebind,
- org.omg.CosNaming.BindingType bt)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound
- {
- // Valid name?
- if (n.length < 1)
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
-
- // At bottom level?
- if (n.length == 1) {
- // The identifier must be set
- if( (n[0].id.length() == 0) && (n[0].kind.length() == 0) )
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
-
- // Ensure synchronization of backend
- synchronized (impl) {
- // Yes: bind object in this context under the name
- BindingTypeHolder bth = new BindingTypeHolder();
- if (rebind) {
- org.omg.CORBA.Object objRef = impl.Resolve( n[0], bth );
- if( objRef != null ) {
- // Refer Naming Service Doc:00-11-01 section 2.2.3.4
- // If there is an object already bound with the name
- // and the binding type is not ncontext a NotFound
- // Exception with a reason of not a context has to be
- // raised.
- // Fix for bug Id: 4384628
- if ( bth.value.value() == BindingType.nobject.value() ) {
- if ( bt.value() == BindingType.ncontext.value() ) {
- throw new NotFound(NotFoundReason.not_context, n);
- }
- } else {
- // Previously a Context was bound and now trying to
- // bind Object. It is invalid.
- if ( bt.value() == BindingType.nobject.value() ) {
- throw new NotFound(NotFoundReason.not_object, n);
- }
- }
- impl.Unbind(n[0]);
- }
- } else {
- if (impl.Resolve(n[0],bth) != null)
- throw new org.omg.CosNaming.NamingContextPackage.AlreadyBound();
- }
-
- // Now there are no other bindings under this name
- impl.Bind(n[0],obj,bt);
- }
- } else {
- // No: bind in a different context
- NamingContext context = resolveFirstAsContext(impl,n);
-
- // Compute tail
- NameComponent[] tail = new NameComponent[n.length - 1];
- System.arraycopy(n,1,tail,0,n.length-1);
-
- // How should we propagate the bind
- switch (bt.value()) {
- case BindingType._nobject:
- {
- // Bind as object
- if (rebind)
- context.rebind(tail,obj);
- else
- context.bind(tail,obj);
- }
- break;
- case BindingType._ncontext:
- {
- // Narrow to a naming context using Java casts. It must work.
- NamingContext objContext = (NamingContext)obj;
- // Bind as context
- if (rebind)
- context.rebind_context(tail,objContext);
- else
- context.bind_context(tail,objContext);
- }
- break;
- default:
- // This should not happen
- throw updateWrapper.namingCtxBadBindingtype() ;
- }
- }
- }
-
-
- /**
- * Implements resolving names in this NamingContext. The first component
- * of the supplied name is resolved in this NamingContext by calling
- * Resolve(). If there are no more components in the name, the
- * resulting object reference is returned. Otherwise, the resulting object
- * reference must have been bound as a context and be narrowable to
- * a NamingContext. If this is the case, the remaining
- * components of the name is resolved in the resulting NamingContext.
- * This method is static for maximal reuse - even for extended naming
- * context implementations where the recursive semantics still apply.
- * @param impl an implementation of NamingContextDataStore
- * @param n a sequence of NameComponents which is the name to be resolved.
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the first component of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see resolve
- */
- public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl,
- NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- org.omg.CORBA.Object obj = null;
- BindingTypeHolder bth = new BindingTypeHolder();
-
- // Length must be greater than 0
- if (n.length < 1)
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
-
- // The identifier must be set
- if (n.length == 1) {
- synchronized (impl) {
- // Resolve first level in this context
- obj = impl.Resolve(n[0],bth);
- }
- if (obj == null) {
- // Object was not found
- throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
- }
- return obj;
- } else {
- // n.length > 1
- if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0 ) )
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
-
- NamingContext context = resolveFirstAsContext(impl,n);
-
- // Compute restOfName = name[1..length]
- NameComponent[] tail = new NameComponent[n.length -1];
- System.arraycopy(n,1,tail,0,n.length-1);
-
- // Resolve rest of name in context
- return context.resolve(tail);
- }
- }
-
- /**
- * Implements unbinding bound names in this NamingContext. If the
- * name contains only one component, the name is unbound in this
- * NamingContext using Unbind(). Otherwise, the first component
- * of the name is resolved in this NamingContext and
- * unbind passed to the resulting NamingContext.
- * This method is static for maximal reuse - even for extended naming
- * context implementations where the recursive semantics still apply.
- * @param impl an implementation of NamingContextDataStore
- * @param n a sequence of NameComponents which is the name to be unbound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see resolve
- */
- public static void doUnbind(NamingContextDataStore impl,
- NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if (n.length < 1)
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
-
- // Unbind here?
- if (n.length == 1) {
- // The identifier must be set
- if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) )
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
-
- org.omg.CORBA.Object objRef = null;
- synchronized (impl) {
- // Yes: unbind in this context
- objRef = impl.Unbind(n[0]);
- }
-
- if (objRef == null)
- // It was not bound
- throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
- // Done
- return;
- } else {
- // No: unbind in a different context
-
- // Resolve first - must be resolveable
- NamingContext context = resolveFirstAsContext(impl,n);
-
- // Compute tail
- NameComponent[] tail = new NameComponent[n.length - 1];
- System.arraycopy(n,1,tail,0,n.length-1);
-
- // Propagate unbind to this context
- context.unbind(tail);
- }
- }
-
- /**
- * Implements resolving a NameComponent in this context and
- * narrowing it to CosNaming::NamingContext. It will throw appropriate
- * exceptions if not found or not narrowable.
- * @param impl an implementation of NamingContextDataStore
- * @param n a NameComponents which is the name to be found.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound The
- * first component could not be resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the first component of the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see resolve
- */
- protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
- NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound {
- org.omg.CORBA.Object topRef = null;
- BindingTypeHolder bth = new BindingTypeHolder();
- NamingContext context = null;
-
- synchronized (impl) {
- // Resolve first - must be resolveable
- topRef = impl.Resolve(n[0],bth);
- if (topRef == null) {
- // It was not bound
- throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
- }
- }
-
- // Was it bound as a context?
- if (bth.value != BindingType.ncontext) {
- // It was not a context
- throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n);
- }
-
- // Narrow to a naming context
- try {
- context = NamingContextHelper.narrow(topRef);
- } catch (org.omg.CORBA.BAD_PARAM ex) {
- // It was not a context
- throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n);
- }
-
- // Hmm. must be ok
- return context;
- }
-
- public static String nameToString(NameComponent[] name)
- {
- StringBuffer s = new StringBuffer("{");
- if (name != null || name.length > 0) {
- for (int i=0;i<name.length;i++) {
- if (i>0)
- s.append(",");
- s.append("[").
- append(name[i].id).
- append(",").
- append(name[i].kind).
- append("]");
- }
- }
- s.append("}");
- return s.toString();
- }
-
- // Debugging aids.
- private static boolean debug ;
-
- private static void dprint(String msg) {
- NamingUtils.dprint("NamingContextImpl(" +
- Thread.currentThread().getName() + " at " +
- System.currentTimeMillis() +
- " ems): " + msg);
- }
-
-
- /**
- * Implements all flavors of binding( bind and bindcontext)
- * This method will be called from the superclass's doBind( ) method
- * which takes care of all the conditions before calling this method.
- * i.e., It checks whether the Name is already Bounded, Then in the
- * case of rebind it calls Unbind first.
- * This method does one level binding only, To have n-level binding
- * with compound names, doBind( ) calls this method recursively.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @param bt Type of binding (as object or as context).
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound raised
- * if the NameComoponent list is invalid
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * Could not proceed in resolving the Name from the given NameComponent
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
- * is already bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions
- * @see Resolve
- * @see Unbind
- */
- public void Bind(NameComponent n, org.omg.CORBA.Object obj, BindingType bt)
- {
- if( obj == null ) {
- // Raise a Valid Exception and Return
- return;
- }
-
- InternalBindingKey key = new InternalBindingKey(n);
- InternalBindingValue value;
-
- try {
- if( bt.value() == BindingType._nobject ) {
- // If the BindingType is an ObjectRef then Stringify this ref and
- // Store it in InternalBindingValue instance. This is required
- // because the Object References has to be stored in file
- value = new InternalBindingValue(bt, orb.object_to_string(obj) );
- value.setObjectRef( obj );
- } else {
- // If the BindingType is a NamingContext then get it's object key
- // from the NameService and store it in the Internal Binding Value instance
- String theNCKey = theNameServiceHandle.getObjectKey( obj );
- value = new InternalBindingValue( bt, theNCKey );
- value.setObjectRef( obj );
- }
-
- InternalBindingValue oldValue =
- (InternalBindingValue)this.theHashtable.put(key,value);
-
- if( oldValue != null) {
- // There was an entry with this name in the Hashtable and hence throw CTX_ALREADY_BOUND
- // exception
- throw updateWrapper.namingCtxRebindAlreadyBound() ;
- } else {
- try {
- // Everything went smooth so update the NamingContext file with the
- // latest Hashtable image
- theServantManagerImplHandle.updateContext( objKey, this );
- } catch( Exception e ) {
- // Something went wrong while updating the context
- // so speak the error
- throw updateWrapper.bindUpdateContextFailed( e ) ;
- }
- }
- } catch( Exception e ) {
- // Something went wrong while Binding the Object Reference
- // Speak the error again.
- throw updateWrapper.bindFailure( e ) ;
- }
- }
-
- /**
- * This method resolves the NamingContext or Object Reference for one level
- * The doResolve( ) method calls Resolve( ) recursively to resolve n level
- * Names.
- * @param n a sequence of NameComponents which is the name to be resolved.
- * @param bt Type of binding (as object or as context).
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound Neither a NamingContext
- * or a Corba Object reference not found under this Name
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see Bind
- */
- public Object Resolve(NameComponent n, BindingTypeHolder bth)
- throws SystemException
- {
- if( ( n.id.length() == 0 ) &&( n.kind.length() == 0 ) ) {
- // If the NameComponent list has no entry then it means the current
- // context was requested
- bth.value = BindingType.ncontext;
- return theNameServiceHandle.getObjectReferenceFromKey(
- this.objKey );
- }
-
- InternalBindingKey key = new InternalBindingKey(n);
- InternalBindingValue value =
- (InternalBindingValue) this.theHashtable.get(key);
-
- if( value == null ) {
- // No entry was found for the given name and hence return NULL
- // NamingContextDataStore throws appropriate exception if
- // required.
- return null;
- }
-
- Object theObjectFromStringifiedReference = null;
- bth.value = value.theBindingType;
-
- try {
- // Check whether the entry found in the Hashtable starts with NC
- // Which means it's a name context. So get the NamingContext reference
- // from ServantManager, which would either return from the cache or
- // read it from the File.
- if( value.strObjectRef.startsWith( "NC" ) ) {
- bth.value = BindingType.ncontext;
- return theNameServiceHandle.getObjectReferenceFromKey( value.strObjectRef );
- } else {
- // Else, It is a Object Reference. Check whether Object Reference
- // can be obtained directly, If not then convert the stringified
- // reference to object and return.
- theObjectFromStringifiedReference = value.getObjectRef( );
-
- if (theObjectFromStringifiedReference == null ) {
- try {
- theObjectFromStringifiedReference =
- orb.string_to_object( value.strObjectRef );
- value.setObjectRef( theObjectFromStringifiedReference );
- } catch( Exception e ) {
- throw readWrapper.resolveConversionFailure(
- CompletionStatus.COMPLETED_MAYBE, e );
- }
- }
- }
- } catch ( Exception e ) {
- throw readWrapper.resolveFailure(
- CompletionStatus.COMPLETED_MAYBE, e );
- }
-
- return theObjectFromStringifiedReference;
- }
-
- /**
- * This method Unbinds the NamingContext or Object Reference for one level
- * The doUnbind( ) method from superclass calls Unbind() to recursively
- * Unbind using compound Names.
- * @param n a sequence of NameComponents which is the name to be resolved.
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound Neither a NamingContext
- * or a Corba Object reference not found under this Name
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see Bind
- */
-
- public Object Unbind(NameComponent n) throws SystemException
- {
- try {
- InternalBindingKey key = new InternalBindingKey(n);
- InternalBindingValue value = null;
-
- try {
- value = (InternalBindingValue) this.theHashtable.remove(key);
- } catch( Exception e ) {
- // Ignore the exception in Hashtable.remove
- }
-
- theServantManagerImplHandle.updateContext( objKey, this );
-
- if( value == null ) {
- return null;
- }
-
- if( value.strObjectRef.startsWith( "NC" ) ) {
- theServantManagerImplHandle.readInContext( value.strObjectRef );
- Object theObjectFromStringfiedReference =
- theNameServiceHandle.getObjectReferenceFromKey( value.strObjectRef );
- return theObjectFromStringfiedReference;
- } else {
- Object theObjectFromStringifiedReference = value.getObjectRef( );
-
- if( theObjectFromStringifiedReference == null ) {
- theObjectFromStringifiedReference =
- orb.string_to_object( value.strObjectRef );
- }
-
- return theObjectFromStringifiedReference;
- }
- } catch( Exception e ) {
- throw updateWrapper.unbindFailure( CompletionStatus.COMPLETED_MAYBE, e );
- }
- }
-
- /**
- * List the contents of this NamingContext. It creates a new
- * PersistentBindingIterator object and passes it a clone of the
- * hash table and an orb object. It then uses the
- * newly created object to return the required number of bindings.
- * @param how_many The number of requested bindings in the BindingList.
- * @param bl The BindingList as an out parameter.
- * @param bi The BindingIterator as an out parameter.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
-
- public void List(int how_many, BindingListHolder bl,
- BindingIteratorHolder bi) throws SystemException
- {
- if( biPOA == null ) {
- createbiPOA( );
- }
- try {
- PersistentBindingIterator bindingIterator =
- new PersistentBindingIterator(this.orb,
- (Hashtable)this.theHashtable.clone(), biPOA);
- // Have it set the binding list
- bindingIterator.list(how_many,bl);
-
- byte[] objectId = biPOA.activate_object( bindingIterator );
- org.omg.CORBA.Object obj = biPOA.id_to_reference( objectId );
-
- // Get the object reference for the binding iterator servant
- org.omg.CosNaming.BindingIterator bindingRef =
- org.omg.CosNaming.BindingIteratorHelper.narrow( obj );
-
- bi.value = bindingRef;
- } catch (org.omg.CORBA.SystemException e) {
- throw e;
- } catch( Exception e ) {
- throw readWrapper.transNcListGotExc( e ) ;
- }
- }
-
- private synchronized void createbiPOA( ) {
- if( biPOA != null ) {
- return;
- }
- try {
- POA rootPOA = (POA) orb.resolve_initial_references(
- ORBConstants.ROOT_POA_NAME );
- rootPOA.the_POAManager().activate( );
-
- int i = 0;
- Policy[] poaPolicy = new Policy[3];
- poaPolicy[i++] = rootPOA.create_lifespan_policy(
- LifespanPolicyValue.TRANSIENT);
- poaPolicy[i++] = rootPOA.create_id_assignment_policy(
- IdAssignmentPolicyValue.SYSTEM_ID);
- poaPolicy[i++] = rootPOA.create_servant_retention_policy(
- ServantRetentionPolicyValue.RETAIN);
- biPOA = rootPOA.create_POA("BindingIteratorPOA", null, poaPolicy );
- biPOA.the_POAManager().activate( );
- } catch( Exception e ) {
- throw readWrapper.namingCtxBindingIteratorCreate( e ) ;
- }
- }
-
-
- /**
- * Create a NamingContext object and return its object reference.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- public NamingContext NewContext() throws SystemException
- {
- try {
- return theNameServiceHandle.NewContext( );
- } catch( org.omg.CORBA.SystemException e ) {
- throw e;
- } catch( Exception e ) {
- throw updateWrapper.transNcNewctxGotExc( e ) ;
- }
- }
-
-
- /**
- * Destroys the NamingContext.
- */
- public void Destroy() throws SystemException
- {
- // XXX note that orb.disconnect is illegal here, since the
- // POA is used. However, there may be some associated state
- // that needs to be cleaned up in ServerManagerImpl which we will
- // look into further at another time.
- /*
- // XXX This needs to be replaced by cleaning up the
- // file that backs up the naming context. No explicit
- // action is necessary at the POA level, since this is
- // created with the non-retain policy.
- /*
- try { orb.disconnect(
- theNameServiceHandle.getObjectReferenceFromKey( this.objKey ) );
- } catch( org.omg.CORBA.SystemException e ) {
- throw e;
- } catch( Exception e ) {
- throw updateWrapper.transNcDestroyGotEx( e ) ;
- }
- */
- }
-
- /**
- * This operation creates a stringified name from the array of Name
- * components.
- * @param n Name of the object <p>
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.<p>
- *
- */
- public String to_string(org.omg.CosNaming.NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if ( (n == null ) || (n.length == 0) )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
-
- String theStringifiedName = getINSImpl().convertToString( n );
-
- if( theStringifiedName == null )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
-
- return theStringifiedName;
- }
-
- /**
- * This operation converts a Stringified Name into an equivalent array
- * of Name Components.
- * @param sn Stringified Name of the object <p>
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.<p>
- *
- */
- public org.omg.CosNaming.NameComponent[] to_name(String sn)
- throws org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if ( (sn == null ) || (sn.length() == 0) )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
- org.omg.CosNaming.NameComponent[] theNameComponents =
- getINSImpl().convertToNameComponent( sn );
- if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
- for( int i = 0; i < theNameComponents.length; i++ ) {
- // If there is a name component whose id and kind null or
- // zero length string, then an invalid name exception needs to be
- // raised.
- if ( ( ( theNameComponents[i].id == null )
- ||( theNameComponents[i].id.length() == 0 ) )
- &&( ( theNameComponents[i].kind == null )
- ||( theNameComponents[i].kind.length() == 0 ) ) ) {
- throw new InvalidName();
- }
- }
- return theNameComponents;
- }
-
- /**
- * This operation creates a URL based "iiopname://" format name
- * from the Stringified Name of the object.
- * @param addr internet based address of the host machine where
- * Name Service is running <p>
- * @param sn Stringified Name of the object <p>
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.<p>
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
- * Indicates the internet based address of the host machine is
- * incorrect <p>
- *
- */
-
- public String to_url(String addr, String sn)
- throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if ( (sn == null ) || (sn.length() == 0) )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
- if( addr == null )
- {
- throw new org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
- }
- String urlBasedAddress = null;
- try {
- urlBasedAddress = getINSImpl().createURLBasedAddress( addr, sn );
- } catch (Exception e ) {
- urlBasedAddress = null;
- }
- // Extra check to see that corba name url created is valid as per
- // INS spec grammer.
- try {
- INSURLHandler.getINSURLHandler().parseURL( urlBasedAddress );
- } catch( BAD_PARAM e ) {
- throw new
- org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
- }
- return urlBasedAddress;
- }
-
- /**
- * This operation resolves the Stringified name into the object
- * reference.
- * @param sn Stringified Name of the object <p>
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * Indicates there is no object reference for the given name. <p>
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * Indicates that the given compound name is incorrect <p>
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.<p>
- *
- */
- public org.omg.CORBA.Object resolve_str(String sn)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- org.omg.CORBA.Object theObject = null;
- // Name valid?
- if ( (sn == null ) || (sn.length() == 0) )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
- org.omg.CosNaming.NameComponent[] theNameComponents =
- getINSImpl().convertToNameComponent( sn );
- if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
- theObject = resolve( theNameComponents );
- return theObject;
- }
-
- /**
- * This is a Debugging Method
- */
- public boolean IsEmpty()
- {
- return this.theHashtable.isEmpty();
- }
-
- /**
- * This is a Debugging Method
- */
- public void printSize( )
- {
- System.out.println( "Hashtable Size = " + theHashtable.size( ) );
- java.util.Enumeration e = theHashtable.keys( );
- for( ; e.hasMoreElements(); )
- {
- InternalBindingValue thevalue =
- (InternalBindingValue) this.theHashtable.get(e.nextElement());
- if( thevalue != null )
- {
- System.out.println( "value = " + thevalue.strObjectRef);
- }
- }
- }
-
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/PersistentBindingIterator.java b/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/PersistentBindingIterator.java
deleted file mode 100644
index 6215608..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/PersistentBindingIterator.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-// Import general CORBA classes
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.INTERNAL;
-
-// Get org.omg.CosNaming Types
-import org.omg.CosNaming.Binding;
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingTypeHolder;
-import org.omg.CosNaming.NameComponent;
-import org.omg.PortableServer.POA;
-
-// Get base implementation
-import com.sun.corba.se.impl.naming.pcosnaming.NamingContextImpl;
-import com.sun.corba.se.impl.naming.pcosnaming.InternalBindingValue;
-
-import com.sun.corba.se.impl.naming.cosnaming.BindingIteratorImpl;
-
-// Get a hash table
-import java.util.Hashtable;
-import java.util.Enumeration;
-
-/**
- * Class TransientBindingIterator implements the abstract methods
- * defined by BindingIteratorImpl, to use with the TransientNamingContext
- * implementation of the NamingContextImpl. The TransientBindingIterator
- * implementation receives a hash table of InternalBindingValues, and uses
- * an Enumeration to iterate over the contents of the hash table.
- * @see BindingIteratorImpl
- * @see TransientNamingContext
- */
-public class PersistentBindingIterator extends BindingIteratorImpl
-{
- private POA biPOA;
- /**
- * Constructs a new PersistentBindingIterator object.
- * @param orb a org.omg.CORBA.ORB object.
- * @param aTable A hashtable containing InternalBindingValues which is
- * the content of the PersistentNamingContext.
- * @param java.lang.Exception a Java exception.
- * @exception Exception a Java exception thrown of the base class cannot
- * initialize.
- */
- public PersistentBindingIterator(org.omg.CORBA.ORB orb, Hashtable aTable,
- POA thePOA ) throws java.lang.Exception
- {
- super(orb);
- this.orb = orb;
- theHashtable = aTable;
- theEnumeration = this.theHashtable.keys();
- currentSize = this.theHashtable.size();
- biPOA = thePOA;
- }
-
- /**
- * Returns the next binding in the NamingContext. Uses the enumeration
- * object to determine if there are more bindings and if so, returns
- * the next binding from the InternalBindingValue.
- * @param b The Binding as an out parameter.
- * @return true if there were more bindings.
- */
- final public boolean NextOne(org.omg.CosNaming.BindingHolder b)
- {
- // If there are more elements get the next element
- boolean hasMore = theEnumeration.hasMoreElements();
- if (hasMore) {
- InternalBindingKey theBindingKey =
- ((InternalBindingKey)theEnumeration.nextElement());
- InternalBindingValue theElement =
- (InternalBindingValue)theHashtable.get( theBindingKey );
- NameComponent n = new NameComponent( theBindingKey.id, theBindingKey.kind );
- NameComponent[] nlist = new NameComponent[1];
- nlist[0] = n;
- BindingType theType = theElement.theBindingType;
-
- b.value =
- new Binding( nlist, theType );
- } else {
- // Return empty but marshalable binding
- b.value = new Binding(new NameComponent[0],BindingType.nobject);
- }
- return hasMore;
- }
-
- /**
- * Destroys this BindingIterator by disconnecting from the ORB
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- final public void Destroy()
- {
- // Remove the object from the Active Object Map.
- try {
- byte[] objectId = biPOA.servant_to_id( this );
- if( objectId != null ) {
- biPOA.deactivate_object( objectId );
- }
- }
- catch( Exception e ) {
- throw new INTERNAL( "Exception in BindingIterator.Destroy " + e );
- }
- }
-
- /**
- * Returns the remaining number of elements in the iterator.
- * @return the remaining number of elements in the iterator.
- */
- public final int RemainingElements() {
- return currentSize;
- }
-
- private int currentSize;
- private Hashtable theHashtable;
- private Enumeration theEnumeration;
- private org.omg.CORBA.ORB orb;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/ServantManagerImpl.java b/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/ServantManagerImpl.java
deleted file mode 100644
index 4a2fff6..0000000
--- a/src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/ServantManagerImpl.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Hashtable;
-
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.LocalObject;
-
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.Servant;
-import org.omg.PortableServer.ForwardRequest;
-import org.omg.PortableServer.ServantLocator;
-import org.omg.PortableServer.LifespanPolicyValue;
-import org.omg.PortableServer.RequestProcessingPolicyValue;
-import org.omg.PortableServer.IdAssignmentPolicyValue;
-import org.omg.PortableServer.ServantRetentionPolicyValue;
-import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-/**
- * @author Rohit Garg
- * @since JDK1.2
- */
-
-public class ServantManagerImpl extends org.omg.CORBA.LocalObject implements ServantLocator
-{
-
- // computed using serialver tool
-
- private static final long serialVersionUID = 4028710359865748280L;
- private ORB orb;
-
- private NameService theNameService;
-
- private File logDir;
-
- private Hashtable contexts;
-
- private CounterDB counterDb;
-
- private int counter;
-
- private final static String objKeyPrefix = "NC";
-
- ServantManagerImpl(ORB orb, File logDir, NameService aNameService)
- {
- this.logDir = logDir;
- this.orb = orb;
- // initialize the counter database
- counterDb = new CounterDB(logDir);
- contexts = new Hashtable();
- theNameService = aNameService;
- }
-
-
- public Servant preinvoke(byte[] oid, POA adapter, String operation,
- CookieHolder cookie) throws ForwardRequest
- {
-
- String objKey = new String(oid);
-
- Servant servant = (Servant) contexts.get(objKey);
-
- if (servant == null)
- {
- servant = readInContext(objKey);
- }
-
- return servant;
- }
-
- public void postinvoke(byte[] oid, POA adapter, String operation,
- java.lang.Object cookie, Servant servant)
- {
- // nada
- }
-
- public NamingContextImpl readInContext(String objKey)
- {
- NamingContextImpl context = (NamingContextImpl) contexts.get(objKey);
- if( context != null )
- {
- // Returning Context from Cache
- return context;
- }
-
- File contextFile = new File(logDir, objKey);
- if (contextFile.exists()) {
- try {
- FileInputStream fis = new FileInputStream(contextFile);
- ObjectInputStream ois = new ObjectInputStream(fis);
- context = (NamingContextImpl) ois.readObject();
- context.setORB( orb );
- context.setServantManagerImpl( this );
- context.setRootNameService( theNameService );
- ois.close();
- } catch (Exception ex) {
- }
- }
-
- if (context != null)
- {
- contexts.put(objKey, context);
- }
- return context;
- }
-
- public NamingContextImpl addContext(String objKey,
- NamingContextImpl context)
- {
- File contextFile = new File(logDir, objKey);
-
- if (contextFile.exists())
- {
- context = readInContext(objKey);
- }
- else {
- try {
- FileOutputStream fos = new FileOutputStream(contextFile);
- ObjectOutputStream oos = new ObjectOutputStream(fos);
- oos.writeObject(context);
- oos.close();
- } catch (Exception ex) {
- }
- }
- try
- {
- contexts.remove( objKey );
- }
- catch( Exception e)
- {
- }
- contexts.put(objKey, context);
-
- return context;
- }
-
- public void updateContext( String objKey,
- NamingContextImpl context )
- {
- File contextFile = new File(logDir, objKey);
- if (contextFile.exists())
- {
- contextFile.delete( );
- contextFile = new File(logDir, objKey);
- }
-
- try {
- FileOutputStream fos = new FileOutputStream(contextFile);
- ObjectOutputStream oos = new ObjectOutputStream(fos);
- oos.writeObject(context);
- oos.close();
- } catch (Exception ex) {
- ex.printStackTrace( );
- }
- }
-
- public static String getRootObjectKey()
- {
- return objKeyPrefix + CounterDB.rootCounter;
- }
-
- public String getNewObjectKey()
- {
- return objKeyPrefix + counterDb.getNextCounter();
- }
-
-
-
-}
-
-class CounterDB implements Serializable
-{
-
- CounterDB (File logDir)
- {
- counterFileName = "counter";
- counterFile = new File(logDir, counterFileName);
- if (!counterFile.exists()) {
- counter = new Integer(rootCounter);
- writeCounter();
- } else {
- readCounter();
- }
- }
-
- private void readCounter()
- {
- try {
- FileInputStream fis = new FileInputStream(counterFile);
- ObjectInputStream ois = new ObjectInputStream(fis);
- counter = (Integer) ois.readObject();
- ois.close();
- } catch (Exception ex) {
- }
- }
-
- private void writeCounter()
- {
- try {
- counterFile.delete();
- FileOutputStream fos = new FileOutputStream(counterFile);
- ObjectOutputStream oos = new ObjectOutputStream(fos);
- oos.writeObject(counter);
- oos.flush();
- oos.close();
-
- } catch (Exception ex) {
- }
- }
-
- public synchronized int getNextCounter()
- {
- int counterVal = counter.intValue();
- counter = new Integer(++counterVal);
- writeCounter();
-
- return counterVal;
- }
-
-
-
- private Integer counter;
-
- private static String counterFileName = "counter";
-
- private transient File counterFile;
-
- public final static int rootCounter = 0;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/NullServantImpl.java b/src/share/classes/com/sun/corba/se/impl/oa/NullServantImpl.java
deleted file mode 100644
index 2e911d9..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/NullServantImpl.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa ;
-
-import org.omg.CORBA.SystemException ;
-
-import com.sun.corba.se.spi.oa.NullServant ;
-
-public class NullServantImpl implements NullServant
-{
- private SystemException sysex ;
-
- public NullServantImpl( SystemException ex )
- {
- this.sysex = ex ;
- }
-
- public SystemException getException()
- {
- return sysex ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java
deleted file mode 100644
index d906afe..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import org.omg.CORBA.INTERNAL ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.orbutil.fsm.Action ;
-import com.sun.corba.se.spi.orbutil.fsm.ActionBase ;
-import com.sun.corba.se.spi.orbutil.fsm.Guard ;
-import com.sun.corba.se.spi.orbutil.fsm.GuardBase ;
-import com.sun.corba.se.spi.orbutil.fsm.State ;
-import com.sun.corba.se.spi.orbutil.fsm.StateImpl ;
-import com.sun.corba.se.spi.orbutil.fsm.Input ;
-import com.sun.corba.se.spi.orbutil.fsm.InputImpl ;
-import com.sun.corba.se.spi.orbutil.fsm.FSM ;
-import com.sun.corba.se.spi.orbutil.fsm.FSMImpl ;
-import com.sun.corba.se.spi.orbutil.fsm.StateEngine ;
-import com.sun.corba.se.spi.orbutil.fsm.StateEngineFactory ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.Mutex ;
-import com.sun.corba.se.impl.orbutil.concurrent.CondVar ;
-
-import org.omg.CORBA.SystemException ;
-
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-
-/** AOMEntry represents a Servant or potential Servant in the ActiveObjectMap.
-* It may be in several states to allow for long incarnate or etherealize operations.
-* The methods on this class mostly represent input symbols to the state machine
-* that controls the lifecycle of the entry. A library is used to build the state
-* machine rather than the more usual state pattern so that the state machine
-* transitions are explicitly visible.
-*/
-public class AOMEntry extends FSMImpl {
- private final Thread[] etherealizer ; // The actual etherealize operation
- // for this entry. It is
- // represented as a Thread because
- // the POA.deactivate_object never
- // waits for the completion.
- private final int[] counter ; // single element holder for counter
- // accessed in actions
- private final CondVar wait ; // accessed in actions
-
- final POAImpl poa ;
-
- public static final State INVALID = new StateImpl( "Invalid" ) ;
- public static final State INCARN = new StateImpl( "Incarnating" ) {
- public void postAction( FSM fsm ) {
- AOMEntry entry = (AOMEntry)fsm ;
- entry.wait.broadcast() ;
- }
- };
- public static final State VALID = new StateImpl( "Valid" ) ;
- public static final State ETHP = new StateImpl( "EtherealizePending" ) ;
- public static final State ETH = new StateImpl( "Etherealizing" ) {
- public void preAction( FSM fsm ) {
- AOMEntry entry = (AOMEntry)fsm ;
- Thread etherealizer = entry.etherealizer[0] ;
- if (etherealizer != null)
- etherealizer.start() ;
- }
-
- public void postAction( FSM fsm ) {
- AOMEntry entry = (AOMEntry)fsm ;
- entry.wait.broadcast() ;
- }
- };
- public static final State DESTROYED = new StateImpl( "Destroyed" ) ;
-
- static final Input START_ETH = new InputImpl( "startEtherealize" ) ;
- static final Input ETH_DONE = new InputImpl( "etherealizeDone" ) ;
- static final Input INC_DONE = new InputImpl( "incarnateDone" ) ;
- static final Input INC_FAIL = new InputImpl( "incarnateFailure" ) ;
- static final Input ACTIVATE = new InputImpl( "activateObject" ) ;
- static final Input ENTER = new InputImpl( "enter" ) ;
- static final Input EXIT = new InputImpl( "exit" ) ;
-
- private static Action incrementAction = new ActionBase( "increment" ) {
- public void doIt( FSM fsm, Input in ) {
- AOMEntry entry = (AOMEntry)fsm ;
- entry.counter[0]++ ;
- }
- } ;
-
- private static Action decrementAction = new ActionBase( "decrement" ) {
- public void doIt( FSM fsm, Input in ) {
- AOMEntry entry = (AOMEntry)fsm ;
- if (entry.counter[0] > 0)
- entry.counter[0]-- ;
- else
- throw entry.poa.lifecycleWrapper().aomEntryDecZero() ;
- }
- } ;
-
- private static Action throwIllegalStateExceptionAction = new ActionBase(
- "throwIllegalStateException" ) {
- public void doIt( FSM fsm, Input in ) {
- throw new IllegalStateException(
- "No transitions allowed from the DESTROYED state" ) ;
- }
- } ;
-
- private static Action oaaAction = new ActionBase( "throwObjectAlreadyActive" ) {
- public void doIt( FSM fsm, Input in ) {
- throw new RuntimeException( new ObjectAlreadyActive() ) ;
- }
- } ;
-
- private static Guard waitGuard = new GuardBase( "wait" ) {
- public Guard.Result evaluate( FSM fsm, Input in ) {
- AOMEntry entry = (AOMEntry)fsm ;
- try {
- entry.wait.await() ;
- } catch (InterruptedException exc) {
- // XXX Log this
- // NO-OP
- }
-
- return Guard.Result.DEFERED ;
- }
- } ;
-
-
- private static class CounterGuard extends GuardBase {
- private int value ;
-
- public CounterGuard( int value )
- {
- super( "counter>" + value ) ;
- this.value = value ;
- }
-
- public Guard.Result evaluate( FSM fsm, Input in )
- {
- AOMEntry entry = (AOMEntry)fsm ;
- return Guard.Result.convert( entry.counter[0] > value ) ;
- }
- } ;
-
- private static GuardBase greaterZeroGuard = new CounterGuard( 0 ) ;
- private static Guard zeroGuard = new Guard.Complement( greaterZeroGuard ) ;
- private static GuardBase greaterOneGuard = new CounterGuard( 1 ) ;
- private static Guard oneGuard = new Guard.Complement( greaterOneGuard ) ;
-
- private static StateEngine engine ;
-
- static {
- engine = StateEngineFactory.create() ;
-
- // State, Input, Guard, Action, new State
-
- engine.add( INVALID, ENTER, incrementAction, INCARN ) ;
- engine.add( INVALID, ACTIVATE, null, VALID ) ;
- engine.setDefault( INVALID ) ;
-
- engine.add( INCARN, ENTER, waitGuard, null, INCARN ) ;
- engine.add( INCARN, EXIT, null, INCARN ) ;
- engine.add( INCARN, START_ETH, waitGuard, null, INCARN ) ;
- engine.add( INCARN, INC_DONE, null, VALID ) ;
- engine.add( INCARN, INC_FAIL, decrementAction, INVALID ) ;
- engine.add( INCARN, ACTIVATE, oaaAction, INCARN ) ;
-
- engine.add( VALID, ENTER, incrementAction, VALID ) ;
- engine.add( VALID, EXIT, decrementAction, VALID ) ;
- engine.add( VALID, START_ETH, greaterZeroGuard, null, ETHP ) ;
- engine.add( VALID, START_ETH, zeroGuard, null, ETH ) ;
- engine.add( VALID, ACTIVATE, oaaAction, VALID ) ;
-
- engine.add( ETHP, ENTER, waitGuard, null, ETHP ) ;
- engine.add( ETHP, START_ETH, null, ETHP ) ;
- engine.add( ETHP, EXIT, greaterOneGuard, decrementAction, ETHP ) ;
- engine.add( ETHP, EXIT, oneGuard, decrementAction, ETH ) ;
- engine.add( ETHP, ACTIVATE, oaaAction, ETHP ) ;
-
- engine.add( ETH, START_ETH, null, ETH ) ;
- engine.add( ETH, ETH_DONE, null, DESTROYED ) ;
- engine.add( ETH, ACTIVATE, oaaAction, ETH ) ;
- engine.add( ETH, ENTER, waitGuard, null, ETH ) ;
-
- engine.setDefault( DESTROYED, throwIllegalStateExceptionAction, DESTROYED ) ;
-
- engine.done() ;
- }
-
- public AOMEntry( POAImpl poa )
- {
- super( engine, INVALID, ((ORB)poa.getORB()).poaFSMDebugFlag ) ;
- this.poa = poa ;
- etherealizer = new Thread[1] ;
- etherealizer[0] = null ;
- counter = new int[1] ;
- counter[0] = 0 ;
- wait = new CondVar( poa.poaMutex,
- ((ORB)poa.getORB()).poaConcurrencyDebugFlag ) ;
- }
-
- // Methods that drive the FSM: the real interface to this class
- // Most just call the doIt method, but startEtherealize needs
- // the etherealizer.
- public void startEtherealize( Thread etherealizer )
- {
- this.etherealizer[0] = etherealizer ;
- doIt( START_ETH ) ;
- }
-
- public void etherealizeComplete() { doIt( ETH_DONE ) ; }
- public void incarnateComplete() { doIt( INC_DONE ) ; }
- public void incarnateFailure() { doIt( INC_FAIL ) ; }
- public void activateObject() throws ObjectAlreadyActive {
- try {
- doIt( ACTIVATE ) ;
- } catch (RuntimeException exc) {
- Throwable thr = exc.getCause() ;
- if (thr instanceof ObjectAlreadyActive)
- throw (ObjectAlreadyActive)thr ;
- else
- throw exc ;
- }
- }
- public void enter() { doIt( ENTER ) ; }
- public void exit() { doIt( EXIT ) ; }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/ActiveObjectMap.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/ActiveObjectMap.java
deleted file mode 100644
index f1136df..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/ActiveObjectMap.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import java.util.Set ;
-import java.util.HashSet ;
-import java.util.Map ;
-import java.util.HashMap ;
-import java.util.Iterator ;
-import java.util.Vector ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.CORBA.INTERNAL ;
-
-/** The ActiveObjectMap maintains associations between servants and
- * their keys. There are two variants, to support whether or not
- * multiple IDs per servant are allowed. This class suppots bidirectional
- * traversal of the key-servant association. Access to an instance of this
- * class is serialized by the POA mutex.
- */
-public abstract class ActiveObjectMap
-{
- public static class Key {
- public byte[] id;
-
- Key(byte[] id) {
- this.id = id;
- }
-
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- for(int i = 0; i < id.length; i++) {
- buffer.append(Integer.toString((int) id[i], 16));
- if (i != id.length-1)
- buffer.append(":");
- }
- return buffer.toString();
- }
-
- public boolean equals(java.lang.Object key) {
- if (!(key instanceof Key))
- return false;
- Key k = (Key) key;
- if (k.id.length != this.id.length)
- return false;
- for(int i = 0; i < this.id.length; i++)
- if (this.id[i] != k.id[i])
- return false;
- return true;
- }
-
- // Use the same hash function as for String
- public int hashCode() {
- int h = 0;
- for (int i = 0; i < id.length; i++)
- h = 31*h + id[i];
- return h;
- }
- }
-
- protected POAImpl poa ;
-
- protected ActiveObjectMap( POAImpl poa )
- {
- this.poa = poa ;
- }
-
- public static ActiveObjectMap create( POAImpl poa, boolean multipleIDsAllowed )
- {
- if (multipleIDsAllowed)
- return new MultipleObjectMap( poa ) ;
- else
- return new SingleObjectMap(poa ) ;
- }
-
- private Map keyToEntry = new HashMap() ; // Map< Key, AOMEntry >
- private Map entryToServant = new HashMap() ; // Map< AOMEntry, Servant >
- private Map servantToEntry = new HashMap() ; // Map< Servant, AOMEntry >
-
- public final boolean contains(Servant value)
- {
- return servantToEntry.containsKey( value ) ;
- }
-
- public final boolean containsKey(Key key)
- {
- return keyToEntry.containsKey(key);
- }
-
- /** get Returbs the entry assigned to the key, or creates a new
- * entry in state INVALID if none is present.
- */
- public final AOMEntry get(Key key)
- {
- AOMEntry result = (AOMEntry)keyToEntry.get(key);
- if (result == null) {
- result = new AOMEntry( poa ) ;
- putEntry( key, result ) ;
- }
-
- return result ;
- }
-
- public final Servant getServant( AOMEntry entry )
- {
- return (Servant)entryToServant.get( entry ) ;
- }
-
- public abstract Key getKey(AOMEntry value) throws WrongPolicy ;
-
- public Key getKey(Servant value) throws WrongPolicy
- {
- AOMEntry entry = (AOMEntry)servantToEntry.get( value ) ;
- return getKey( entry ) ;
- }
-
- protected void putEntry( Key key, AOMEntry value )
- {
- keyToEntry.put( key, value ) ;
- }
-
- public final void putServant( Servant servant, AOMEntry value )
- {
- entryToServant.put( value, servant ) ;
- servantToEntry.put( servant, value ) ;
- }
-
- protected abstract void removeEntry( AOMEntry entry, Key key ) ;
-
- public final void remove( Key key )
- {
- AOMEntry entry = (AOMEntry)keyToEntry.remove( key ) ;
- Servant servant = (Servant)entryToServant.remove( entry ) ;
- if (servant != null)
- servantToEntry.remove( servant ) ;
-
- removeEntry( entry, key ) ;
- }
-
- public abstract boolean hasMultipleIDs(AOMEntry value) ;
-
- protected void clear()
- {
- keyToEntry.clear();
- }
-
- public final Set keySet()
- {
- return keyToEntry.keySet() ;
- }
-}
-
-class SingleObjectMap extends ActiveObjectMap
-{
- private Map entryToKey = new HashMap() ; // Map< AOMEntry, Key >
-
- public SingleObjectMap( POAImpl poa )
- {
- super( poa ) ;
- }
-
- public Key getKey(AOMEntry value) throws WrongPolicy
- {
- return (Key)entryToKey.get( value ) ;
- }
-
- protected void putEntry(Key key, AOMEntry value)
- {
- super.putEntry( key, value);
-
- entryToKey.put( value, key ) ;
- }
-
- public boolean hasMultipleIDs(AOMEntry value)
- {
- return false;
- }
-
- // This case does not need the key.
- protected void removeEntry(AOMEntry entry, Key key)
- {
- entryToKey.remove( entry ) ;
- }
-
- public void clear()
- {
- super.clear() ;
- entryToKey.clear() ;
- }
-}
-
-class MultipleObjectMap extends ActiveObjectMap
-{
- private Map entryToKeys = new HashMap() ; // Map< AOMEntry, Set< Key > >
-
- public MultipleObjectMap( POAImpl poa )
- {
- super( poa ) ;
- }
-
- public Key getKey(AOMEntry value) throws WrongPolicy
- {
- throw new WrongPolicy() ;
- }
-
- protected void putEntry(Key key, AOMEntry value)
- {
- super.putEntry( key, value);
-
- Set set = (Set)entryToKeys.get( value ) ;
- if (set == null) {
- set = new HashSet() ;
- entryToKeys.put( value, set ) ;
- }
- set.add( key ) ;
- }
-
- public boolean hasMultipleIDs(AOMEntry value)
- {
- Set set = (Set)entryToKeys.get( value ) ;
- if (set == null)
- return false ;
- return set.size() > 1 ;
- }
-
- protected void removeEntry(AOMEntry entry, Key key)
- {
- Set keys = (Set)entryToKeys.get( entry ) ;
- if (keys != null) {
- keys.remove( key ) ;
- if (keys.isEmpty())
- entryToKeys.remove( entry ) ;
- }
- }
-
- public void clear()
- {
- super.clear() ;
- entryToKeys.clear() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/BadServerIdHandler.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/BadServerIdHandler.java
deleted file mode 100644
index 5899cd6..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/BadServerIdHandler.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import com.sun.corba.se.spi.ior.ObjectKey;
-
-/**
- * The bad server id handler is used to locate persistent objects.
- * The Locator object registers the BadServerIdHandler with the ORB
- * and when requests for persistent objects for servers (other than
- * itself) comes, it throws a ForwardException with the IOR pointing
- * to the active server.
- */
-public interface BadServerIdHandler
-{
- void handle(ObjectKey objectKey) ;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/DelegateImpl.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/DelegateImpl.java
deleted file mode 100644
index 2cc2cad..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/DelegateImpl.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, 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.
- */
-package com.sun.corba.se.impl.oa.poa;
-
-import java.util.EmptyStackException;
-
-import org.omg.PortableServer.*;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.logging.POASystemException ;
-
-public class DelegateImpl implements org.omg.PortableServer.portable.Delegate
-{
- private ORB orb ;
- private POASystemException wrapper ;
- private POAFactory factory;
-
- public DelegateImpl(ORB orb, POAFactory factory){
- this.orb = orb ;
- this.wrapper = POASystemException.get( orb,
- CORBALogDomains.OA ) ;
- this.factory = factory;
- }
-
- public org.omg.CORBA.ORB orb(Servant self)
- {
- return orb;
- }
-
- public org.omg.CORBA.Object this_object(Servant self)
- {
- byte[] oid;
- POA poa;
- try {
- oid = orb.peekInvocationInfo().id();
- poa = (POA)orb.peekInvocationInfo().oa();
- String repId = self._all_interfaces(poa,oid)[0] ;
- return poa.create_reference_with_id(oid, repId);
- } catch (EmptyStackException notInInvocationE) {
- //Not within an invocation context
- POAImpl defaultPOA = null;
- try {
- defaultPOA = (POAImpl)self._default_POA();
- } catch (ClassCastException exception){
- throw wrapper.defaultPoaNotPoaimpl( exception ) ;
- }
-
- try {
- if (defaultPOA.getPolicies().isImplicitlyActivated() ||
- (defaultPOA.getPolicies().isUniqueIds() &&
- defaultPOA.getPolicies().retainServants())) {
- return defaultPOA.servant_to_reference(self);
- } else {
- throw wrapper.wrongPoliciesForThisObject() ;
- }
- } catch ( org.omg.PortableServer.POAPackage.ServantNotActive e) {
- throw wrapper.thisObjectServantNotActive( e ) ;
- } catch ( org.omg.PortableServer.POAPackage.WrongPolicy e) {
- throw wrapper.thisObjectWrongPolicy( e ) ;
- }
- } catch (ClassCastException e) {
- throw wrapper.defaultPoaNotPoaimpl( e ) ;
- }
- }
-
- public POA poa(Servant self)
- {
- try {
- return (POA)orb.peekInvocationInfo().oa();
- } catch (EmptyStackException exception){
- POA returnValue = factory.lookupPOA(self);
- if (returnValue != null) {
- return returnValue;
- }
-
- throw wrapper.noContext( exception ) ;
- }
- }
-
- public byte[] object_id(Servant self)
- {
- try{
- return orb.peekInvocationInfo().id();
- } catch (EmptyStackException exception){
- throw wrapper.noContext(exception) ;
- }
- }
-
- public POA default_POA(Servant self)
- {
- return factory.getRootPOA();
- }
-
- public boolean is_a(Servant self, String repId)
- {
- String[] repositoryIds = self._all_interfaces(poa(self),object_id(self));
- for ( int i=0; i<repositoryIds.length; i++ )
- if ( repId.equals(repositoryIds[i]) )
- return true;
-
- return false;
- }
-
- public boolean non_existent(Servant self)
- {
- //REVISIT
- try{
- byte[] oid = orb.peekInvocationInfo().id();
- if( oid == null) return true;
- else return false;
- } catch (EmptyStackException exception){
- throw wrapper.noContext(exception) ;
- }
- }
-
- // The get_interface() method has been replaced by get_interface_def()
-
- public org.omg.CORBA.Object get_interface_def(Servant Self)
- {
- throw wrapper.methodNotImplemented() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/IdAssignmentPolicyImpl.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/IdAssignmentPolicyImpl.java
deleted file mode 100644
index 22fc566..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/IdAssignmentPolicyImpl.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import org.omg.CORBA.*;
-import org.omg.PortableServer.*;
-
-final class IdAssignmentPolicyImpl
-extends org.omg.CORBA.LocalObject
-implements org.omg.PortableServer.IdAssignmentPolicy {
-
- public IdAssignmentPolicyImpl(IdAssignmentPolicyValue value) {
- this.value = value;
- }
-
- public IdAssignmentPolicyValue value() {
- return value;
- }
-
- public int policy_type()
- {
- return ID_ASSIGNMENT_POLICY_ID.value ;
- }
-
- public Policy copy() {
- return new IdAssignmentPolicyImpl(value);
- }
-
- public void destroy() {
- value = null;
- }
-
- private IdAssignmentPolicyValue value;
-
- public String toString()
- {
- return "IdAssignmentPolicy[" +
- ((value.value() == IdAssignmentPolicyValue._USER_ID) ?
- "USER_ID" : "SYSTEM_ID" + "]") ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/IdUniquenessPolicyImpl.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/IdUniquenessPolicyImpl.java
deleted file mode 100644
index af37b43..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/IdUniquenessPolicyImpl.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import org.omg.CORBA.*;
-import org.omg.PortableServer.*;
-
-final class IdUniquenessPolicyImpl
- extends org.omg.CORBA.LocalObject implements IdUniquenessPolicy {
-
- public IdUniquenessPolicyImpl(IdUniquenessPolicyValue value) {
- this.value = value;
- }
-
- public IdUniquenessPolicyValue value() {
- return value;
- }
-
- public int policy_type()
- {
- return ID_UNIQUENESS_POLICY_ID.value ;
- }
-
- public Policy copy() {
- return new IdUniquenessPolicyImpl(value);
- }
-
- public void destroy() {
- value = null;
- }
-
- private IdUniquenessPolicyValue value;
-
- public String toString()
- {
- return "IdUniquenessPolicy[" +
- ((value.value() == IdUniquenessPolicyValue._UNIQUE_ID) ?
- "UNIQUE_ID" : "MULTIPLE_ID" + "]") ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/ImplicitActivationPolicyImpl.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/ImplicitActivationPolicyImpl.java
deleted file mode 100644
index fe85503..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/ImplicitActivationPolicyImpl.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import org.omg.CORBA.*;
-import org.omg.PortableServer.*;
-
-final class ImplicitActivationPolicyImpl
- extends org.omg.CORBA.LocalObject implements ImplicitActivationPolicy {
-
- public
- ImplicitActivationPolicyImpl(ImplicitActivationPolicyValue
- value) {
- this.value = value;
- }
-
- public ImplicitActivationPolicyValue value() {
- return value;
- }
-
- public int policy_type()
- {
- return IMPLICIT_ACTIVATION_POLICY_ID.value ;
- }
-
- public Policy copy() {
- return new ImplicitActivationPolicyImpl(value);
- }
-
- public void destroy() {
- value = null;
- }
-
- private ImplicitActivationPolicyValue value;
-
- public String toString()
- {
- return "ImplicitActivationPolicy[" +
- ((value.value() == ImplicitActivationPolicyValue._IMPLICIT_ACTIVATION) ?
- "IMPLICIT_ACTIVATION" : "NO_IMPLICIT_ACTIVATION" + "]") ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/LifespanPolicyImpl.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/LifespanPolicyImpl.java
deleted file mode 100644
index 92d3a20..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/LifespanPolicyImpl.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import org.omg.CORBA.*;
-import org.omg.PortableServer.*;
-
-final class LifespanPolicyImpl
- extends org.omg.CORBA.LocalObject implements LifespanPolicy {
-
- public LifespanPolicyImpl(LifespanPolicyValue value) {
- this.value = value;
- }
-
- public LifespanPolicyValue value() {
- return value;
- }
-
- public int policy_type()
- {
- return LIFESPAN_POLICY_ID.value ;
- }
-
- public Policy copy() {
- return new LifespanPolicyImpl(value);
- }
-
- public void destroy() {
- value = null;
- }
-
- private LifespanPolicyValue value;
-
- public String toString()
- {
- return "LifespanPolicy[" +
- ((value.value() == LifespanPolicyValue._TRANSIENT) ?
- "TRANSIENT" : "PERSISTENT" + "]") ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POACurrent.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POACurrent.java
deleted file mode 100644
index c31cca9..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POACurrent.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import java.util.*;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.PortableServer.CurrentPackage.NoContext;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.Servant;
-import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
-
-import com.sun.corba.se.spi.oa.OAInvocationInfo ;
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.logging.POASystemException ;
-
-// XXX Needs to be turned into LocalObjectImpl.
-
-public class POACurrent extends org.omg.CORBA.portable.ObjectImpl
- implements org.omg.PortableServer.Current
-{
- private ORB orb;
- private POASystemException wrapper ;
-
- public POACurrent(ORB orb)
- {
- this.orb = orb;
- wrapper = POASystemException.get( orb,
- CORBALogDomains.OA_INVOCATION ) ;
- }
-
- public String[] _ids()
- {
- String[] ids = new String[1];
- ids[0] = "IDL:omg.org/PortableServer/Current:1.0";
- return ids;
- }
-
- //
- // Standard OMG operations.
- //
-
- public POA get_POA()
- throws
- NoContext
- {
- POA poa = (POA)(peekThrowNoContext().oa());
- throwNoContextIfNull(poa);
- return poa;
- }
-
- public byte[] get_object_id()
- throws
- NoContext
- {
- byte[] objectid = peekThrowNoContext().id();
- throwNoContextIfNull(objectid);
- return objectid;
- }
-
- //
- // Implementation operations used by POA package.
- //
-
- public ObjectAdapter getOA()
- {
- ObjectAdapter oa = peekThrowInternal().oa();
- throwInternalIfNull(oa);
- return oa;
- }
-
- public byte[] getObjectId()
- {
- byte[] objectid = peekThrowInternal().id();
- throwInternalIfNull(objectid);
- return objectid;
- }
-
- Servant getServant()
- {
- Servant servant = (Servant)(peekThrowInternal().getServantContainer());
- // If is OK for the servant to be null.
- // This could happen if POAImpl.getServant is called but
- // POAImpl.internalGetServant throws an exception.
- return servant;
- }
-
- CookieHolder getCookieHolder()
- {
- CookieHolder cookieHolder = peekThrowInternal().getCookieHolder();
- throwInternalIfNull(cookieHolder);
- return cookieHolder;
- }
-
- // This is public so we can test the stack balance.
- // It is not a security hole since this same info can be obtained from
- // PortableInterceptors.
- public String getOperation()
- {
- String operation = peekThrowInternal().getOperation();
- throwInternalIfNull(operation);
- return operation;
- }
-
- void setServant(Servant servant)
- {
- peekThrowInternal().setServant( servant );
- }
-
- //
- // Class utilities.
- //
-
- private OAInvocationInfo peekThrowNoContext()
- throws
- NoContext
- {
- OAInvocationInfo invocationInfo = null;
- try {
- invocationInfo = orb.peekInvocationInfo() ;
- } catch (EmptyStackException e) {
- throw new NoContext();
- }
- return invocationInfo;
- }
-
- private OAInvocationInfo peekThrowInternal()
- {
- OAInvocationInfo invocationInfo = null;
- try {
- invocationInfo = orb.peekInvocationInfo() ;
- } catch (EmptyStackException e) {
- // The completion status is maybe because this could happen
- // after the servant has been invoked.
- throw wrapper.poacurrentUnbalancedStack( e ) ;
- }
- return invocationInfo;
- }
-
- private void throwNoContextIfNull(Object o)
- throws
- NoContext
- {
- if ( o == null ) {
- throw new NoContext();
- }
- }
-
- private void throwInternalIfNull(Object o)
- {
- if ( o == null ) {
- throw wrapper.poacurrentNullField( CompletionStatus.COMPLETED_MAYBE ) ;
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAFactory.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAFactory.java
deleted file mode 100644
index 10840d2..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAFactory.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright (c) 2002, 2009, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import java.util.Set ;
-import java.util.HashSet ;
-import java.util.Collections ;
-import java.util.Iterator ;
-import java.util.Map ;
-import java.util.WeakHashMap ;
-
-import org.omg.CORBA.OBJECT_NOT_EXIST ;
-import org.omg.CORBA.TRANSIENT ;
-
-import org.omg.CORBA.ORBPackage.InvalidName ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.POA ;
-import org.omg.PortableServer.POAManager ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
-
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.orbutil.closure.Closure ;
-import com.sun.corba.se.spi.orbutil.closure.ClosureFactory ;
-
-import com.sun.corba.se.spi.protocol.PIHandler ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.logging.POASystemException ;
-import com.sun.corba.se.impl.logging.OMGSystemException ;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.impl.oa.poa.POAManagerImpl ;
-
-public class POAFactory implements ObjectAdapterFactory
-{
- // Maps servants to POAs for deactivating servants when unexportObject is called.
- // Maintained by POAs activate_object and deactivate_object.
- private Map exportedServantsToPOA = new WeakHashMap();
-
- private Set poaManagers ;
- private int poaManagerId ;
- private int poaId ;
- private POAImpl rootPOA ;
- private DelegateImpl delegateImpl;
- private ORB orb ;
- private POASystemException wrapper ;
- private OMGSystemException omgWrapper ;
- private boolean isShuttingDown = false;
-
- public POASystemException getWrapper()
- {
- return wrapper ;
- }
-
- /** All object adapter factories must have a no-arg constructor.
- */
- public POAFactory()
- {
- poaManagers = Collections.synchronizedSet(new HashSet(4));
- poaManagerId = 0 ;
- poaId = 0 ;
- rootPOA = null ;
- delegateImpl = null ;
- orb = null ;
- }
-
- public synchronized POA lookupPOA (Servant servant)
- {
- return (POA)exportedServantsToPOA.get(servant);
- }
-
- public synchronized void registerPOAForServant(POA poa, Servant servant)
- {
- exportedServantsToPOA.put(servant, poa);
- }
-
- public synchronized void unregisterPOAForServant(POA poa, Servant servant)
- {
- exportedServantsToPOA.remove(servant);
- }
-
-// Implementation of ObjectAdapterFactory interface
-
- public void init( ORB orb )
- {
- this.orb = orb ;
- wrapper = POASystemException.get( orb,
- CORBALogDomains.OA_LIFECYCLE ) ;
- omgWrapper = OMGSystemException.get( orb,
- CORBALogDomains.OA_LIFECYCLE ) ;
- delegateImpl = new DelegateImpl( orb, this ) ;
- registerRootPOA() ;
-
- POACurrent poaCurrent = new POACurrent(orb);
- orb.getLocalResolver().register( ORBConstants.POA_CURRENT_NAME,
- ClosureFactory.makeConstant( poaCurrent ) ) ;
- }
-
- public ObjectAdapter find( ObjectAdapterId oaid )
- {
- POA poa=null;
- try {
- boolean first = true ;
- Iterator iter = oaid.iterator() ;
- poa = getRootPOA();
- while (iter.hasNext()) {
- String name = (String)(iter.next()) ;
-
- if (first) {
- if (!name.equals( ORBConstants.ROOT_POA_NAME ))
- throw wrapper.makeFactoryNotPoa( name ) ;
- first = false ;
- } else {
- poa = poa.find_POA( name, true ) ;
- }
- }
- } catch ( org.omg.PortableServer.POAPackage.AdapterNonExistent ex ){
- throw omgWrapper.noObjectAdaptor( ex ) ;
- } catch ( OBJECT_NOT_EXIST ex ) {
- throw ex;
- } catch ( TRANSIENT ex ) {
- throw ex;
- } catch ( Exception ex ) {
- throw wrapper.poaLookupError( ex ) ;
- }
-
- if ( poa == null )
- throw wrapper.poaLookupError() ;
-
- return (ObjectAdapter)poa;
- }
-
- public void shutdown( boolean waitForCompletion )
- {
- // It is important to copy the list of POAManagers first because
- // pm.deactivate removes itself from poaManagers!
- Iterator managers = null ;
- synchronized (this) {
- isShuttingDown = true ;
- managers = (new HashSet(poaManagers)).iterator();
- }
-
- while ( managers.hasNext() ) {
- try {
- ((POAManager)managers.next()).deactivate(true, waitForCompletion);
- } catch ( org.omg.PortableServer.POAManagerPackage.AdapterInactive e ) {}
- }
- }
-
-// Special methods used to manipulate global POA related state
-
- public synchronized void removePoaManager( POAManager manager )
- {
- poaManagers.remove(manager);
- }
-
- public synchronized void addPoaManager( POAManager manager )
- {
- poaManagers.add(manager);
- }
-
- synchronized public int newPOAManagerId()
- {
- return poaManagerId++ ;
- }
-
- public void registerRootPOA()
- {
- // We delay the evaluation of makeRootPOA until
- // a call to resolve_initial_references( "RootPOA" ).
- // The Future guarantees that makeRootPOA is only called once.
- Closure rpClosure = new Closure() {
- public Object evaluate() {
- return POAImpl.makeRootPOA( orb ) ;
- }
- } ;
-
- orb.getLocalResolver().register( ORBConstants.ROOT_POA_NAME,
- ClosureFactory.makeFuture( rpClosure ) ) ;
- }
-
-
- public synchronized POA getRootPOA()
- {
- if (rootPOA == null) {
- // See if we are trying to getRootPOA while shutting down the ORB.
- if (isShuttingDown) {
- throw omgWrapper.noObjectAdaptor( ) ;
- }
-
- try {
- Object obj = orb.resolve_initial_references(
- ORBConstants.ROOT_POA_NAME ) ;
- rootPOA = (POAImpl)obj ;
- } catch (InvalidName inv) {
- throw wrapper.cantResolveRootPoa( inv ) ;
- }
- }
-
- return rootPOA;
- }
-
- public org.omg.PortableServer.portable.Delegate getDelegateImpl()
- {
- return delegateImpl ;
- }
-
- synchronized public int newPOAId()
- {
- return poaId++ ;
- }
-
- public ORB getORB()
- {
- return orb ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAImpl.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAImpl.java
deleted file mode 100644
index 0698aaf..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAImpl.java
+++ /dev/null
@@ -1,1692 +0,0 @@
-/*
- * Copyright (c) 1997, 2004, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import java.util.Collection ;
-import java.util.Set ;
-import java.util.HashSet ;
-import java.util.Map ;
-import java.util.HashMap ;
-import java.util.Iterator ;
-
-import org.omg.CORBA.Policy ;
-import org.omg.CORBA.SystemException ;
-
-import org.omg.PortableServer.POA ;
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.POAManager ;
-import org.omg.PortableServer.AdapterActivator ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.ThreadPolicy;
-import org.omg.PortableServer.LifespanPolicy;
-import org.omg.PortableServer.IdUniquenessPolicy;
-import org.omg.PortableServer.IdAssignmentPolicy;
-import org.omg.PortableServer.ImplicitActivationPolicy;
-import org.omg.PortableServer.ServantRetentionPolicy;
-import org.omg.PortableServer.RequestProcessingPolicy;
-import org.omg.PortableServer.ThreadPolicyValue ;
-import org.omg.PortableServer.LifespanPolicyValue ;
-import org.omg.PortableServer.IdUniquenessPolicyValue ;
-import org.omg.PortableServer.IdAssignmentPolicyValue ;
-import org.omg.PortableServer.ImplicitActivationPolicyValue ;
-import org.omg.PortableServer.ServantRetentionPolicyValue ;
-import org.omg.PortableServer.RequestProcessingPolicyValue ;
-import org.omg.PortableServer.POAPackage.AdapterAlreadyExists ;
-import org.omg.PortableServer.POAPackage.AdapterNonExistent ;
-import org.omg.PortableServer.POAPackage.InvalidPolicy ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.WrongAdapter ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-
-import org.omg.PortableInterceptor.ObjectReferenceFactory ;
-import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
-import org.omg.PortableInterceptor.NON_EXISTENT ;
-
-import org.omg.IOP.TAG_INTERNET_IOP ;
-
-import com.sun.corba.se.spi.copyobject.CopierManager ;
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
-import com.sun.corba.se.spi.oa.OADestroyed ;
-import com.sun.corba.se.spi.oa.OAInvocationInfo ;
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-import com.sun.corba.se.spi.oa.ObjectAdapterBase ;
-import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-import com.sun.corba.se.spi.ior.IOR ;
-import com.sun.corba.se.spi.ior.IORFactories ;
-import com.sun.corba.se.spi.ior.IORTemplate ;
-import com.sun.corba.se.spi.ior.IORTemplateList ;
-import com.sun.corba.se.spi.ior.TaggedProfile ;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.protocol.ForwardException ;
-import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
-
-import com.sun.corba.se.impl.ior.POAObjectKeyTemplate ;
-import com.sun.corba.se.impl.ior.ObjectAdapterIdArray ;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.concurrent.Sync ;
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-import com.sun.corba.se.impl.orbutil.concurrent.ReentrantMutex ;
-import com.sun.corba.se.impl.orbutil.concurrent.CondVar ;
-
-/**
- * POAImpl is the implementation of the Portable Object Adapter. It
- * contains an implementation of the POA interfaces specified in
- * COBRA 2.3.1 chapter 11 (formal/99-10-07). This implementation
- * is moving to comply with CORBA 3.0 due to the many clarifications
- * that have been made to the POA semantics since CORBA 2.3.1.
- * Specific comments have been added where 3.0 applies, but note that
- * we do not have the new 3.0 APIs yet.
- */
-public class POAImpl extends ObjectAdapterBase implements POA
-{
- private boolean debug ;
-
- /* POA creation takes place in 2 stages: first, the POAImpl constructor is
- called, then the initialize method is called. This separation is
- needed because an AdapterActivator does not know the POAManager or
- the policies when
- the unknown_adapter method is invoked. However, the POA must be created
- before the unknown_adapter method is invoked, so that the parent knows
- when concurrent attempts are made to create the same POA.
- Calling the POAImpl constructor results in a new POA in state STATE_START.
- Calling initialize( POAManager, Policies ) results in state STATE_RUN.
- Calling destroy results in STATE_DESTROY, which marks the beginning of
- POA destruction.
- */
-
- // Notes on concurrency.
- // The POA requires careful design for concurrency management to correctly
- // implement the specification and avoid deadlocks. The order of acquiring
- // locks must respect the following locking hierarchy:
- //
- // 1. Lock POAs before POAManagers
- // 2. Lock a POA before locking its child POA
- //
- // Also note that there are 3 separate conditions on which threads may wait
- // in the POA, as defined by invokeCV, beingDestroyedCV, and
- // adapterActivatorCV. This means that (for this reason as well as others)
- // we cannot simply use the standard Java synchronized primitive.
- // This implementation uses a modified version of Doug Lea's
- // util.concurrent (version 1.3.0) that supports reentrant
- // mutexes to handle the locking. This will all be replaced by the new JSR
- // 166 concurrency primitives in J2SE 1.5 and later once the ORB moves to
- // J2SE 1.5.
-
- // POA state constants
- //
- // Note that ordering is important here: we must have the state defined in
- // this order so that ordered comparison is possible.
- // DO NOT CHANGE THE VALUES OF THE STATE CONSTANTS!!! In particular, the
- // initialization related states must be lower than STATE_RUN.
- //
- // POA is created in STATE_START
- //
- // Valid state transitions:
- //
- // START to INIT after find_POA constructor call
- // START to RUN after initialize completes
- // INIT to INIT_DONE after initialize completes
- // INIT to DESTROYED after failed unknown_adapter
- // INIT_DONE to RUN after successful unknown_adapter
- // STATE_RUN to STATE_DESTROYING after start of destruction
- // STATE_DESTROYING to STATE_DESTROYED after destruction completes.
-
- private static final int STATE_START = 0 ; // constructor complete
- private static final int STATE_INIT = 1 ; // waiting for adapter activator
- private static final int STATE_INIT_DONE = 2 ; // adapter activator called create_POA
- private static final int STATE_RUN = 3 ; // initialized and running
- private static final int STATE_DESTROYING = 4 ; // being destroyed
- private static final int STATE_DESTROYED = 5 ; // destruction complete
-
- private String stateToString()
- {
- switch (state) {
- case STATE_START :
- return "START" ;
- case STATE_INIT :
- return "INIT" ;
- case STATE_INIT_DONE :
- return "INIT_DONE" ;
- case STATE_RUN :
- return "RUN" ;
- case STATE_DESTROYING :
- return "DESTROYING" ;
- case STATE_DESTROYED :
- return "DESTROYED" ;
- default :
- return "UNKNOWN(" + state + ")" ;
- }
- }
-
- // Current state of the POA
- private int state ;
-
- // The POA request handler that performs all policy specific operations
- // Note that POAImpl handles all synchronization, so mediator is (mostly)
- // unsynchronized.
- private POAPolicyMediator mediator;
-
- // Representation of object adapter ID
- private int numLevels; // counts depth of tree. Root = 1.
- private ObjectAdapterId poaId ; // the actual object adapter ID for this POA
- private String name; // the name of this POA
-
- private POAManagerImpl manager; // This POA's POAManager
- private int uniquePOAId ; // ID for this POA that is unique relative
- // to the POAFactory, which has the same
- // lifetime as the ORB.
- private POAImpl parent; // The POA that created this POA.
- private Map children; // Map from name to POA of POAs created by
- // this POA.
-
- private AdapterActivator activator;
- private int invocationCount ; // pending invocations on this POA.
-
- // Data used to control POA concurrency
- // XXX revisit for JSR 166
-
- // Master lock for all POA synchronization. See lock and unlock.
- // package private for access by AOMEntry.
- Sync poaMutex ;
-
- // Wait on this CV for AdapterActivator upcalls to complete
- private CondVar adapterActivatorCV ;
-
- // Wait on this CV for all active invocations to complete
- private CondVar invokeCV ;
-
- // Wait on this CV for the destroy method to complete doing its work
- private CondVar beingDestroyedCV ;
-
- // thread local variable to store a boolean to detect deadlock in
- // POA.destroy().
- protected ThreadLocal isDestroying ;
-
- // This includes the most important information for debugging
- // POA problems.
- public String toString()
- {
- return "POA[" + poaId.toString() +
- ", uniquePOAId=" + uniquePOAId +
- ", state=" + stateToString() +
- ", invocationCount=" + invocationCount + "]" ;
- }
-
- // package private for mediator implementations.
- boolean getDebug()
- {
- return debug ;
- }
-
- // package private for access to servant to POA map
- static POAFactory getPOAFactory( ORB orb )
- {
- return (POAFactory)orb.getRequestDispatcherRegistry().
- getObjectAdapterFactory( ORBConstants.TRANSIENT_SCID ) ;
- }
-
- // package private so that POAFactory can access it.
- static POAImpl makeRootPOA( ORB orb )
- {
- POAManagerImpl poaManager = new POAManagerImpl( getPOAFactory( orb ),
- orb.getPIHandler() ) ;
-
- POAImpl result = new POAImpl( ORBConstants.ROOT_POA_NAME,
- null, orb, STATE_START ) ;
- result.initialize( poaManager, Policies.rootPOAPolicies ) ;
-
- return result ;
- }
-
- // package private so that POAPolicyMediatorBase can access it.
- int getPOAId()
- {
- return uniquePOAId ;
- }
-
-
- // package private so that POAPolicyMediator can access it.
- void lock()
- {
- SyncUtil.acquire( poaMutex ) ;
-
- if (debug) {
- ORBUtility.dprint( this, "LOCKED poa " + this ) ;
- }
- }
-
- // package private so that POAPolicyMediator can access it.
- void unlock()
- {
- if (debug) {
- ORBUtility.dprint( this, "UNLOCKED poa " + this ) ;
- }
-
- poaMutex.release() ;
- }
-
- // package private so that DelegateImpl can access it.
- Policies getPolicies()
- {
- return mediator.getPolicies() ;
- }
-
- // Note that the parent POA must be locked when this constructor is called.
- private POAImpl( String name, POAImpl parent, ORB orb, int initialState )
- {
- super( orb ) ;
-
- debug = orb.poaDebugFlag ;
-
- if (debug) {
- ORBUtility.dprint( this, "Creating POA with name=" + name +
- " parent=" + parent ) ;
- }
-
- this.state = initialState ;
- this.name = name ;
- this.parent = parent;
- children = new HashMap();
- activator = null ;
-
- // This was done in initialize, but I moved it here
- // to get better searchability when tracing.
- uniquePOAId = getPOAFactory( orb ).newPOAId() ;
-
- if (parent == null) {
- // This is the root POA, which counts as 1 level
- numLevels = 1 ;
- } else {
- // My level is one more than that of my parent
- numLevels = parent.numLevels + 1 ;
-
- parent.children.put(name, this);
- }
-
- // Get an array of all of the POA names in order to
- // create the poaid.
- String[] names = new String[ numLevels ] ;
- POAImpl poaImpl = this ;
- int ctr = numLevels - 1 ;
- while (poaImpl != null) {
- names[ctr--] = poaImpl.name ;
- poaImpl = poaImpl.parent ;
- }
-
- poaId = new ObjectAdapterIdArray( names ) ;
-
- invocationCount = 0;
-
- poaMutex = new ReentrantMutex( orb.poaConcurrencyDebugFlag ) ;
-
- adapterActivatorCV = new CondVar( poaMutex,
- orb.poaConcurrencyDebugFlag ) ;
- invokeCV = new CondVar( poaMutex,
- orb.poaConcurrencyDebugFlag ) ;
- beingDestroyedCV = new CondVar( poaMutex,
- orb.poaConcurrencyDebugFlag ) ;
-
- isDestroying = new ThreadLocal () {
- protected java.lang.Object initialValue() {
- return Boolean.FALSE;
- }
- };
- }
-
- // The POA lock must be held when this method is called.
- private void initialize( POAManagerImpl manager, Policies policies )
- {
- if (debug) {
- ORBUtility.dprint( this, "Initializing poa " + this +
- " with POAManager=" + manager + " policies=" + policies ) ;
- }
-
- this.manager = manager;
- manager.addPOA(this);
-
- mediator = POAPolicyMediatorFactory.create( policies, this ) ;
-
- // Construct the object key template
- int serverid = mediator.getServerId() ;
- int scid = mediator.getScid() ;
- String orbId = getORB().getORBData().getORBId();
-
- ObjectKeyTemplate oktemp = new POAObjectKeyTemplate( getORB(),
- scid, serverid, orbId, poaId ) ;
-
- if (debug) {
- ORBUtility.dprint( this, "Initializing poa: oktemp=" + oktemp ) ;
- }
-
- // Note that parent == null iff this is the root POA.
- // This was used to avoid executing interceptors on the RootPOA.
- // That is no longer necessary.
- boolean objectAdapterCreated = true; // parent != null ;
-
- // XXX extract codebase from policies and pass into initializeTemplate
- // after the codebase policy change is finalized.
- initializeTemplate( oktemp, objectAdapterCreated,
- policies,
- null, // codebase
- null, // manager id
- oktemp.getObjectAdapterId()
- ) ;
-
- if (state == STATE_START)
- state = STATE_RUN ;
- else if (state == STATE_INIT)
- state = STATE_INIT_DONE ;
- else
- throw lifecycleWrapper().illegalPoaStateTrans() ;
- }
-
- // The poaMutex must be held when this method is called
- private boolean waitUntilRunning()
- {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling waitUntilRunning on poa " + this ) ;
- }
-
- while (state < STATE_RUN) {
- try {
- adapterActivatorCV.await() ;
- } catch (InterruptedException exc) {
- // NO-OP
- }
- }
-
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting waitUntilRunning on poa " + this ) ;
- }
-
- // Note that a POA could be destroyed while in STATE_INIT due to a
- // failure in the AdapterActivator upcall.
- return (state == STATE_RUN) ;
- }
-
- // This method checks that the AdapterActivator finished the
- // initialization of a POA activated in find_POA. This is
- // determined by checking the state of the POA. If the state is
- // STATE_INIT, the AdapterActivator did not complete the
- // inialization. In this case, we destroy the POA that was
- // partially created and return false. Otherwise, we return true.
- // In any case, we must wake up all threads waiting for the adapter
- // activator, either to continue their invocations, or to return
- // errors to their client.
- //
- // The poaMutex must NOT be held when this method is called.
- private boolean destroyIfNotInitDone()
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling destroyIfNotInitDone on poa " + this ) ;
- }
-
- boolean success = (state == STATE_INIT_DONE) ;
-
- if (success)
- state = STATE_RUN ;
- else {
- // Don't just use destroy, because the check for
- // deadlock is too general, and can prevent this from
- // functioning properly.
- DestroyThread destroyer = new DestroyThread( false, debug );
- destroyer.doIt( this, true ) ;
- }
-
- return success ;
- } finally {
- adapterActivatorCV.broadcast() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting destroyIfNotInitDone on poa " + this ) ;
- }
-
- unlock() ;
- }
- }
-
- private byte[] internalReferenceToId(
- org.omg.CORBA.Object reference ) throws WrongAdapter
- {
- IOR ior = ORBUtility.getIOR( reference ) ;
- IORTemplateList thisTemplate = ior.getIORTemplates() ;
-
- ObjectReferenceFactory orf = getCurrentFactory() ;
- IORTemplateList poaTemplate =
- IORFactories.getIORTemplateList( orf ) ;
-
- if (!poaTemplate.isEquivalent( thisTemplate ))
- throw new WrongAdapter();
-
- // Extract the ObjectId from the first TaggedProfile in the IOR.
- // If ior was created in this POA, the same ID was used for
- // every profile through the profile templates in the currentFactory,
- // so we will get the same result from any profile.
- Iterator iter = ior.iterator() ;
- if (!iter.hasNext())
- throw iorWrapper().noProfilesInIor() ;
- TaggedProfile prof = (TaggedProfile)(iter.next()) ;
- ObjectId oid = prof.getObjectId() ;
-
- return oid.getId();
- }
-
- // Converted from anonymous class to local class
- // so that we can call performDestroy() directly.
- static class DestroyThread extends Thread {
- private boolean wait ;
- private boolean etherealize ;
- private boolean debug ;
- private POAImpl thePoa ;
-
- public DestroyThread( boolean etherealize, boolean debug )
- {
- this.etherealize = etherealize ;
- this.debug = debug ;
- }
-
- public void doIt( POAImpl thePoa, boolean wait )
- {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling DestroyThread.doIt(thePOA=" + thePoa +
- " wait=" + wait + " etherealize=" + etherealize ) ;
- }
-
- this.thePoa = thePoa ;
- this.wait = wait ;
-
- if (wait) {
- run() ;
- } else {
- // Catch exceptions since setDaemon can cause a
- // security exception to be thrown under netscape
- // in the Applet mode
- try { setDaemon(true); } catch (Exception e) {}
- start() ;
- }
- }
-
- public void run()
- {
- Set destroyedPOATemplates = new HashSet() ;
-
- performDestroy( thePoa, destroyedPOATemplates );
-
- Iterator iter = destroyedPOATemplates.iterator() ;
- ObjectReferenceTemplate[] orts = new ObjectReferenceTemplate[
- destroyedPOATemplates.size() ] ;
- int index = 0 ;
- while (iter.hasNext())
- orts[ index++ ] = (ObjectReferenceTemplate)iter.next();
-
- thePoa.getORB().getPIHandler().adapterStateChanged( orts,
- NON_EXISTENT.value ) ;
- }
-
- // Returns true if destruction must be completed, false
- // if not, which means that another thread is already
- // destroying poa.
- private boolean prepareForDestruction( POAImpl poa,
- Set destroyedPOATemplates )
- {
- POAImpl[] childPoas = null ;
-
- // Note that we do not synchronize on this, since this is
- // the PerformDestroy instance, not the POA.
- try {
- poa.lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling performDestroy on poa " + poa ) ;
- }
-
- if (poa.state <= STATE_RUN) {
- poa.state = STATE_DESTROYING ;
- } else {
- // destroy may be called multiple times, and each call
- // is allowed to proceed with its own setting of the wait
- // flag, but the etherealize value is used from the first
- // call to destroy. Also all children should be destroyed
- // before the parent POA. If the poa is already destroyed,
- // we can just return. If the poa has started destruction,
- // but not completed, and wait is true, we need to wait
- // until destruction is complete, then just return.
- if (wait)
- while (poa.state != STATE_DESTROYED) {
- try {
- poa.beingDestroyedCV.await() ;
- } catch (InterruptedException exc) {
- // NO-OP
- }
- }
-
- return false ;
- }
-
- poa.isDestroying.set(Boolean.TRUE);
-
- // Make a copy since we can't hold the lock while destroying
- // the children, and an iterator is not deletion-safe.
- childPoas = (POAImpl[])poa.children.values().toArray(
- new POAImpl[0] );
- } finally {
- poa.unlock() ;
- }
-
- // We are not holding the POA mutex here to avoid holding it
- // while destroying the POA's children, since this may involve
- // upcalls to etherealize methods.
-
- for (int ctr=0; ctr<childPoas.length; ctr++ ) {
- performDestroy( childPoas[ctr], destroyedPOATemplates ) ;
- }
-
- return true ;
- }
-
- public void performDestroy( POAImpl poa, Set destroyedPOATemplates )
- {
- if (!prepareForDestruction( poa, destroyedPOATemplates ))
- return ;
-
- // NOTE: If we are here, poa is in STATE_DESTROYING state. All
- // other state checks are taken care of in prepareForDestruction.
- // No other threads may either be starting new invocations
- // by calling enter or starting to destroy poa. There may
- // still be pending invocations.
-
- POAImpl parent = poa.parent ;
- boolean isRoot = parent == null ;
-
- try {
- // Note that we must lock the parent before the child.
- // The parent lock is required (if poa is not the root)
- // to safely remove poa from parent's children Map.
- if (!isRoot)
- parent.lock() ;
-
- try {
- poa.lock() ;
-
- completeDestruction( poa, parent,
- destroyedPOATemplates ) ;
- } finally {
- poa.unlock() ;
-
- if (isRoot)
- // We have just destroyed the root POA, so we need to
- // make sure that the next call to
- // resolve_initial_reference( "RootPOA" )
- // will recreate a valid root POA.
- poa.manager.getFactory().registerRootPOA() ;
- }
- } finally {
- if (!isRoot) {
- parent.unlock() ;
- poa.parent = null ;
- }
- }
- }
-
- private void completeDestruction( POAImpl poa, POAImpl parent,
- Set destroyedPOATemplates )
- {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling completeDestruction on poa " + poa ) ;
- }
-
- try {
- while (poa.invocationCount != 0) {
- try {
- poa.invokeCV.await() ;
- } catch (InterruptedException ex) {
- // NO-OP
- }
- }
-
- if (poa.mediator != null) {
- if (etherealize)
- poa.mediator.etherealizeAll();
-
- poa.mediator.clearAOM() ;
- }
-
- if (poa.manager != null)
- poa.manager.removePOA(poa);
-
- if (parent != null)
- parent.children.remove( poa.name ) ;
-
- destroyedPOATemplates.add( poa.getAdapterTemplate() ) ;
- } catch (Throwable thr) {
- if (thr instanceof ThreadDeath)
- throw (ThreadDeath)thr ;
-
- poa.lifecycleWrapper().unexpectedException( thr, poa.toString() ) ;
- } finally {
- poa.state = STATE_DESTROYED ;
- poa.beingDestroyedCV.broadcast();
- poa.isDestroying.set(Boolean.FALSE);
-
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting completeDestruction on poa " + poa ) ;
- }
- }
- }
- }
-
- void etherealizeAll()
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling etheralizeAll on poa " + this ) ;
- }
-
- mediator.etherealizeAll() ;
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting etheralizeAll on poa " + this ) ;
- }
-
- unlock() ;
- }
- }
-
- //*******************************************************************
- // Public POA API
- //*******************************************************************
-
- /**
- * <code>create_POA</code>
- * <b>Section 3.3.8.2</b>
- */
- public POA create_POA(String name, POAManager
- theManager, Policy[] policies) throws AdapterAlreadyExists,
- InvalidPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling create_POA(name=" + name +
- " theManager=" + theManager + " policies=" + policies +
- ") on poa " + this ) ;
- }
-
- // We cannot create children of a POA that is (being) destroyed.
- // This has been added to the CORBA 3.0 spec.
- if (state > STATE_RUN)
- throw omgLifecycleWrapper().createPoaDestroy() ;
-
- POAImpl poa = (POAImpl)(children.get(name)) ;
-
- if (poa == null) {
- poa = new POAImpl( name, this, getORB(), STATE_START ) ;
- }
-
- try {
- poa.lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling create_POA: new poa is " + poa ) ;
- }
-
- if ((poa.state != STATE_START) && (poa.state != STATE_INIT))
- throw new AdapterAlreadyExists();
-
- POAManagerImpl newManager = (POAManagerImpl)theManager ;
- if (newManager == null)
- newManager = new POAManagerImpl( manager.getFactory(),
- manager.getPIHandler() );
-
- int defaultCopierId =
- getORB().getCopierManager().getDefaultId() ;
- Policies POAPolicies =
- new Policies( policies, defaultCopierId ) ;
-
- poa.initialize( newManager, POAPolicies ) ;
-
- return poa;
- } finally {
- poa.unlock() ;
- }
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>find_POA</code>
- * <b>Section 3.3.8.3</b>
- */
- public POA find_POA(String name, boolean activate)
- throws AdapterNonExistent
- {
- POAImpl found = null ;
- AdapterActivator act = null ;
-
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling find_POA(name=" + name +
- " activate=" + activate + ") on poa " + this ) ;
- }
-
- found = (POAImpl) children.get(name);
-
- if (found != null) {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling find_POA: found poa " + found ) ;
- }
-
- try {
- found.lock() ;
-
- // Do not hold the parent POA lock while
- // waiting for child to complete initialization.
- unlock() ;
-
- // Make sure that the child has completed its initialization,
- // if it was created by an AdapterActivator, otherwise throw
- // a standard TRANSIENT exception with minor code 4 (see
- // CORBA 3.0 11.3.9.3, in reference to unknown_adapter)
- if (!found.waitUntilRunning())
- throw omgLifecycleWrapper().poaDestroyed() ;
-
- // Note that found may be in state DESTROYING or DESTROYED at
- // this point. That's OK, since destruction could start at
- // any time.
- } finally {
- found.unlock() ;
- }
- } else {
- try {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling find_POA: no poa found" ) ;
- }
-
- if (activate && (activator != null)) {
- // Create a child, but don't initialize it. The newly
- // created POA will be in state STATE_START, which will
- // cause other calls to find_POA that are creating the same
- // POA to block on the waitUntilRunning call above.
- // Initialization must be completed by a call to create_POA
- // inside the unknown_adapter upcall. Note that
- // this.poaMutex must be held here so that this.children
- // can be safely updated. The state is set to STATE_INIT
- // so that initialize can make the correct state transition
- // when create_POA is called inside the AdapterActivator.
- // This avoids activating the new POA too soon
- // by transitioning to STATE_RUN after unknown_adapter
- // returns.
- found = new POAImpl( name, this, getORB(), STATE_INIT ) ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling find_POA: created poa " + found ) ;
- }
-
- act = activator ;
- } else {
- throw new AdapterNonExistent();
- }
- } finally {
- unlock() ;
- }
- }
-
- // assert (found != null)
- // assert not holding this.poaMutex OR found.poaMutex
-
- // We must not hold either this.poaMutex or found.poaMutex here while
- // waiting for intialization of found to complete to prevent possible
- // deadlocks.
-
- if (act != null) {
- boolean status = false ;
- boolean adapterResult = false ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling find_POA: calling AdapterActivator" ) ;
- }
-
- try {
- // Prevent more than one thread at a time from executing in act
- // in case act is shared between multiple POAs.
- synchronized (act) {
- status = act.unknown_adapter(this, name);
- }
- } catch (SystemException exc) {
- throw omgLifecycleWrapper().adapterActivatorException( exc,
- name, poaId.toString() ) ;
- } catch (Throwable thr) {
- // ignore most non-system exceptions, but log them for
- // diagnostic purposes.
- lifecycleWrapper().unexpectedException( thr, this.toString() ) ;
-
- if (thr instanceof ThreadDeath)
- throw (ThreadDeath)thr ;
- } finally {
- // At this point, we have completed adapter activation.
- // Whether this was successful or not, we must call
- // destroyIfNotInitDone so that calls to enter() and create_POA()
- // that are waiting can execute again. Failing to do this
- // will cause the system to hang in complex tests.
- adapterResult = found.destroyIfNotInitDone() ;
- }
-
- if (status) {
- if (!adapterResult)
- throw omgLifecycleWrapper().adapterActivatorException( name,
- poaId.toString() ) ;
- } else {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling find_POA: AdapterActivator returned false" ) ;
- }
-
- // OMG Issue 3740 is resolved to throw AdapterNonExistent if
- // unknown_adapter() returns false.
- throw new AdapterNonExistent();
- }
- }
-
- return found;
- }
-
- /**
- * <code>destroy</code>
- * <b>Section 3.3.8.4</b>
- */
- public void destroy(boolean etherealize, boolean wait_for_completion)
- {
- // This is to avoid deadlock
- if (wait_for_completion && getORB().isDuringDispatch()) {
- throw lifecycleWrapper().destroyDeadlock() ;
- }
-
- DestroyThread destroyer = new DestroyThread( etherealize, debug );
- destroyer.doIt( this, wait_for_completion ) ;
- }
-
- /**
- * <code>create_thread_policy</code>
- * <b>Section 3.3.8.5</b>
- */
- public ThreadPolicy create_thread_policy(
- ThreadPolicyValue value)
- {
- return new ThreadPolicyImpl(value);
- }
-
- /**
- * <code>create_lifespan_policy</code>
- * <b>Section 3.3.8.5</b>
- */
- public LifespanPolicy create_lifespan_policy(
- LifespanPolicyValue value)
- {
- return new LifespanPolicyImpl(value);
- }
-
- /**
- * <code>create_id_uniqueness_policy</code>
- * <b>Section 3.3.8.5</b>
- */
- public IdUniquenessPolicy create_id_uniqueness_policy(
- IdUniquenessPolicyValue value)
- {
- return new IdUniquenessPolicyImpl(value);
- }
-
- /**
- * <code>create_id_assignment_policy</code>
- * <b>Section 3.3.8.5</b>
- */
- public IdAssignmentPolicy create_id_assignment_policy(
- IdAssignmentPolicyValue value)
- {
- return new IdAssignmentPolicyImpl(value);
- }
-
- /**
- * <code>create_implicit_activation_policy</code>
- * <b>Section 3.3.8.5</b>
- */
- public ImplicitActivationPolicy create_implicit_activation_policy(
- ImplicitActivationPolicyValue value)
- {
- return new ImplicitActivationPolicyImpl(value);
- }
-
- /**
- * <code>create_servant_retention_policy</code>
- * <b>Section 3.3.8.5</b>
- */
- public ServantRetentionPolicy create_servant_retention_policy(
- ServantRetentionPolicyValue value)
- {
- return new ServantRetentionPolicyImpl(value);
- }
-
- /**
- * <code>create_request_processing_policy</code>
- * <b>Section 3.3.8.5</b>
- */
- public RequestProcessingPolicy create_request_processing_policy(
- RequestProcessingPolicyValue value)
- {
- return new RequestProcessingPolicyImpl(value);
- }
-
- /**
- * <code>the_name</code>
- * <b>Section 3.3.8.6</b>
- */
- public String the_name()
- {
- try {
- lock() ;
-
- return name;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>the_parent</code>
- * <b>Section 3.3.8.7</b>
- */
- public POA the_parent()
- {
- try {
- lock() ;
-
- return parent;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>the_children</code>
- */
- public org.omg.PortableServer.POA[] the_children()
- {
- try {
- lock() ;
-
- Collection coll = children.values() ;
- int size = coll.size() ;
- POA[] result = new POA[ size ] ;
- int index = 0 ;
- Iterator iter = coll.iterator() ;
- while (iter.hasNext()) {
- POA poa = (POA)(iter.next()) ;
- result[ index++ ] = poa ;
- }
-
- return result ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>the_POAManager</code>
- * <b>Section 3.3.8.8</b>
- */
- public POAManager the_POAManager()
- {
- try {
- lock() ;
-
- return manager;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>the_activator</code>
- * <b>Section 3.3.8.9</b>
- */
- public AdapterActivator the_activator()
- {
- try {
- lock() ;
-
- return activator;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>the_activator</code>
- * <b>Section 3.3.8.9</b>
- */
- public void the_activator(AdapterActivator activator)
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling the_activator on poa " +
- this + " activator=" + activator ) ;
- }
-
- this.activator = activator;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>get_servant_manager</code>
- * <b>Section 3.3.8.10</b>
- */
- public ServantManager get_servant_manager() throws WrongPolicy
- {
- try {
- lock() ;
-
- return mediator.getServantManager() ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>set_servant_manager</code>
- * <b>Section 3.3.8.10</b>
- */
- public void set_servant_manager(ServantManager servantManager)
- throws WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling set_servant_manager on poa " +
- this + " servantManager=" + servantManager ) ;
- }
-
- mediator.setServantManager( servantManager ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>get_servant</code>
- * <b>Section 3.3.8.12</b>
- */
- public Servant get_servant() throws NoServant, WrongPolicy
- {
- try {
- lock() ;
-
- return mediator.getDefaultServant() ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>set_servant</code>
- * <b>Section 3.3.8.13</b>
- */
- public void set_servant(Servant defaultServant)
- throws WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling set_servant on poa " +
- this + " defaultServant=" + defaultServant ) ;
- }
-
- mediator.setDefaultServant( defaultServant ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>activate_object</code>
- * <b>Section 3.3.8.14</b>
- */
- public byte[] activate_object(Servant servant)
- throws ServantAlreadyActive, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling activate_object on poa " + this +
- " (servant=" + servant + ")" ) ;
- }
-
- // Allocate a new system-generated object-id.
- // This will throw WrongPolicy if not SYSTEM_ID
- // policy.
- byte[] id = mediator.newSystemId();
-
- try {
- mediator.activateObject( id, servant ) ;
- } catch (ObjectAlreadyActive oaa) {
- // This exception can not occur in this case,
- // since id is always brand new.
- //
- }
-
- return id ;
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting activate_object on poa " + this ) ;
- }
-
- unlock() ;
- }
- }
-
- /**
- * <code>activate_object_with_id</code>
- * <b>Section 3.3.8.15</b>
- */
- public void activate_object_with_id(byte[] id,
- Servant servant)
- throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling activate_object_with_id on poa " + this +
- " (servant=" + servant + " id=" + id + ")" ) ;
- }
-
- // Clone the id to avoid possible errors due to aliasing
- // (e.g. the client passes the id in and then changes it later).
- byte[] idClone = (byte[])(id.clone()) ;
-
- mediator.activateObject( idClone, servant ) ;
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting activate_object_with_id on poa " + this ) ;
- }
-
- unlock() ;
- }
- }
-
- /**
- * <code>deactivate_object</code>
- * <b>3.3.8.16</b>
- */
- public void deactivate_object(byte[] id)
- throws ObjectNotActive, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling deactivate_object on poa " + this +
- " (id=" + id + ")" ) ;
- }
-
- mediator.deactivateObject( id ) ;
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting deactivate_object on poa " + this ) ;
- }
-
- unlock() ;
- }
- }
-
- /**
- * <code>create_reference</code>
- * <b>3.3.8.17</b>
- */
- public org.omg.CORBA.Object create_reference(String repId)
- throws WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling create_reference(repId=" +
- repId + ") on poa " + this ) ;
- }
-
- return makeObject( repId, mediator.newSystemId()) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>create_reference_with_id</code>
- * <b>3.3.8.18</b>
- */
- public org.omg.CORBA.Object
- create_reference_with_id(byte[] oid, String repId)
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling create_reference_with_id(oid=" +
- oid + " repId=" + repId + ") on poa " + this ) ;
- }
-
- // Clone the id to avoid possible errors due to aliasing
- // (e.g. the client passes the id in and then changes it later).
- byte[] idClone = (byte[])(oid.clone()) ;
-
- return makeObject( repId, idClone ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>servant_to_id</code>
- * <b>3.3.8.19</b>
- */
- public byte[] servant_to_id(Servant servant)
- throws ServantNotActive, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling servant_to_id(servant=" +
- servant + ") on poa " + this ) ;
- }
-
- return mediator.servantToId( servant ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>servant_to_reference</code>
- * <b>3.3.8.20</b>
- */
- public org.omg.CORBA.Object servant_to_reference(Servant servant)
- throws ServantNotActive, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling servant_to_reference(servant=" +
- servant + ") on poa " + this ) ;
- }
-
- byte[] oid = mediator.servantToId(servant);
- String repId = servant._all_interfaces( this, oid )[0] ;
- return create_reference_with_id(oid, repId);
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>reference_to_servant</code>
- * <b>3.3.8.21</b>
- */
- public Servant reference_to_servant(org.omg.CORBA.Object reference)
- throws ObjectNotActive, WrongPolicy, WrongAdapter
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling reference_to_servant(reference=" +
- reference + ") on poa " + this ) ;
- }
-
- if ( state >= STATE_DESTROYING ) {
- throw lifecycleWrapper().adapterDestroyed() ;
- }
-
- // reference_to_id should throw WrongAdapter
- // if the objref was not created by this POA
- byte [] id = internalReferenceToId(reference);
-
- return mediator.idToServant( id ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>reference_to_id</code>
- * <b>3.3.8.22</b>
- */
- public byte[] reference_to_id(org.omg.CORBA.Object reference)
- throws WrongAdapter, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling reference_to_id(reference=" +
- reference + ") on poa " + this ) ;
- }
-
- if( state >= STATE_DESTROYING ) {
- throw lifecycleWrapper().adapterDestroyed() ;
- }
-
- return internalReferenceToId( reference ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>id_to_servant</code>
- * <b>3.3.8.23</b>
- */
- public Servant id_to_servant(byte[] id)
- throws ObjectNotActive, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling id_to_servant(id=" +
- id + ") on poa " + this ) ;
- }
-
- if( state >= STATE_DESTROYING ) {
- throw lifecycleWrapper().adapterDestroyed() ;
- }
- return mediator.idToServant( id ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>id_to_reference</code>
- * <b>3.3.8.24</b>
- */
- public org.omg.CORBA.Object id_to_reference(byte[] id)
- throws ObjectNotActive, WrongPolicy
-
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling id_to_reference(id=" +
- id + ") on poa " + this ) ;
- }
-
- if( state >= STATE_DESTROYING ) {
- throw lifecycleWrapper().adapterDestroyed() ;
- }
-
- Servant s = mediator.idToServant( id ) ;
- String repId = s._all_interfaces( this, id )[0] ;
- return makeObject(repId, id );
- } finally {
- unlock() ;
- }
- }
-
- /**
- * <code>id</code>
- * <b>11.3.8.26 in ptc/00-08-06</b>
- */
- public byte[] id()
- {
- try {
- lock() ;
-
- return getAdapterId() ;
- } finally {
- unlock() ;
- }
- }
-
- //***************************************************************
- //Implementation of ObjectAdapter interface
- //***************************************************************
-
- public Policy getEffectivePolicy( int type )
- {
- return mediator.getPolicies().get_effective_policy( type ) ;
- }
-
- public int getManagerId()
- {
- return manager.getManagerId() ;
- }
-
- public short getState()
- {
- return manager.getORTState() ;
- }
-
- public String[] getInterfaces( java.lang.Object servant, byte[] objectId )
- {
- Servant serv = (Servant)servant ;
- return serv._all_interfaces( this, objectId ) ;
- }
-
- protected ObjectCopierFactory getObjectCopierFactory()
- {
- int copierId = mediator.getPolicies().getCopierId() ;
- CopierManager cm = getORB().getCopierManager() ;
- return cm.getObjectCopierFactory( copierId ) ;
- }
-
- public void enter() throws OADestroyed
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling enter on poa " + this ) ;
- }
-
- // Avoid deadlock if this is the thread that is processing the
- // POA.destroy because this is the only thread that can notify
- // waiters on beingDestroyedCV. This can happen if an
- // etherealize upcall invokes a method on a colocated object
- // served by this POA.
- while ((state == STATE_DESTROYING) &&
- (isDestroying.get() == Boolean.FALSE)) {
- try {
- beingDestroyedCV.await();
- } catch (InterruptedException ex) {
- // NO-OP
- }
- }
-
- if (!waitUntilRunning())
- throw new OADestroyed() ;
-
- invocationCount++;
- } finally {
- if (debug) {
- ORBUtility.dprint( this, "Exiting enter on poa " + this ) ;
- }
-
- unlock() ;
- }
-
- manager.enter();
- }
-
- public void exit()
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling exit on poa " + this ) ;
- }
-
- invocationCount--;
-
- if ((invocationCount == 0) && (state == STATE_DESTROYING)) {
- invokeCV.broadcast();
- }
- } finally {
- if (debug) {
- ORBUtility.dprint( this, "Exiting exit on poa " + this ) ;
- }
-
- unlock() ;
- }
-
- manager.exit();
- }
-
- public void getInvocationServant( OAInvocationInfo info )
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling getInvocationServant on poa " + this ) ;
- }
-
- java.lang.Object servant = null ;
-
- try {
- servant = mediator.getInvocationServant( info.id(),
- info.getOperation() );
- } catch (ForwardRequest freq) {
- throw new ForwardException( getORB(), freq.forward_reference ) ;
- }
-
- info.setServant( servant ) ;
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting getInvocationServant on poa " + this ) ;
- }
-
- unlock() ;
- }
- }
-
- public org.omg.CORBA.Object getLocalServant( byte[] objectId )
- {
- return null ;
- }
-
- /** Called from the subcontract to let this POA cleanup after an
- * invocation. Note: If getServant was called, then returnServant
- * MUST be called, even in the case of exceptions. This may be
- * called multiple times for a single request.
- */
- public void returnServant()
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling returnServant on poa " + this ) ;
- }
-
- mediator.returnServant();
- } catch (Throwable thr) {
- if (debug) {
- ORBUtility.dprint( this,
- "Exception " + thr + " in returnServant on poa " + this ) ;
- }
-
- if (thr instanceof Error)
- throw (Error)thr ;
- else if (thr instanceof RuntimeException)
- throw (RuntimeException)thr ;
-
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting returnServant on poa " + this ) ;
- }
-
- unlock() ;
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java
deleted file mode 100644
index a044c14..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java
+++ /dev/null
@@ -1,547 +0,0 @@
-/*
- * Copyright (c) 1997, 2004, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import java.util.Iterator;
-import java.util.Collections;
-import java.util.Set;
-import java.util.HashSet;
-
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.CompletionStatus ;
-
-import org.omg.PortableServer.POAManager;
-import org.omg.PortableServer.POAManagerPackage.State;
-import org.omg.PortableServer.POA;
-
-import org.omg.PortableInterceptor.DISCARDING ;
-import org.omg.PortableInterceptor.ACTIVE ;
-import org.omg.PortableInterceptor.HOLDING ;
-import org.omg.PortableInterceptor.INACTIVE ;
-import org.omg.PortableInterceptor.NON_EXISTENT ;
-
-import com.sun.corba.se.spi.protocol.PIHandler ;
-
-import com.sun.corba.se.impl.logging.POASystemException ;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-
-/** POAManagerImpl is the implementation of the POAManager interface.
- * Its public methods are activate(), hold_requests(), discard_requests()
- * and deactivate().
- */
-
-public class POAManagerImpl extends org.omg.CORBA.LocalObject implements
- POAManager
-{
- private final POAFactory factory ; // factory which contains global state
- // for all POAManagers
- private PIHandler pihandler ; // for adapterManagerStateChanged
- private State state; // current state of this POAManager
- private Set poas = new HashSet(4) ; // all poas controlled by this POAManager
- private int nInvocations=0; // Number of invocations in progress
- private int nWaiters=0; // Number of threads waiting for
- // invocations to complete
- private int myId = 0 ; // This POAManager's ID
- private boolean debug ;
- private boolean explicitStateChange ; // initially false, set true as soon as
- // one of activate, hold_request,
- // discard_request, or deactivate is called.
-
- private String stateToString( State state )
- {
- switch (state.value()) {
- case State._HOLDING : return "State[HOLDING]" ;
- case State._ACTIVE : return "State[ACTIVE]" ;
- case State._DISCARDING : return "State[DISCARDING]" ;
- case State._INACTIVE : return "State[INACTIVE]" ;
- }
-
- return "State[UNKNOWN]" ;
- }
-
- public String toString()
- {
- return "POAManagerImpl[myId=" + myId +
- " state=" + stateToString(state) +
- " nInvocations=" + nInvocations +
- " nWaiters=" + nWaiters + "]" ;
- }
-
- POAFactory getFactory()
- {
- return factory ;
- }
-
- PIHandler getPIHandler()
- {
- return pihandler ;
- }
-
- private void countedWait()
- {
- try {
- if (debug) {
- ORBUtility.dprint( this, "Calling countedWait on POAManager " +
- this + " nWaiters=" + nWaiters ) ;
- }
-
- nWaiters++ ;
- wait();
- } catch ( java.lang.InterruptedException ex ) {
- // NOP
- } finally {
- nWaiters-- ;
-
- if (debug) {
- ORBUtility.dprint( this, "Exiting countedWait on POAManager " +
- this + " nWaiters=" + nWaiters ) ;
- }
- }
- }
-
- private void notifyWaiters()
- {
- if (debug) {
- ORBUtility.dprint( this, "Calling notifyWaiters on POAManager " +
- this + " nWaiters=" + nWaiters ) ;
- }
-
- if (nWaiters >0)
- notifyAll() ;
- }
-
- public int getManagerId()
- {
- return myId ;
- }
-
- POAManagerImpl( POAFactory factory, PIHandler pihandler )
- {
- this.factory = factory ;
- factory.addPoaManager(this);
- this.pihandler = pihandler ;
- myId = factory.newPOAManagerId() ;
- state = State.HOLDING;
- debug = factory.getORB().poaDebugFlag ;
- explicitStateChange = false ;
-
- if (debug) {
- ORBUtility.dprint( this, "Creating POAManagerImpl " + this ) ;
- }
- }
-
- synchronized void addPOA(POA poa)
- {
- // XXX This is probably not the correct error
- if (state.value() == State._INACTIVE) {
- POASystemException wrapper = factory.getWrapper();
- throw wrapper.addPoaInactive( CompletionStatus.COMPLETED_NO ) ;
- }
-
- poas.add(poa);
- }
-
- synchronized void removePOA(POA poa)
- {
- poas.remove(poa);
- if ( poas.isEmpty() ) {
- factory.removePoaManager(this);
- }
- }
-
- public short getORTState()
- {
- switch (state.value()) {
- case State._HOLDING : return HOLDING.value ;
- case State._ACTIVE : return ACTIVE.value ;
- case State._INACTIVE : return INACTIVE.value ;
- case State._DISCARDING : return DISCARDING.value ;
- default : return NON_EXISTENT.value ;
- }
- }
-
-/****************************************************************************
- * The following four public methods are used to change the POAManager's state.
- *
- * A note on the design of synchronization code:
- * There are 4 places where a thread would need to wait for a condition:
- * - in hold_requests, discard_requests, deactivate, enter
- * There are 5 places where a thread notifies a condition:
- * - in activate, hold_requests, discard_requests, deactivate, exit
- *
- * Since each notify needs to awaken waiters in several of the 4 places,
- * and since wait() in Java has the nice property of releasing the lock
- * on its monitor before sleeping, it seemed simplest to have just one
- * monitor object: "this". Thus all notifies will awaken all waiters.
- * On waking up, each waiter verifies that the condition it was waiting
- * for is satisfied, otherwise it goes back into a wait().
- *
- ****************************************************************************/
-
- /**
- * <code>activate</code>
- * <b>Spec: pages 3-14 thru 3-18</b>
- */
- public synchronized void activate()
- throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
- {
- explicitStateChange = true ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling activate on POAManager " + this ) ;
- }
-
- try {
- if ( state.value() == State._INACTIVE )
- throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
-
- // set the state to ACTIVE
- state = State.ACTIVE;
-
- pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
-
- // Notify any invocations that were waiting because the previous
- // state was HOLDING, as well as notify any threads that were waiting
- // inside hold_requests() or discard_requests().
- notifyWaiters();
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting activate on POAManager " + this ) ;
- }
- }
- }
-
- /**
- * <code>hold_requests</code>
- * <b>Spec: pages 3-14 thru 3-18</b>
- */
- public synchronized void hold_requests(boolean wait_for_completion)
- throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
- {
- explicitStateChange = true ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling hold_requests on POAManager " + this ) ;
- }
-
- try {
- if ( state.value() == State._INACTIVE )
- throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
- // set the state to HOLDING
- state = State.HOLDING;
-
- pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
-
- // Notify any threads that were waiting in the wait() inside
- // discard_requests. This will cause discard_requests to return
- // (which is in conformance with the spec).
- notifyWaiters();
-
- if ( wait_for_completion ) {
- while ( state.value() == State._HOLDING && nInvocations > 0 ) {
- countedWait() ;
- }
- }
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting hold_requests on POAManager " + this ) ;
- }
- }
- }
-
- /**
- * <code>discard_requests</code>
- * <b>Spec: pages 3-14 thru 3-18</b>
- */
- public synchronized void discard_requests(boolean wait_for_completion)
- throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
- {
- explicitStateChange = true ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling hold_requests on POAManager " + this ) ;
- }
-
- try {
- if ( state.value() == State._INACTIVE )
- throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
-
- // set the state to DISCARDING
- state = State.DISCARDING;
-
- pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
-
- // Notify any invocations that were waiting because the previous
- // state was HOLDING. Those invocations will henceforth be rejected with
- // a TRANSIENT exception. Also notify any threads that were waiting
- // inside hold_requests().
- notifyWaiters();
-
- if ( wait_for_completion ) {
- while ( state.value() == State._DISCARDING && nInvocations > 0 ) {
- countedWait() ;
- }
- }
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting hold_requests on POAManager " + this ) ;
- }
- }
- }
-
- /**
- * <code>deactivate</code>
- * <b>Spec: pages 3-14 thru 3-18</b>
- * Note: INACTIVE is a permanent state.
- */
-
- public void deactivate(boolean etherealize_objects, boolean wait_for_completion)
- throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
- {
- explicitStateChange = true ;
-
- try {
- synchronized( this ) {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling deactivate on POAManager " + this ) ;
- }
-
- if ( state.value() == State._INACTIVE )
- throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
-
- state = State.INACTIVE;
-
- pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
-
- // Notify any invocations that were waiting because the previous
- // state was HOLDING. Those invocations will then be rejected with
- // an OBJ_ADAPTER exception. Also notify any threads that were waiting
- // inside hold_requests() or discard_requests().
- notifyWaiters();
- }
-
- POAManagerDeactivator deactivator = new POAManagerDeactivator( this,
- etherealize_objects, debug ) ;
-
- if (wait_for_completion)
- deactivator.run() ;
- else {
- Thread thr = new Thread(deactivator) ;
- thr.start() ;
- }
- } finally {
- synchronized(this) {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting deactivate on POAManager " + this ) ;
- }
- }
- }
- }
-
- private class POAManagerDeactivator implements Runnable
- {
- private boolean etherealize_objects ;
- private POAManagerImpl pmi ;
- private boolean debug ;
-
- POAManagerDeactivator( POAManagerImpl pmi, boolean etherealize_objects,
- boolean debug )
- {
- this.etherealize_objects = etherealize_objects ;
- this.pmi = pmi ;
- this.debug = debug ;
- }
-
- public void run()
- {
- try {
- synchronized (pmi) {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling run with etherealize_objects=" +
- etherealize_objects + " pmi=" + pmi ) ;
- }
-
- while ( pmi.nInvocations > 0 ) {
- countedWait() ;
- }
- }
-
- if (etherealize_objects) {
- Iterator iterator = null ;
-
- // Make sure that poas cannot change while we copy it!
- synchronized (pmi) {
- if (debug) {
- ORBUtility.dprint( this,
- "run: Preparing to etherealize with pmi=" +
- pmi ) ;
- }
-
- iterator = (new HashSet(pmi.poas)).iterator();
- }
-
- while (iterator.hasNext()) {
- // Each RETAIN+USE_SERVANT_MGR poa
- // must call etherealize for all its objects
- ((POAImpl)iterator.next()).etherealizeAll();
- }
-
- synchronized (pmi) {
- if (debug) {
- ORBUtility.dprint( this,
- "run: removing POAManager and clearing poas " +
- "with pmi=" + pmi ) ;
- }
-
- factory.removePoaManager(pmi);
- poas.clear();
- }
- }
- } finally {
- if (debug) {
- synchronized (pmi) {
- ORBUtility.dprint( this, "Exiting run" ) ;
- }
- }
- }
- }
- }
-
- /**
- * Added according to the spec CORBA V2.3; this returns the
- * state of the POAManager
- */
-
- public org.omg.PortableServer.POAManagerPackage.State get_state () {
- return state;
- }
-
-/****************************************************************************
- * The following methods are used on the invocation path.
- ****************************************************************************/
-
- // called from POA.find_POA before calling
- // AdapterActivator.unknown_adapter.
- synchronized void checkIfActive()
- {
- try {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling checkIfActive for POAManagerImpl " + this ) ;
- }
-
- checkState();
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting checkIfActive for POAManagerImpl " + this ) ;
- }
- }
- }
-
- private void checkState()
- {
- while ( state.value() != State._ACTIVE ) {
- switch ( state.value() ) {
- case State._HOLDING:
- while ( state.value() == State._HOLDING ) {
- countedWait() ;
- }
- break;
-
- case State._DISCARDING:
- throw factory.getWrapper().poaDiscarding() ;
-
- case State._INACTIVE:
- throw factory.getWrapper().poaInactive() ;
- }
- }
- }
-
- synchronized void enter()
- {
- try {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling enter for POAManagerImpl " + this ) ;
- }
-
- checkState();
- nInvocations++;
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting enter for POAManagerImpl " + this ) ;
- }
- }
- }
-
- synchronized void exit()
- {
- try {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling exit for POAManagerImpl " + this ) ;
- }
-
- nInvocations--;
-
- if ( nInvocations == 0 ) {
- // This notifies any threads that were in the
- // wait_for_completion loop in hold/discard/deactivate().
- notifyWaiters();
- }
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting exit for POAManagerImpl " + this ) ;
- }
- }
- }
-
- /** Activate the POAManager if no explicit state change has ever been
- * previously invoked.
- */
- public synchronized void implicitActivation()
- {
- if (!explicitStateChange)
- try {
- activate() ;
- } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive ai) {
- // ignore the exception.
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediator.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediator.java
deleted file mode 100644
index 7ee5722..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediator.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ForwardRequest ;
-
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-
-/** POAPolicyMediator defines an interface to which the POA delegates all
- * policy specific operations. This permits code paths for different
- * policies to be optimized by creating the correct code at POA creation
- * time. Also note that as much as possible, this interface does not
- * do any concurrency control, except as noted. The POA is responsible
- * for concurrency control.
- */
-public interface POAPolicyMediator {
- /** Return the policies object that was used to create this
- * POAPolicyMediator.
- */
- Policies getPolicies() ;
-
- /** Return the subcontract ID to use in the IIOP profile in IORs
- * created by this POAPolicyMediator's POA. This is initialized
- * according to the policies and the POA used to construct this
- * POAPolicyMediator in the POAPolicyMediatorFactory.
- */
- int getScid() ;
-
- /** Return the server ID to use in the IIOP profile in IORs
- * created by this POAPolicyMediator's POA. This is initialized
- * according to the policies and the POA used to construct this
- * POAPolicyMediator in the POAPolicyMediatorFactory.
- */
- int getServerId() ;
-
- /** Get the servant to use for an invocation with the
- * given id and operation.
- * @param id the object ID for which we are requesting a servant
- * @param operation the name of the operation to be performed on
- * the servant
- * @return the resulting Servant.
- */
- java.lang.Object getInvocationServant( byte[] id,
- String operation ) throws ForwardRequest ;
-
- /** Release a servant that was obtained from getInvocationServant.
- */
- void returnServant() ;
-
- /** Etherealize all servants associated with this POAPolicyMediator.
- * Does nothing if the retention policy is non-retain.
- */
- void etherealizeAll() ;
-
- /** Delete everything in the active object map.
- */
- void clearAOM() ;
-
- /** Return the servant manager. Will throw WrongPolicy
- * if the request processing policy is not USE_SERVANT_MANAGER.
- */
- ServantManager getServantManager() throws WrongPolicy ;
-
- /** Set the servant manager. Will throw WrongPolicy
- * if the request processing policy is not USE_SERVANT_MANAGER.
- */
- void setServantManager( ServantManager servantManager ) throws WrongPolicy ;
-
- /** Return the default servant. Will throw WrongPolicy
- * if the request processing policy is not USE_DEFAULT_SERVANT.
- */
- Servant getDefaultServant() throws NoServant, WrongPolicy ;
-
- /** Set the default servant. Will throw WrongPolicy
- * if the request processing policy is not USE_DEFAULT_SERVANT.
- */
- void setDefaultServant( Servant servant ) throws WrongPolicy ;
-
- void activateObject( byte[] id, Servant servant )
- throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy ;
-
- /** Deactivate the object that is associated with the given id.
- * Returns the servant for id.
- */
- Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy ;
-
- /** Allocate a new, unique system ID. Requires the ID assignment policy
- * to be SYSTEM.
- */
- byte[] newSystemId() throws WrongPolicy ;
-
- byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy ;
-
- Servant idToServant( byte[] id ) throws ObjectNotActive, WrongPolicy ;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase.java
deleted file mode 100644
index 60fe0e4..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import java.util.Collection;
-import java.util.Enumeration ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-
-import com.sun.corba.se.spi.extension.ServantCachingPolicy ;
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-
-
-/** Implementation of POARequesHandler that provides policy specific
- * operations on the POA.
- */
-public abstract class POAPolicyMediatorBase implements POAPolicyMediator {
- protected POAImpl poa ;
- protected ORB orb ;
-
- private int sysIdCounter ;
- private Policies policies ;
- private DelegateImpl delegateImpl ;
-
- private int serverid ;
- private int scid ;
-
- protected boolean isImplicit ;
- protected boolean isUnique ;
- protected boolean isSystemId ;
-
- public final Policies getPolicies()
- {
- return policies ;
- }
-
- public final int getScid()
- {
- return scid ;
- }
-
- public final int getServerId()
- {
- return serverid ;
- }
-
- POAPolicyMediatorBase( Policies policies, POAImpl poa )
- {
- if (policies.isSingleThreaded())
- throw poa.invocationWrapper().singleThreadNotSupported() ;
-
- POAManagerImpl poam = (POAManagerImpl)(poa.the_POAManager()) ;
- POAFactory poaf = poam.getFactory() ;
- delegateImpl = (DelegateImpl)(poaf.getDelegateImpl()) ;
- this.policies = policies ;
- this.poa = poa ;
- orb = (ORB)poa.getORB() ;
-
- switch (policies.servantCachingLevel()) {
- case ServantCachingPolicy.NO_SERVANT_CACHING :
- scid = ORBConstants.TRANSIENT_SCID ;
- break ;
- case ServantCachingPolicy.FULL_SEMANTICS :
- scid = ORBConstants.SC_TRANSIENT_SCID ;
- break ;
- case ServantCachingPolicy.INFO_ONLY_SEMANTICS :
- scid = ORBConstants.IISC_TRANSIENT_SCID ;
- break ;
- case ServantCachingPolicy.MINIMAL_SEMANTICS :
- scid = ORBConstants.MINSC_TRANSIENT_SCID ;
- break ;
- }
-
- if ( policies.isTransient() ) {
- serverid = orb.getTransientServerId();
- } else {
- serverid = orb.getORBData().getPersistentServerId();
- scid = ORBConstants.makePersistent( scid ) ;
- }
-
- isImplicit = policies.isImplicitlyActivated() ;
- isUnique = policies.isUniqueIds() ;
- isSystemId = policies.isSystemAssignedIds() ;
-
- sysIdCounter = 0 ;
- }
-
- public final java.lang.Object getInvocationServant( byte[] id,
- String operation ) throws ForwardRequest
- {
- java.lang.Object result = internalGetServant( id, operation ) ;
-
- return result ;
- }
-
- // Create a delegate and stick it in the servant.
- // This delegate is needed during dispatch for the ObjectImpl._orb()
- // method to work.
- protected final void setDelegate(Servant servant, byte[] id)
- {
- //This new servant delegate no longer needs the id for
- // its initialization.
- servant._set_delegate(delegateImpl);
- }
-
- public synchronized byte[] newSystemId() throws WrongPolicy
- {
- if (!isSystemId)
- throw new WrongPolicy() ;
-
- byte[] array = new byte[8];
- ORBUtility.intToBytes(++sysIdCounter, array, 0);
- ORBUtility.intToBytes( poa.getPOAId(), array, 4);
- return array;
- }
-
- protected abstract java.lang.Object internalGetServant( byte[] id,
- String operation ) throws ForwardRequest ;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java
deleted file mode 100644
index 3b14616..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import org.omg.PortableServer.Servant ;
-
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.impl.javax.rmi.CORBA.Util ;
-
-import com.sun.corba.se.impl.oa.NullServantImpl ;
-
-public abstract class POAPolicyMediatorBase_R extends POAPolicyMediatorBase {
- protected ActiveObjectMap activeObjectMap ;
-
- POAPolicyMediatorBase_R( Policies policies, POAImpl poa )
- {
- super( policies, poa ) ;
-
- // assert policies.retainServants() && policies.useActiveObjectMapOnly()
- if (!policies.retainServants())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
-
- activeObjectMap = ActiveObjectMap.create(poa, !isUnique);
- }
-
- public void returnServant()
- {
- // NO-OP
- }
-
- public void clearAOM()
- {
- activeObjectMap.clear() ;
- activeObjectMap = null ;
- }
-
- protected Servant internalKeyToServant( ActiveObjectMap.Key key )
- {
- AOMEntry entry = activeObjectMap.get(key);
- if (entry == null)
- return null ;
-
- return activeObjectMap.getServant( entry ) ;
- }
-
- protected Servant internalIdToServant( byte[] id )
- {
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
- return internalKeyToServant( key ) ;
- }
-
- protected void activateServant( ActiveObjectMap.Key key, AOMEntry entry, Servant servant )
- {
- setDelegate(servant, key.id );
-
- if (orb.shutdownDebugFlag) {
- System.out.println("Activating object " + servant +
- " with POA " + poa);
- }
-
- activeObjectMap.putServant( servant, entry ) ;
-
- if (Util.isInstanceDefined()) {
- POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ;
- POAFactory factory = pm.getFactory() ;
- factory.registerPOAForServant(poa, servant);
- }
- }
-
- public final void activateObject(byte[] id, Servant servant)
- throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive
- {
- if (isUnique && activeObjectMap.contains(servant))
- throw new ServantAlreadyActive();
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
-
- AOMEntry entry = activeObjectMap.get( key ) ;
-
- // Check for an ObjectAlreadyActive error
- entry.activateObject() ;
- activateServant( key, entry, servant ) ;
- }
-
- public Servant deactivateObject( byte[] id )
- throws ObjectNotActive, WrongPolicy
- {
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
- return deactivateObject( key ) ;
- }
-
- protected void deactivateHelper( ActiveObjectMap.Key key, AOMEntry entry,
- Servant s ) throws ObjectNotActive, WrongPolicy
- {
- // Default does nothing, but the USE_SERVANT_MANAGER case
- // must handle etherealization
-
- activeObjectMap.remove(key);
-
- if (Util.isInstanceDefined()) {
- POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ;
- POAFactory factory = pm.getFactory() ;
- factory.unregisterPOAForServant(poa, s);
- }
- }
-
- public Servant deactivateObject( ActiveObjectMap.Key key )
- throws ObjectNotActive, WrongPolicy
- {
- if (orb.poaDebugFlag) {
- ORBUtility.dprint( this,
- "Calling deactivateObject for key " + key ) ;
- }
-
- try {
- AOMEntry entry = activeObjectMap.get(key);
- if (entry == null)
- throw new ObjectNotActive();
-
- Servant s = activeObjectMap.getServant( entry ) ;
- if (s == null)
- throw new ObjectNotActive();
-
- if (orb.poaDebugFlag) {
- System.out.println("Deactivating object " + s + " with POA " + poa);
- }
-
- deactivateHelper( key, entry, s ) ;
-
- return s ;
- } finally {
- if (orb.poaDebugFlag) {
- ORBUtility.dprint( this,
- "Exiting deactivateObject" ) ;
- }
- }
- }
-
- public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy
- {
- // XXX needs to handle call from an invocation on this POA
-
- if (!isUnique && !isImplicit)
- throw new WrongPolicy();
-
- if (isUnique) {
- ActiveObjectMap.Key key = activeObjectMap.getKey(servant);
- if (key != null)
- return key.id ;
- }
-
- // assert !isUnique || (servant not in activateObjectMap)
-
- if (isImplicit)
- try {
- byte[] id = newSystemId() ;
- activateObject( id, servant ) ;
- return id ;
- } catch (ObjectAlreadyActive oaa) {
- // This can't occur here, since id is always brand new.
- throw poa.invocationWrapper().servantToIdOaa( oaa ) ;
- } catch (ServantAlreadyActive s) {
- throw poa.invocationWrapper().servantToIdSaa( s ) ;
- } catch (WrongPolicy w) {
- throw poa.invocationWrapper().servantToIdWp( w ) ;
- }
-
- throw new ServantNotActive();
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorFactory.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorFactory.java
deleted file mode 100644
index 9b78e1c..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-abstract class POAPolicyMediatorFactory {
- // create an appropriate policy mediator based on the policies.
- // Note that the policies object has already been validated before
- // this call, so it can only contain valid combinations of POA policies.
- static POAPolicyMediator create( Policies policies, POAImpl poa )
- {
- if (policies.retainServants()) {
- if (policies.useActiveMapOnly())
- return new POAPolicyMediatorImpl_R_AOM( policies, poa ) ;
- else if (policies.useDefaultServant())
- return new POAPolicyMediatorImpl_R_UDS( policies, poa ) ;
- else if (policies.useServantManager())
- return new POAPolicyMediatorImpl_R_USM( policies, poa ) ;
- else
- throw poa.invocationWrapper().pmfCreateRetain() ;
- } else {
- if (policies.useDefaultServant())
- return new POAPolicyMediatorImpl_NR_UDS( policies, poa ) ;
- else if (policies.useServantManager())
- return new POAPolicyMediatorImpl_NR_USM( policies, poa ) ;
- else
- throw poa.invocationWrapper().pmfCreateNonRetain() ;
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java
deleted file mode 100644
index 8ad5a64..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import java.util.Enumeration ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-/** Implementation of POAPolicyMediator that provides policy specific
- * operations on the POA.
- */
-public class POAPolicyMediatorImpl_NR_UDS extends POAPolicyMediatorBase {
- private Servant defaultServant ;
-
- POAPolicyMediatorImpl_NR_UDS( Policies policies, POAImpl poa )
- {
- super( policies, poa ) ;
-
- // assert !policies.retainServants() && policies.useDefaultServant()
- if (policies.retainServants())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
-
- if (!policies.useDefaultServant())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
-
- defaultServant = null ;
- }
-
- protected java.lang.Object internalGetServant( byte[] id,
- String operation ) throws ForwardRequest
- {
- if (defaultServant == null)
- throw poa.invocationWrapper().poaNoDefaultServant() ;
-
- return defaultServant;
- }
-
- public void returnServant()
- {
- // NO-OP
- }
-
- public void etherealizeAll()
- {
- // NO-OP
- }
-
- public void clearAOM()
- {
- // NO-OP
- }
-
- public ServantManager getServantManager() throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public void setServantManager( ServantManager servantManager ) throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public Servant getDefaultServant() throws NoServant, WrongPolicy
- {
- if (defaultServant == null)
- throw new NoServant();
- return defaultServant;
- }
-
- public void setDefaultServant( Servant servant ) throws WrongPolicy
- {
- this.defaultServant = servant;
- setDelegate(defaultServant, "DefaultServant".getBytes());
- }
-
- public final void activateObject(byte[] id, Servant servant)
- throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive
- {
- throw new WrongPolicy();
- }
-
- public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public Servant idToServant( byte[] id )
- throws WrongPolicy, ObjectNotActive
- {
- if (defaultServant != null)
- return defaultServant;
-
- throw new ObjectNotActive() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java
deleted file mode 100644
index 280b8b1..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import java.util.Enumeration ;
-
-import org.omg.PortableServer.POA ;
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ServantLocator ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.ServantLocatorPackage.CookieHolder ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.spi.oa.OAInvocationInfo ;
-import com.sun.corba.se.impl.oa.NullServantImpl ;
-
-/** Implementation of POARequesHandler that provides policy specific
- * operations on the POA.
- */
-public class POAPolicyMediatorImpl_NR_USM extends POAPolicyMediatorBase {
- private ServantLocator locator ;
-
- POAPolicyMediatorImpl_NR_USM( Policies policies, POAImpl poa )
- {
- super( policies, poa ) ;
-
- // assert !policies.retainServants() && policies.useServantManager()
- if (policies.retainServants())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
-
- if (!policies.useServantManager())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
-
- locator = null ;
- }
-
- protected java.lang.Object internalGetServant( byte[] id,
- String operation ) throws ForwardRequest
- {
- if (locator == null)
- throw poa.invocationWrapper().poaNoServantManager() ;
-
- CookieHolder cookieHolder = orb.peekInvocationInfo().getCookieHolder() ;
-
- // Try - finally is J2EE requirement.
- java.lang.Object servant;
- try{
- poa.unlock() ;
-
- servant = locator.preinvoke(id, poa, operation, cookieHolder);
- if (servant == null)
- servant = new NullServantImpl( poa.omgInvocationWrapper().nullServantReturned() ) ;
- else
- setDelegate( (Servant)servant, id);
- } finally {
- poa.lock() ;
- }
-
- return servant;
- }
-
- public void returnServant()
- {
- OAInvocationInfo info = orb.peekInvocationInfo();
- if (locator == null)
- return;
-
- try {
- poa.unlock() ;
- locator.postinvoke(info.id(), (POA)(info.oa()),
- info.getOperation(), info.getCookieHolder().value,
- (Servant)(info.getServantContainer()) );
- } finally {
- poa.lock() ;
- }
- }
-
- public void etherealizeAll()
- {
- // NO-OP
- }
-
- public void clearAOM()
- {
- // NO-OP
- }
-
- public ServantManager getServantManager() throws WrongPolicy
- {
- return locator ;
- }
-
- public void setServantManager( ServantManager servantManager ) throws WrongPolicy
- {
- if (locator != null)
- throw poa.invocationWrapper().servantManagerAlreadySet() ;
-
- if (servantManager instanceof ServantLocator)
- locator = (ServantLocator)servantManager;
- else
- throw poa.invocationWrapper().servantManagerBadType() ;
- }
-
- public Servant getDefaultServant() throws NoServant, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public void setDefaultServant( Servant servant ) throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public final void activateObject(byte[] id, Servant servant)
- throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive
- {
- throw new WrongPolicy();
- }
-
- public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public Servant idToServant( byte[] id )
- throws WrongPolicy, ObjectNotActive
- {
- throw new WrongPolicy();
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java
deleted file mode 100644
index 795514e..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.impl.oa.NullServantImpl ;
-
-/** Implementation of POARequesHandler that provides policy specific
- * operations on the POA in the case:
- * <ul>
- * <li>retain</li>
- * <li>useActiveObjectMapOnly</li>
- * </ul>
- */
-public class POAPolicyMediatorImpl_R_AOM extends POAPolicyMediatorBase_R {
- POAPolicyMediatorImpl_R_AOM( Policies policies, POAImpl poa )
- {
- // assert policies.retainServants()
- super( policies, poa ) ;
-
- // policies.useActiveObjectMapOnly()
- if (!policies.useActiveMapOnly())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
- }
-
- protected java.lang.Object internalGetServant( byte[] id,
- String operation ) throws ForwardRequest
- {
- java.lang.Object servant = internalIdToServant( id ) ;
- if (servant == null)
- servant = new NullServantImpl(
- poa.invocationWrapper().nullServant() ) ;
- return servant ;
- }
-
- public void etherealizeAll()
- {
- // NO-OP
- }
-
- public ServantManager getServantManager() throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public void setServantManager( ServantManager servantManager )
- throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public Servant getDefaultServant() throws NoServant, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public void setDefaultServant( Servant servant ) throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public Servant idToServant( byte[] id )
- throws WrongPolicy, ObjectNotActive
- {
- Servant s = internalIdToServant( id ) ;
-
- if (s == null)
- throw new ObjectNotActive() ;
- else
- return s;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java
deleted file mode 100644
index 8eb00dc..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import java.util.Enumeration ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-/** Implementation of POARequesHandler that provides policy specific
- * operations on the POA.
- */
-public class POAPolicyMediatorImpl_R_UDS extends POAPolicyMediatorBase_R {
- private Servant defaultServant ;
-
- POAPolicyMediatorImpl_R_UDS( Policies policies, POAImpl poa )
- {
- // assert policies.retainServants()
- super( policies, poa ) ;
- defaultServant = null ;
-
- // policies.useDefaultServant()
- if (!policies.useDefaultServant())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
- }
-
- protected java.lang.Object internalGetServant( byte[] id,
- String operation ) throws ForwardRequest
- {
- Servant servant = internalIdToServant( id ) ;
- if (servant == null)
- servant = defaultServant ;
-
- if (servant == null)
- throw poa.invocationWrapper().poaNoDefaultServant() ;
-
- return servant ;
- }
-
- public void etherealizeAll()
- {
- // NO-OP
- }
-
- public ServantManager getServantManager() throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public void setServantManager( ServantManager servantManager ) throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public Servant getDefaultServant() throws NoServant, WrongPolicy
- {
- if (defaultServant == null)
- throw new NoServant();
- else
- return defaultServant;
- }
-
- public void setDefaultServant( Servant servant ) throws WrongPolicy
- {
- defaultServant = servant;
- setDelegate(defaultServant, "DefaultServant".getBytes());
- }
-
- public Servant idToServant( byte[] id )
- throws WrongPolicy, ObjectNotActive
- {
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
- Servant s = internalKeyToServant(key);
-
- if (s == null)
- if (defaultServant != null)
- s = defaultServant;
-
- if (s == null)
- throw new ObjectNotActive() ;
-
- return s;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java
deleted file mode 100644
index 6c40f74..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import java.util.Set ;
-
-import org.omg.CORBA.SystemException ;
-
-import org.omg.PortableServer.ServantActivator ;
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.impl.oa.NullServantImpl ;
-
-import com.sun.corba.se.impl.javax.rmi.CORBA.Util ;
-
-import com.sun.corba.se.spi.oa.OAInvocationInfo ;
-import com.sun.corba.se.spi.oa.NullServant ;
-
-/** Implementation of POARequesHandler that provides policy specific
- * operations on the POA.
- */
-public class POAPolicyMediatorImpl_R_USM extends POAPolicyMediatorBase_R {
- protected ServantActivator activator ;
-
- POAPolicyMediatorImpl_R_USM( Policies policies, POAImpl poa )
- {
- // assert policies.retainServants()
- super( policies, poa ) ;
- activator = null ;
-
- if (!policies.useServantManager())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
- }
-
- /* This handles a rather subtle bug (4939892). The problem is that
- * enter will wait on the entry if it is being etherealized. When the
- * deferred state transition completes, the entry is no longer in the
- * AOM, and so we need to get a new entry, otherwise activator.incarnate
- * will be called twice, once for the old entry, and again when a new
- * entry is created. This fix also required extending the FSM StateEngine
- * to allow actions to throw exceptions, and adding a new state in the
- * AOMEntry FSM to detect this condition.
- */
- private AOMEntry enterEntry( ActiveObjectMap.Key key )
- {
- AOMEntry result = null ;
- boolean failed ;
- do {
- failed = false ;
- result = activeObjectMap.get(key) ;
-
- try {
- result.enter() ;
- } catch (Exception exc) {
- failed = true ;
- }
- } while (failed) ;
-
- return result ;
- }
-
- protected java.lang.Object internalGetServant( byte[] id,
- String operation ) throws ForwardRequest
- {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "Calling POAPolicyMediatorImpl_R_USM.internalGetServant " +
- "for poa " + poa + " operation=" + operation ) ;
- }
-
- try {
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
- AOMEntry entry = enterEntry(key) ;
- java.lang.Object servant = activeObjectMap.getServant( entry ) ;
- if (servant != null) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: servant already activated" ) ;
- }
-
- return servant ;
- }
-
- if (activator == null) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: no servant activator in POA" ) ;
- }
-
- entry.incarnateFailure() ;
- throw poa.invocationWrapper().poaNoServantManager() ;
- }
-
- // Drop the POA lock during the incarnate call and
- // re-acquire it afterwards. The entry state machine
- // prevents more than one thread from executing the
- // incarnate method at a time within the same POA.
- try {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: upcall to incarnate" ) ;
- }
-
- poa.unlock() ;
-
- servant = activator.incarnate(id, poa);
-
- if (servant == null)
- servant = new NullServantImpl(
- poa.omgInvocationWrapper().nullServantReturned() ) ;
- } catch (ForwardRequest freq) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: incarnate threw ForwardRequest" ) ;
- }
-
- throw freq ;
- } catch (SystemException exc) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: incarnate threw SystemException " + exc ) ;
- }
-
- throw exc ;
- } catch (Throwable exc) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: incarnate threw Throwable " + exc ) ;
- }
-
- throw poa.invocationWrapper().poaServantActivatorLookupFailed(
- exc ) ;
- } finally {
- poa.lock() ;
-
- // servant == null means incarnate threw an exception,
- // while servant instanceof NullServant means incarnate returned a
- // null servant. Either case is an incarnate failure to the
- // entry state machine.
- if ((servant == null) || (servant instanceof NullServant)) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: incarnate failed" ) ;
- }
-
- // XXX Does the AOM leak in this case? Yes,
- // but the problem is hard to fix. There may be
- // a number of threads waiting for the state to change
- // from INCARN to something else, which is VALID or
- // INVALID, depending on the incarnate result.
- // The activeObjectMap.get() call above creates an
- // ActiveObjectMap.Entry if one does not already exist,
- // and stores it in the keyToEntry map in the AOM.
- entry.incarnateFailure() ;
- } else {
- // here check for unique_id policy, and if the servant
- // is already registered for a different ID, then throw
- // OBJ_ADAPTER exception, else activate it. Section 11.3.5.1
- // 99-10-07.pdf
- if (isUnique) {
- // check if the servant already is associated with some id
- if (activeObjectMap.contains((Servant)servant)) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: servant already assigned to ID" ) ;
- }
-
- entry.incarnateFailure() ;
- throw poa.invocationWrapper().poaServantNotUnique() ;
- }
- }
-
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: incarnate complete" ) ;
- }
-
- entry.incarnateComplete() ;
- activateServant(key, entry, (Servant)servant);
- }
- }
-
- return servant ;
- } finally {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "Exiting POAPolicyMediatorImpl_R_USM.internalGetServant " +
- "for poa " + poa ) ;
- }
- }
- }
-
- public void returnServant()
- {
- OAInvocationInfo info = orb.peekInvocationInfo();
- byte[] id = info.id() ;
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
- AOMEntry entry = activeObjectMap.get( key ) ;
- entry.exit() ;
- }
-
- public void etherealizeAll()
- {
- if (activator != null) {
- Set keySet = activeObjectMap.keySet() ;
-
- // Copy the elements in the set to an array to avoid
- // changes in the set due to concurrent modification
- ActiveObjectMap.Key[] keys =
- (ActiveObjectMap.Key[])keySet.toArray(
- new ActiveObjectMap.Key[ keySet.size() ] ) ;
-
- for (int ctr=0; ctr<keySet.size(); ctr++) {
- ActiveObjectMap.Key key = keys[ctr] ;
- AOMEntry entry = activeObjectMap.get( key ) ;
- Servant servant = activeObjectMap.getServant( entry ) ;
- if (servant != null) {
- boolean remainingActivations =
- activeObjectMap.hasMultipleIDs(entry) ;
-
- // Here we etherealize in the thread that called this
- // method, rather than etherealizing in a new thread
- // as in the deactivate case. We still inform the
- // entry state machine so that only one thread at a
- // time can call the etherealize method.
- entry.startEtherealize( null ) ;
- try {
- poa.unlock() ;
- try {
- activator.etherealize(key.id, poa, servant, true,
- remainingActivations);
- } catch (Exception exc) {
- // ignore all exceptions
- }
- } finally {
- poa.lock() ;
- entry.etherealizeComplete() ;
- }
- }
- }
- }
- }
-
- public ServantManager getServantManager() throws WrongPolicy
- {
- return activator;
- }
-
- public void setServantManager(
- ServantManager servantManager ) throws WrongPolicy
- {
- if (activator != null)
- throw poa.invocationWrapper().servantManagerAlreadySet() ;
-
- if (servantManager instanceof ServantActivator)
- activator = (ServantActivator)servantManager;
- else
- throw poa.invocationWrapper().servantManagerBadType() ;
- }
-
- public Servant getDefaultServant() throws NoServant, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public void setDefaultServant( Servant servant ) throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- class Etherealizer extends Thread {
- private POAPolicyMediatorImpl_R_USM mediator ;
- private ActiveObjectMap.Key key ;
- private AOMEntry entry ;
- private Servant servant ;
- private boolean debug ;
-
- public Etherealizer( POAPolicyMediatorImpl_R_USM mediator,
- ActiveObjectMap.Key key, AOMEntry entry, Servant servant,
- boolean debug )
- {
- this.mediator = mediator ;
- this.key = key ;
- this.entry = entry;
- this.servant = servant;
- this.debug = debug ;
- }
-
- public void run() {
- if (debug) {
- ORBUtility.dprint( this, "Calling Etherealizer.run on key " +
- key ) ;
- }
-
- try {
- try {
- mediator.activator.etherealize( key.id, mediator.poa, servant,
- false, mediator.activeObjectMap.hasMultipleIDs( entry ) );
- } catch (Exception exc) {
- // ignore all exceptions
- }
-
- try {
- mediator.poa.lock() ;
-
- entry.etherealizeComplete() ;
- mediator.activeObjectMap.remove( key ) ;
-
- POAManagerImpl pm = (POAManagerImpl)mediator.poa.the_POAManager() ;
- POAFactory factory = pm.getFactory() ;
- factory.unregisterPOAForServant( mediator.poa, servant);
- } finally {
- mediator.poa.unlock() ;
- }
- } finally {
- if (debug) {
- ORBUtility.dprint( this, "Exiting Etherealizer.run" ) ;
- }
- }
- }
- }
-
- public void deactivateHelper( ActiveObjectMap.Key key, AOMEntry entry,
- Servant servant ) throws ObjectNotActive, WrongPolicy
- {
- if (activator == null)
- throw poa.invocationWrapper().poaNoServantManager() ;
-
- Etherealizer eth = new Etherealizer( this, key, entry, servant, poa.getDebug() ) ;
- entry.startEtherealize( eth ) ;
- }
-
- public Servant idToServant( byte[] id )
- throws WrongPolicy, ObjectNotActive
- {
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
- AOMEntry entry = activeObjectMap.get(key);
-
- Servant servant = activeObjectMap.getServant( entry ) ;
- if (servant != null)
- return servant ;
- else
- throw new ObjectNotActive() ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/Policies.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/Policies.java
deleted file mode 100644
index 41b49bf..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/Policies.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import java.util.HashMap ;
-import java.util.BitSet ;
-import java.util.Iterator ;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-import com.sun.corba.se.spi.extension.ServantCachingPolicy ;
-import com.sun.corba.se.spi.extension.ZeroPortPolicy ;
-import com.sun.corba.se.spi.extension.CopyObjectPolicy ;
-
-import org.omg.CORBA.*;
-import org.omg.PortableServer.*;
-import org.omg.PortableServer.POAPackage.*;
-
-public final class Policies {
-/* Order of *POLICY_ID :
- THREAD_
- LIFESPAN_
- ID_UNIQUENESS_
- ID_ASSIGNMENT_
- IMPLICIT_ACTIVATION_
- SERvANT_RETENTION_
- REQUEST_PROCESSING_
- The code in this class depends on this order!
-*/
- private static final int MIN_POA_POLICY_ID = THREAD_POLICY_ID.value ;
- private static final int MAX_POA_POLICY_ID = REQUEST_PROCESSING_POLICY_ID.value ;
- private static final int POLICY_TABLE_SIZE = MAX_POA_POLICY_ID -
- MIN_POA_POLICY_ID + 1 ;
-
- int defaultObjectCopierFactoryId ;
-
- private HashMap policyMap = new HashMap() ; // Maps Integer(policy type) to Policy
-
- public static final Policies defaultPolicies
- = new Policies() ;
-
- public static final Policies rootPOAPolicies
- = new Policies(
- ThreadPolicyValue._ORB_CTRL_MODEL,
- LifespanPolicyValue._TRANSIENT,
- IdUniquenessPolicyValue._UNIQUE_ID,
- IdAssignmentPolicyValue._SYSTEM_ID,
- ImplicitActivationPolicyValue._IMPLICIT_ACTIVATION,
- ServantRetentionPolicyValue._RETAIN,
- RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY ) ;
-
- private int[] poaPolicyValues ;
-
- private int getPolicyValue( int id )
- {
- return poaPolicyValues[ id - MIN_POA_POLICY_ID ] ;
- }
-
- private void setPolicyValue( int id, int value )
- {
- poaPolicyValues[ id - MIN_POA_POLICY_ID ] = value ;
- }
-
- private Policies(
- int threadModel,
- int lifespan,
- int idUniqueness,
- int idAssignment,
- int implicitActivation,
- int retention,
- int requestProcessing )
- {
- poaPolicyValues = new int[] {
- threadModel,
- lifespan,
- idUniqueness,
- idAssignment,
- implicitActivation,
- retention,
- requestProcessing };
- }
-
- private Policies() {
- this( ThreadPolicyValue._ORB_CTRL_MODEL,
- LifespanPolicyValue._TRANSIENT,
- IdUniquenessPolicyValue._UNIQUE_ID,
- IdAssignmentPolicyValue._SYSTEM_ID,
- ImplicitActivationPolicyValue._NO_IMPLICIT_ACTIVATION,
- ServantRetentionPolicyValue._RETAIN,
- RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY ) ;
- }
-
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append( "Policies[" ) ;
- boolean first = true ;
- Iterator iter = policyMap.values().iterator() ;
- while (iter.hasNext()) {
- if (first)
- first = false ;
- else
- buffer.append( "," ) ;
-
- buffer.append( iter.next().toString() ) ;
- }
- buffer.append( "]" ) ;
- return buffer.toString() ;
- }
-
- /* Returns the integer value of the POA policy, if this is a
- * POA policy, otherwise returns -1.
- */
- private int getPOAPolicyValue( Policy policy)
- {
- if (policy instanceof ThreadPolicy) {
- return ((ThreadPolicy) policy).value().value();
- } else if (policy instanceof LifespanPolicy) {
- return ((LifespanPolicy) policy).value().value();
- } else if (policy instanceof IdUniquenessPolicy) {
- return ((IdUniquenessPolicy) policy).value().value();
- } else if (policy instanceof IdAssignmentPolicy) {
- return ((IdAssignmentPolicy) policy).value().value();
- } else if (policy instanceof ServantRetentionPolicy) {
- return ((ServantRetentionPolicy) policy).value().value();
- } else if (policy instanceof RequestProcessingPolicy) {
- return ((RequestProcessingPolicy) policy).value().value();
- } else if (policy instanceof ImplicitActivationPolicy) {
- return ((ImplicitActivationPolicy) policy).value().value();
- } else
- return -1 ;
- }
-
- /** If any errors were found, throw INVALID_POLICY with the smallest
- * index of any offending policy.
- */
- private void checkForPolicyError( BitSet errorSet ) throws InvalidPolicy
- {
- for (short ctr=0; ctr<errorSet.length(); ctr++ )
- if (errorSet.get(ctr))
- throw new InvalidPolicy(ctr);
- }
-
- /** Add the first index in policies at which the policy is of type
- * policyId to errorSet, if the polictId is in policies (it may not be).
- */
- private void addToErrorSet( Policy[] policies, int policyId,
- BitSet errorSet )
- {
- for (int ctr=0; ctr<policies.length; ctr++ )
- if (policies[ctr].policy_type() == policyId) {
- errorSet.set( ctr ) ;
- return ;
- }
- }
-
- /** Main constructor used from POA::create_POA. This need only be visible
- * within the POA package.
- */
- Policies(Policy[] policies, int id ) throws InvalidPolicy
- {
- // Make sure the defaults are set according to the POA spec
- this();
-
- defaultObjectCopierFactoryId = id ;
-
- if ( policies == null )
- return;
-
- // Set to record all indices in policies for which errors
- // were observed.
- BitSet errorSet = new BitSet( policies.length ) ;
-
- for(short i = 0; i < policies.length; i++) {
- Policy policy = policies[i];
- int POAPolicyValue = getPOAPolicyValue( policy ) ;
-
- // Save the policy in policyMap to support
- // POA.get_effective_policy, if it was not already saved
- // in policyMap.
- Integer key = new Integer( policy.policy_type() ) ;
- Policy prev = (Policy)(policyMap.get( key )) ;
- if (prev == null)
- policyMap.put( key, policy ) ;
-
- if (POAPolicyValue >= 0) {
- setPolicyValue( key.intValue(), POAPolicyValue ) ;
-
- // if the value of this POA policy was previously set to a
- // different value than the current value given in
- // POAPolicyValue, record an error.
- if ((prev != null) &&
- (getPOAPolicyValue( prev ) != POAPolicyValue))
- errorSet.set( i ) ;
- }
- }
-
- // Check for bad policy combinations
-
- // NON_RETAIN requires USE_DEFAULT_SERVANT or USE_SERVANT_MANAGER
- if (!retainServants() && useActiveMapOnly() ) {
- addToErrorSet( policies, SERVANT_RETENTION_POLICY_ID.value,
- errorSet ) ;
- addToErrorSet( policies, REQUEST_PROCESSING_POLICY_ID.value,
- errorSet ) ;
- }
-
- // IMPLICIT_ACTIVATION requires SYSTEM_ID and RETAIN
- if (isImplicitlyActivated()) {
- if (!retainServants()) {
- addToErrorSet( policies, IMPLICIT_ACTIVATION_POLICY_ID.value,
- errorSet ) ;
- addToErrorSet( policies, SERVANT_RETENTION_POLICY_ID.value,
- errorSet ) ;
- }
-
- if (!isSystemAssignedIds()) {
- addToErrorSet( policies, IMPLICIT_ACTIVATION_POLICY_ID.value,
- errorSet ) ;
- addToErrorSet( policies, ID_ASSIGNMENT_POLICY_ID.value,
- errorSet ) ;
- }
- }
-
- checkForPolicyError( errorSet ) ;
- }
-
- public Policy get_effective_policy( int type )
- {
- Integer key = new Integer( type ) ;
- Policy result = (Policy)(policyMap.get(key)) ;
- return result ;
- }
-
- /* Thread Policies */
- public final boolean isOrbControlledThreads() {
- return getPolicyValue( THREAD_POLICY_ID.value ) ==
- ThreadPolicyValue._ORB_CTRL_MODEL;
- }
- public final boolean isSingleThreaded() {
- return getPolicyValue( THREAD_POLICY_ID.value ) ==
- ThreadPolicyValue._SINGLE_THREAD_MODEL;
- }
-
- /* Lifespan */
- public final boolean isTransient() {
- return getPolicyValue( LIFESPAN_POLICY_ID.value ) ==
- LifespanPolicyValue._TRANSIENT;
- }
- public final boolean isPersistent() {
- return getPolicyValue( LIFESPAN_POLICY_ID.value ) ==
- LifespanPolicyValue._PERSISTENT;
- }
-
- /* ID Uniqueness */
- public final boolean isUniqueIds() {
- return getPolicyValue( ID_UNIQUENESS_POLICY_ID.value ) ==
- IdUniquenessPolicyValue._UNIQUE_ID;
- }
- public final boolean isMultipleIds() {
- return getPolicyValue( ID_UNIQUENESS_POLICY_ID.value ) ==
- IdUniquenessPolicyValue._MULTIPLE_ID;
- }
-
- /* ID Assignment */
- public final boolean isUserAssignedIds() {
- return getPolicyValue( ID_ASSIGNMENT_POLICY_ID.value ) ==
- IdAssignmentPolicyValue._USER_ID;
- }
- public final boolean isSystemAssignedIds() {
- return getPolicyValue( ID_ASSIGNMENT_POLICY_ID.value ) ==
- IdAssignmentPolicyValue._SYSTEM_ID;
- }
-
- /* Servant Rentention */
- public final boolean retainServants() {
- return getPolicyValue( SERVANT_RETENTION_POLICY_ID.value ) ==
- ServantRetentionPolicyValue._RETAIN;
- }
-
- /* Request Processing */
- public final boolean useActiveMapOnly() {
- return getPolicyValue( REQUEST_PROCESSING_POLICY_ID.value ) ==
- RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY;
- }
- public final boolean useDefaultServant() {
- return getPolicyValue( REQUEST_PROCESSING_POLICY_ID.value ) ==
- RequestProcessingPolicyValue._USE_DEFAULT_SERVANT;
- }
- public final boolean useServantManager() {
- return getPolicyValue( REQUEST_PROCESSING_POLICY_ID.value ) ==
- RequestProcessingPolicyValue._USE_SERVANT_MANAGER;
- }
-
- /* Implicit Activation */
- public final boolean isImplicitlyActivated() {
- return getPolicyValue( IMPLICIT_ACTIVATION_POLICY_ID.value ) ==
- ImplicitActivationPolicyValue._IMPLICIT_ACTIVATION;
- }
-
- /* proprietary servant caching policy */
- public final int servantCachingLevel()
- {
- Integer key = new Integer( ORBConstants.SERVANT_CACHING_POLICY ) ;
- ServantCachingPolicy policy = (ServantCachingPolicy)policyMap.get( key ) ;
- if (policy == null)
- return ServantCachingPolicy.NO_SERVANT_CACHING ;
- else
- return policy.getType() ;
- }
-
- public final boolean forceZeroPort()
- {
- Integer key = new Integer( ORBConstants.ZERO_PORT_POLICY ) ;
- ZeroPortPolicy policy = (ZeroPortPolicy)policyMap.get( key ) ;
- if (policy == null)
- return false ;
- else
- return policy.forceZeroPort() ;
- }
-
- public final int getCopierId()
- {
- Integer key = new Integer( ORBConstants.COPY_OBJECT_POLICY ) ;
- CopyObjectPolicy policy = (CopyObjectPolicy)policyMap.get( key ) ;
- if (policy != null)
- return policy.getValue() ;
- else
- return defaultObjectCopierFactoryId ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/RequestProcessingPolicyImpl.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/RequestProcessingPolicyImpl.java
deleted file mode 100644
index 4ef1bd7..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/RequestProcessingPolicyImpl.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import org.omg.CORBA.*;
-import org.omg.PortableServer.*;
-
-public class RequestProcessingPolicyImpl
- extends org.omg.CORBA.LocalObject implements RequestProcessingPolicy {
-
- public RequestProcessingPolicyImpl(RequestProcessingPolicyValue
- value) {
- this.value = value;
- }
-
- public RequestProcessingPolicyValue value() {
- return value;
- }
-
- public int policy_type()
- {
- return REQUEST_PROCESSING_POLICY_ID.value ;
- }
-
- public Policy copy() {
- return new RequestProcessingPolicyImpl(value);
- }
-
- public void destroy() {
- value = null;
- }
-
- private RequestProcessingPolicyValue value;
-
- public String toString()
- {
- String type = null ;
- switch (value.value()) {
- case RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY :
- type = "USE_ACTIVE_OBJECT_MAP_ONLY" ;
- break ;
- case RequestProcessingPolicyValue._USE_DEFAULT_SERVANT :
- type = "USE_DEFAULT_SERVANT" ;
- break ;
- case RequestProcessingPolicyValue._USE_SERVANT_MANAGER :
- type = "USE_SERVANT_MANAGER" ;
- break ;
- }
-
- return "RequestProcessingPolicy[" + type + "]" ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/ServantRetentionPolicyImpl.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/ServantRetentionPolicyImpl.java
deleted file mode 100644
index c6c8801..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/ServantRetentionPolicyImpl.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import org.omg.CORBA.*;
-import org.omg.PortableServer.*;
-
-final class ServantRetentionPolicyImpl
- extends org.omg.CORBA.LocalObject implements ServantRetentionPolicy {
-
- public ServantRetentionPolicyImpl(ServantRetentionPolicyValue value) {
- this.value = value;
- }
-
- public ServantRetentionPolicyValue value() {
- return value;
- }
-
- public int policy_type()
- {
- return SERVANT_RETENTION_POLICY_ID.value ;
- }
-
- public Policy copy() {
- return new ServantRetentionPolicyImpl(value);
- }
-
- public void destroy() {
- value = null;
- }
-
- private ServantRetentionPolicyValue value;
-
- public String toString()
- {
- return "ServantRetentionPolicy[" +
- ((value.value() == ServantRetentionPolicyValue._RETAIN) ?
- "RETAIN" : "NON_RETAIN" + "]") ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/ThreadPolicyImpl.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/ThreadPolicyImpl.java
deleted file mode 100644
index f75d0fe..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/ThreadPolicyImpl.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import org.omg.CORBA.*;
-import org.omg.PortableServer.*;
-
-final class ThreadPolicyImpl
- extends org.omg.CORBA.LocalObject implements ThreadPolicy {
-
- public ThreadPolicyImpl(ThreadPolicyValue value) {
- this.value = value;
- }
-
- public ThreadPolicyValue value() {
- return value;
- }
-
- public int policy_type()
- {
- return THREAD_POLICY_ID.value ;
- }
-
- public Policy copy() {
- return new ThreadPolicyImpl(value);
- }
-
- public void destroy() {
- value = null;
- }
-
- private ThreadPolicyValue value;
-
- public String toString()
- {
- return "ThreadPolicy[" +
- ((value.value() == ThreadPolicyValue._SINGLE_THREAD_MODEL) ?
- "SINGLE_THREAD_MODEL" : "ORB_CTRL_MODEL" + "]") ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/minor_code_example.txt b/src/share/classes/com/sun/corba/se/impl/oa/poa/minor_code_example.txt
deleted file mode 100644
index 3cb3fc3..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/minor_code_example.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-package @PKGNAME@ ;
-
-import org.omg.CORBA.OMGVMCID ;
-import org.omg.CORBA.CompletionStatus ;
-
-import org.omg.CORBA.@SYSEX@ ;
-
-public abstract class StandardException {
- // @SYSEX@ BAD_CONTEXT
-
- public void IdlContextNotFound( CompletionStatus completed )
- {
- throw new BAD_CONTEXT( "IDL context not found",
- OMGVMCID.value + 1, completed ) ;
- }
-
- public void IdlContextNotFound( )
- {
- IdlContextNotFound( CompletionStatus.COMPLETED_NO ) ;
- }
-
-Data structures: list[ ... ] vector[ ... ] ( record )
-
-list[ ( string{exception name} list[ ( string{code name} int{value} string{description} ] ) ]
-
-Processing:
-
-
- open file (fname)
- fr = new FileReader( fname )
- br = new BufferedReader( fr )
- br.readLine() returns null at EOF
-
- want a BufferedReader
-
- while not eol read line
- if (line start with spaces)
- add to current index
- else
- new exception
-
- create StandardException class
-
- foreach ( excname vec ) in data
- add import statement for execname to output
-
- foreach ( codename value descr ) in vec
- generate full method
- generate short method
-
-
-(define (read-file fname)
- (begin
- (let port (open-input-port fname))
- (let obj (read port))
- obj
- )
-)
-
-
-
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/standard_minor_codes.txt b/src/share/classes/com/sun/corba/se/impl/oa/poa/standard_minor_codes.txt
deleted file mode 100644
index 294ed5d..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/standard_minor_codes.txt
+++ /dev/null
@@ -1,160 +0,0 @@
-(
-(BAD_CONTEXT
- (IDL_CONTEXT_NOT_FOUND 1 "IDL context not found")
- (NO_MATCHING_IDL_CONTEXT 2 "No matching IDL context property")
-)
-(BAD_INV_ORDER
- (DEP_PREVENT_DESTRUCTION 1 "Dependency exists in IFR preventing destruction of this object")
- (DESTROY_INDESTRUCTIBLE 2 "Attempt to destroy indestructible objects in IFR")
- (OPERATION_DEADLOCK 3 "Operation would deadlock")
- (ORB_SHUTDOWN 4 "ORB has shutdown")
- (BAD_INVOKE 5 "Attempt to invoke send or invoke operation of the same Request object more than once ")
- (BAD_SET_SERVANT_MANAGER 6 "Attempt to set a servent manager after one has already been set")
- (BAD_ARGUMENTS_CALL 7 "ServerRequest::arguments called more than once or after a call to ServerRequest::set_exception")
- (BAD_CTX_CALL 8 "ServerRequest::ctx called more than once or before ServerRequest::arguments or after ServerRequest::ctx, ServerRequest::set_result or ServerRequest::set_exception")
- (BAD_RESULT_CALL 9 "ServerRequest::set_result called more than once or before ServerRequest::arguments or after ServerRequest::set_result or ServerRequest::set_exception")
- (BAD_SEND 10 "Attempt to send a DII request after it was sent previously")
- (BAD_POLL_BEFORE 11 "Attempt to poll a DII request or to retrieve its result before the request was sent")
- (BAD_POLL_AFTER 12 "Attempt to poll a DII request or to retrieve its result after the result was retrieved previously")
- (BAD_POLL_SYNC 13 "Attempt to poll a synchronous DII request or to retrieve results from a synchronous DII request")
- (BAD_PI_CALL 14 "Invalid portable interceptor call")
- (BAD_PI_ADD_SERVICE_CONTEXT 15 "Service context add failed in portable interceptor because a service context with the given id already exists")
- (DUPLICATE_POLICY_FACTORY 16 "Registration of PolicyFactory failed because a factory already exists for the given PolicyType")
- (CREATE_POA_DESTROY 17 "POA cannot create POAs while undergoing destruction")
- (PRIORITY_REASSIGN 18 "Attempt to reassign priority")
- (XA_START_OUTSIZE 19 "An OTS/XA integration xa_start() call returned XAER_OUTSIDE")
- (XA_START_PROTO 20 "An OTS/XA integration xa_ call returned XAER_PROTO")
-)
-(BAD_OPERATION
- (BAD_SERVANT_MANAGER_TYPE 1 "ServantManager returned wrong servant type")
- (OPERATION_UNKNOWN_TO_TARGET 2 "Operation or attribute not known to target object ")
-)
-(BAD_PARAM
- (VALUE_FACTORY_REG_ERROR 1 "Failure to register, unregister or lookup value factory")
- (RID_ALREADY_DEFINED 2 "RID already defined in IFR")
- (NAME_USED_IFR 3 "Name already used in the context in IFR ")
- (TARGET_NOT_CONTAINER 4 "Target is not a valid container")
- (NAME_CLASH 5 "Name clash in inherited context")
- (BAD_ABSTRACT_INTERFACE_TYPE 6 "Incorrect type for abstract interface")
- (SO_BAD_SCHEME_NAME 7 "string_to_object conversion failed due to bad scheme name")
- (SO_BAD_ADDRESS 8 "string_to_object conversion failed due to bad address")
- (SO_BAD_SCHEMA_SPECIFIC 9 "string_to_object conversion failed due to bad bad schema specific part")
- (SO_NON_SPECIFIC 10 "string_to_object conversion failed due to non specific reason")
- (IR_DERIVE_ABS_INT_BASE 11 "Attempt to derive abstract interface from non-abstract base interface in the Interface Repository")
- (IR_VALUE_SUPPORT 12 "Attempt to let a ValueDef support more than one non-abstract interface in the Interface Repository")
- (INCOMPLETE_TYPECODE 13 "Attempt to use an incomplete TypeCode as a parameter")
- (INVALID_OBJECT_ID 14 "Invalid object id passed to POA::create_reference_by_id ")
- (TYPECODE_BAD_NAME 15 "Bad name argument in TypeCode operation")
- (TYPECODE_BAD_REPID 16 "Bad RepositoryId argument in TypeCode operation")
- (TYPECODE_INV_MEMBER 17 "Invalid member name in TypeCode operation ")
- (TC_UNION_DUP_LABEL 18 "Duplicate label value in create_union_tc ")
- (TC_UNION_INCOMPATIBLE 19 "Incompatible TypeCode of label and discriminator in create_union_tc ")
- (TC_UNION_BAD_DISC 20 "Supplied discriminator type illegitimate in create_union_tc ")
- (SET_EXCEPTION_BAD_ANY 21 "Any passed to ServerRequest::set_exception does not contain an exception ")
- (SET_EXCEPTION_UNLISTED 22 "Unlisted user exception passed to ServerRequest::set_exception ")
- (NO_WCHAR_CODE_SET 23 "wchar transmission code set not in service context")
- (ILLEGAL_SERVICE_CONTEXT 24 "Service context is not in OMG-defined range")
- (ENUM_OUT_OF_RANGE 25 "Enum value out of range")
- (PI_BAD_SERVICE_CONTEXT 26 "Invalid service context Id in portable interceptor")
- (REG_INITIAL_NULL 27 "Attempt to call register_initial_reference with a null Object")
- (PI_INV_COMPONENT_ID 28 "Invalid component Id in portable interceptor")
- (PI_INV_PROFILE_ID 29 "Invalid profile Id in portable interceptor")
- (POLICY_TYPE_DUPLICATE 30 "Two or more Policy objects with the same PolicyType value supplied to Object::set_policy_overrides or PolicyManager::set_policy_overrides")
- (BAD_ONEWAY_DEFINITION 31 "Attempt to define a oneway operation with non-void result, out or inout parameters or user exceptions")
- (DII_FOR_IMPLICIT_OPERATION 32 "DII asked to create request for an implicit operation")
- (XA_CALL_INVAL 33 "An OTS/XA integration xa_ call returned XAER_INVAL")
- (UNION_BAD_DISCRIMINATOR 34 "Union branch modifier method called with bad case label discriminator")
- (CTX_ILLEGAL_PROPERTY_NAME 35 "Illegal IDL context property name")
- (CTX_ILLEGAL_SEARCH_STRING 36 "Illegal IDL property search string")
- (CTX_ILLEGAL_NAME 37 "Illegal IDL context name")
- (CTX_NON_EMPTY 38 "Non-empty IDL context")
- (RMI_STREAM_FORMAT 39 "Unsupported RMI/IDL custom value type stream format")
- (OUTPUT_STREAM_NOT_VALUE 40 "ORB output stream does not support ValueOutputStream interface")
- (INPUT_STREAM_NOT_VALUE 41 "ORB input stream does not support ValueInputStream interface")
-)
-(BAD_TYPECODE
- (MARSHALL_INCOMPLETE_TYPECODE 1 "Attempt to marshal incomplete TypeCode")
- (BAD_MEMBER_TYPECODE 2 "Member type code illegitimate in TypeCode operation")
- (ILLEGAL_PARAMETER 3 "Illegal parameter type")
-)
-(DATA_CONVERSION
- (CHAR_NOT_MAP_TCS 1 "Character does not map to negotiated transmission code set")
- (PRIORITY_MAP_FAILRE 2 "Failure of PriorityMapping object")
-)
-(IMP_LIMIT
- (NO_USABLE_PROFILE 1 "Unable to use any profile in IOR")
-)
-(INITIALIZE
- (PRIORITY_RANGE_RESTRICT 1 "Priority range too restricted for ORB")
-)
-(INV_OBJREF
- (NO_WCHAR_CODE_SET 1 "wchar Code Set support not specified")
- (CODESET_COMPONENT_REQUIRED 2 "Codeset component required for type using wchar or wstring data")
-)
-(INV_POLICY
- (IOR_POLICY_RECONCILE_ERROR 1 "Unable to reconcile IOR specified policy with effective policy override")
- (INVALID_POLICY_TYPE 2 "Invalid PolicyType")
- (NO_POLICY_FACTORY 3 "No PolicyFactory has been registered for the given PolicyType")
-)
-(INTERNAL
- (XA_RMERR 1 "An OTS/XA integration xa_ call returned XAER_RMERR")
- (XA_RMFAIL 2 "An OTS/XA integration xa_ call returned XAER_RMFAIL")
-)
-(INTF_REPOS
- (NO_IR 1 "Interface Repository not available")
- (NO_INTERFACE_IN_IR 2 "No entry for requested interface in Interface Repository")
-)
-(MARSHAL
- (NO_VALUE_FACTORY 1 "Unable to locate value factory")
- (SET_RESULT_BEFORE_CTX 2 "ServerRequest::set_result called before ServerRequest::ctx when the operation IDL contains a context clause ")
- (BAD_NVLIST 3 "NVList passed to ServerRequest::arguments does not describe all parameters passed by client")
- (MARSHAL_LOCAL_OBJECT 4 "Attempt to marshal Local object")
- (WCHAR_BAD_GIOP_VERSION_SENT 5 "wchar or wstring data erroneosly sent by client over GIOP 1.0 connection ")
- (WCHAR_BAD_GIOP_VERSION_RETURNED 6 "wchar or wstring data erroneously returned by server over GIOP 1.0 connection ")
- (RMI_STREAM_FORMAT_2 7 "Unsupported RMI/IDL custom value type stream "format
-)
-(NO_IMPLEMENT
- (NO_LOCAL_VALUE_IMPLEMENTATION 1 "Missing local value implementation")
- (INCOMPAT_VALUE_IMPLEMENTATION 2 "Incompatible value implementation version")
- (NO_USABLE_PROFILE_2 3 "Unable to use any profile in IOR")
- (DII_LOCAL_OBJECT 4 "Attempt to use DII on Local object")
- (BIO_RESET 5 "Biomolecular Sequence Analysis iterator cannot be reset")
- (BIO_NOT_AVAILABLE 6 "Biomolecular Sequence Analysis metadata is not available as XML")
- (BIO_GENOMIC_NO_ITERATOR 7 "Genomic Maps iterator cannot be reset")
-)
-(NO_RESOURCES
- (PI_OPERATION_NOT_SUPPORTED 1 "Portable Interceptor operation not supported in this binding")
- (NO_CONNECTION_PRIORITY 2 "No connection for request's priority")
-)
-(TRANSACTION_ROLLEDBACK
- (XA_RB 1 "An OTS/XA integration xa_ call returned XAER_RB")
- (XA_NOTA 2 "An OTS/XA integration xa_ call returned XAER_NOTA")
- (XA_END_TRUE_ROLLBACK_DEFERRED 3 "OTS/XA integration end() was called with success set to TRUE while transaction rollback was deferred")
-)
-(TRANSIENT
- (POA_REQUEST_DISCARD 1 "Request discarded because of resource exhaustion in POA or because POA is in DISCARDING state")
- (NO_USABLE_PROFILE_3 2 "No usable profile in IOR")
- (REQUEST_CANCELLED 3 "Request cancelled")
- (POA_DESTROYED 4 "POA destroyed")
-)
-(OBJECT_NOT_EXIST
- "(UNREGISTERED_VALUE_AS_OBJREF 1 Attempt to pass an unactivated (unregistered) value as an object reference")
- (NO_OBJECT_ADAPTOR 2 "Failed to create or locate Object Adaptor")
- (BIO_NOT_AVAILABLE 3 "Biomolecular Sequence Analysis Service is no longer available")
- (OBJECT_ADAPTER_INACTIVE 4 "Object Adapter Inactive")
-)
-(OBJ_ADAPTER
- (UNKNOWN_ADAPTER_SYS_EXCEPTION 1 "System exception in POA::unknown_adapter")
- (BAD_SERVANT_TYPE 2 "Incorrect servant type returned by servant manager ")
- (NO_DEFAULT_SERVANT 3 "No default servant available [POA policy"])
- (NO_SERVANT_MANAGER 4 "No servant manager available [POA Policy"])
- (BAD_POLICY_INCARNATE 5 "Violation of POA policy by ServantActivator::incarnate")
- (PI_EXC_COMP_ESTABLISHED 6 "Exception in PortableInterceptor::IORInterceptor.components_established")
- (NULL_SERVANT_RETURNED 7 "Null servant returned by servant manager")
-)
-(UNKNOWN
- (UNLISTED_EXCEPTION_RECEIVED 1 "Unlisted user exception received by client ")
- (UNSUPPORTED_SYSTEM_EXCEPTION 2 "Non-standard System Exception not supported")
- (PI_UNKNOWN_USER_EXCEPTION 3 "An unknown user exception received by a portable interceptor")
-)
-)
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/toa/TOA.java b/src/share/classes/com/sun/corba/se/impl/oa/toa/TOA.java
deleted file mode 100644
index 655ce07..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/toa/TOA.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, 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.
- */
-
-package com.sun.corba.se.impl.oa.toa ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-
-/** The Transient Object Adapter is used for standard RMI-IIOP and Java-IDL
- * (legacy JDK 1.2) object implementations. Its protocol for managing objects is very
- * simple: just connect and disconnect. There is only a single TOA instance per ORB,
- * and its lifetime is the same as the ORB. The TOA instance is always ready to receive
- * messages except when the ORB is shutting down.
- */
-public interface TOA extends ObjectAdapter {
- /** Connect the given servant to the ORB by allocating a transient object key
- * and creating an IOR and object reference using the current factory.
- */
- void connect( org.omg.CORBA.Object servant ) ;
-
- /** Disconnect the object from this ORB.
- */
- void disconnect( org.omg.CORBA.Object obj ) ;
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java b/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java
deleted file mode 100644
index 5882322..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-package com.sun.corba.se.impl.oa.toa ;
-
-import java.util.Map ;
-import java.util.HashMap ;
-
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.CompletionStatus ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-import com.sun.corba.se.impl.oa.toa.TOAImpl ;
-import com.sun.corba.se.impl.oa.toa.TransientObjectManager ;
-
-import com.sun.corba.se.impl.javax.rmi.CORBA.Util ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyTemplateBase ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class TOAFactory implements ObjectAdapterFactory
-{
- private ORB orb ;
- private ORBUtilSystemException wrapper ;
-
- private TOAImpl toa ;
- private Map codebaseToTOA ;
- private TransientObjectManager tom ;
-
- public ObjectAdapter find ( ObjectAdapterId oaid )
- {
- if (oaid.equals( ObjectKeyTemplateBase.JIDL_OAID ) )
- // Return the dispatch-only TOA, which can dispatch
- // request for objects created by any TOA.
- return getTOA() ;
- else
- throw wrapper.badToaOaid() ;
- }
-
- public void init( ORB orb )
- {
- this.orb = orb ;
- wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.OA_LIFECYCLE ) ;
- tom = new TransientObjectManager( orb ) ;
- codebaseToTOA = new HashMap() ;
- }
-
- public void shutdown( boolean waitForCompletion )
- {
- if (Util.isInstanceDefined()) {
- Util.getInstance().unregisterTargetsForORB(orb);
- }
- }
-
- public synchronized TOA getTOA( String codebase )
- {
- TOA toa = (TOA)(codebaseToTOA.get( codebase )) ;
- if (toa == null) {
- toa = new TOAImpl( orb, tom, codebase ) ;
-
- codebaseToTOA.put( codebase, toa ) ;
- }
-
- return toa ;
- }
-
- public synchronized TOA getTOA()
- {
- if (toa == null)
- // The dispatch-only TOA is not used for creating
- // objrefs, so its codebase can be null (and must
- // be, since we do not have a servant at this point)
- toa = new TOAImpl( orb, tom, null ) ;
-
- return toa ;
- }
-
- public ORB getORB()
- {
- return orb ;
- }
-} ;
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAImpl.java b/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAImpl.java
deleted file mode 100644
index 780287b..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAImpl.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright (c) 2001, 2004, 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.
- */
-
-package com.sun.corba.se.impl.oa.toa ;
-
-import org.omg.CORBA.Policy ;
-import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
-import org.omg.PortableInterceptor.ObjectReferenceFactory ;
-import org.omg.PortableInterceptor.ACTIVE;
-import org.omg.PortableServer.ServantLocatorPackage.CookieHolder ;
-
-import com.sun.corba.se.pept.protocol.ClientDelegate ;
-
-import com.sun.corba.se.spi.copyobject.CopierManager ;
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
-import com.sun.corba.se.spi.oa.OAInvocationInfo ;
-import com.sun.corba.se.spi.oa.OADestroyed ;
-import com.sun.corba.se.spi.oa.ObjectAdapterBase ;
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
-import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
-import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
-import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
-
-import com.sun.corba.se.impl.ior.JIDLObjectKeyTemplate ;
-import com.sun.corba.se.impl.oa.NullServantImpl;
-import com.sun.corba.se.impl.oa.poa.Policies;
-import com.sun.corba.se.impl.oa.toa.TransientObjectManager ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-import com.sun.corba.se.impl.protocol.JIDLLocalCRDImpl ;
-
-/** The Transient Object Adapter (TOA) represents the OA for purely transient
-* objects. It is used for standard RMI-IIOP as well as backwards compatible
-* server support (i.e. the ORB.connect() method)
-* Its characteristics include:
-* <UL>
-* <LI>There is only one OA instance of the TOA. Its OAId is { "TOA" }</LI>
-* <LI>There is not adapter manager. The TOA manager ID is fixed.<LI>
-* <LI>State is the same as ORB state (TBD)</LI>
-* </UL>
-* Other requirements:
-* <UL>
-* <LI>All object adapters must invoke ORB.adapterCreated when they are created.
-* </LI>
-* <LI>All adapter managers must invoke ORB.adapterManagerStateChanged when
-* their state changes, mapping the internal state to an ORT state.</LI>
-* <LI>AdapterStateChanged must be invoked (from somewhere) whenever
-* an adapter state changes that is not due to an adapter manager state change.</LI>
-* </UL>
-*/
-public class TOAImpl extends ObjectAdapterBase implements TOA
-{
- private TransientObjectManager servants ;
-
- public TOAImpl( ORB orb, TransientObjectManager tom, String codebase )
- {
- super( orb ) ;
- servants = tom ;
-
- // Make the object key template
- int serverid = ((ORB)getORB()).getTransientServerId();
- int scid = ORBConstants.TOA_SCID ;
-
- ObjectKeyTemplate oktemp = new JIDLObjectKeyTemplate( orb, scid, serverid ) ;
-
- // REVISIT - POA specific
- Policies policies = Policies.defaultPolicies;
-
- // REVISIT - absorb codebase into a policy
- initializeTemplate( oktemp, true,
- policies,
- codebase,
- null, // manager id
- oktemp.getObjectAdapterId()
- ) ;
- }
-
- // Methods required for dispatching requests
-
- public ObjectCopierFactory getObjectCopierFactory()
- {
- CopierManager cm = getORB().getCopierManager() ;
- return cm.getDefaultObjectCopierFactory() ;
- }
-
- public org.omg.CORBA.Object getLocalServant( byte[] objectId )
- {
- return (org.omg.CORBA.Object)(servants.lookupServant( objectId ) ) ;
- }
-
- /** Get the servant for the request given by the parameters.
- * This will update thread Current, so that subsequent calls to
- * returnServant and removeCurrent from the same thread are for the
- * same request.
- * @param request is the request containing the rest of the request
- */
- public void getInvocationServant( OAInvocationInfo info )
- {
- java.lang.Object servant = servants.lookupServant( info.id() ) ;
- if (servant == null)
- // This is expected to result in an RMI-IIOP NoSuchObjectException.
- // See bug 4973160.
- servant = new NullServantImpl( lifecycleWrapper().nullServant() ) ;
- info.setServant( servant ) ;
- }
-
- public void returnServant()
- {
- // NO-OP
- }
-
- /** Return the most derived interface for the given servant and objectId.
- */
- public String[] getInterfaces( Object servant, byte[] objectId )
- {
- return StubAdapter.getTypeIds( servant ) ;
- }
-
- // XXX For now, this does nothing.
- // This will need fixing once we support ORB and thread level policies,
- // but for now, there is no way to associate policies with the TOA, so
- // getEffectivePolicy must always return null.
- public Policy getEffectivePolicy( int type )
- {
- return null ;
- }
-
- public int getManagerId()
- {
- return -1 ;
- }
-
- public short getState()
- {
- return ACTIVE.value ;
- }
-
- public void enter() throws OADestroyed
- {
- }
-
- public void exit()
- {
- }
-
- // Methods unique to the TOA
-
- public void connect( org.omg.CORBA.Object objref)
- {
- // Store the objref and get a userkey allocated by the transient
- // object manager.
- byte[] key = servants.storeServant(objref, null);
-
- // Find out the repository ID for this objref.
- String id = StubAdapter.getTypeIds( objref )[0] ;
-
- // Create the new objref
- ObjectReferenceFactory orf = getCurrentFactory() ;
- org.omg.CORBA.Object obj = orf.make_object( id, key ) ;
-
- // Copy the delegate from the new objref to the argument
- // XXX handle the case of an attempt to connect a local object.
-
- org.omg.CORBA.portable.Delegate delegate = StubAdapter.getDelegate(
- obj ) ;
- CorbaContactInfoList ccil = (CorbaContactInfoList)
- ((ClientDelegate)delegate).getContactInfoList() ;
- LocalClientRequestDispatcher lcs =
- ccil.getLocalClientRequestDispatcher() ;
-
- if (lcs instanceof JIDLLocalCRDImpl) {
- JIDLLocalCRDImpl jlcs = (JIDLLocalCRDImpl)lcs ;
- jlcs.setServant( objref ) ;
- } else {
- throw new RuntimeException(
- "TOAImpl.connect can not be called on " + lcs ) ;
- }
-
- StubAdapter.setDelegate( objref, delegate ) ;
- }
-
- public void disconnect( org.omg.CORBA.Object objref )
- {
- // Get the delegate, then ior, then transientKey, then delete servant
- org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(
- objref ) ;
- CorbaContactInfoList ccil = (CorbaContactInfoList)
- ((ClientDelegate)del).getContactInfoList() ;
- LocalClientRequestDispatcher lcs =
- ccil.getLocalClientRequestDispatcher() ;
-
- if (lcs instanceof JIDLLocalCRDImpl) {
- JIDLLocalCRDImpl jlcs = (JIDLLocalCRDImpl)lcs ;
- byte[] oid = jlcs.getObjectId() ;
- servants.deleteServant(oid);
- jlcs.unexport() ;
- } else {
- throw new RuntimeException(
- "TOAImpl.disconnect can not be called on " + lcs ) ;
- }
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/toa/TransientObjectManager.java b/src/share/classes/com/sun/corba/se/impl/oa/toa/TransientObjectManager.java
deleted file mode 100644
index 827b666..0000000
--- a/src/share/classes/com/sun/corba/se/impl/oa/toa/TransientObjectManager.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.oa.toa;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.spi.orb.ORB ;
-
-public final class TransientObjectManager {
- private ORB orb ;
- private int maxSize = 128;
- private Element[] elementArray;
- private Element freeList;
-
- void dprint( String msg ) {
- ORBUtility.dprint( this, msg ) ;
- }
-
- public TransientObjectManager( ORB orb )
- {
- this.orb = orb ;
-
- elementArray = new Element[maxSize];
- elementArray[maxSize-1] = new Element(maxSize-1,null);
- for ( int i=maxSize-2; i>=0; i-- )
- elementArray[i] = new Element(i,elementArray[i+1]);
- freeList = elementArray[0];
- }
-
- public synchronized byte[] storeServant(java.lang.Object servant, java.lang.Object servantData)
- {
- if ( freeList == null )
- doubleSize();
-
- Element elem = freeList;
- freeList = (Element)freeList.servant;
-
- byte[] result = elem.getKey(servant, servantData);
- if (orb.transientObjectManagerDebugFlag)
- dprint( "storeServant returns key for element " + elem ) ;
- return result ;
- }
-
- public synchronized java.lang.Object lookupServant(byte transientKey[])
- {
- int index = ORBUtility.bytesToInt(transientKey,0);
- int counter = ORBUtility.bytesToInt(transientKey,4);
-
- if (orb.transientObjectManagerDebugFlag)
- dprint( "lookupServant called with index=" + index + ", counter=" + counter ) ;
-
- if (elementArray[index].counter == counter &&
- elementArray[index].valid ) {
- if (orb.transientObjectManagerDebugFlag)
- dprint( "\tcounter is valid" ) ;
- return elementArray[index].servant;
- }
-
- // servant not found
- if (orb.transientObjectManagerDebugFlag)
- dprint( "\tcounter is invalid" ) ;
- return null;
- }
-
- public synchronized java.lang.Object lookupServantData(byte transientKey[])
- {
- int index = ORBUtility.bytesToInt(transientKey,0);
- int counter = ORBUtility.bytesToInt(transientKey,4);
-
- if (orb.transientObjectManagerDebugFlag)
- dprint( "lookupServantData called with index=" + index + ", counter=" + counter ) ;
-
- if (elementArray[index].counter == counter &&
- elementArray[index].valid ) {
- if (orb.transientObjectManagerDebugFlag)
- dprint( "\tcounter is valid" ) ;
- return elementArray[index].servantData;
- }
-
- // servant not found
- if (orb.transientObjectManagerDebugFlag)
- dprint( "\tcounter is invalid" ) ;
- return null;
- }
-
- public synchronized void deleteServant(byte transientKey[])
- {
- int index = ORBUtility.bytesToInt(transientKey,0);
- if (orb.transientObjectManagerDebugFlag)
- dprint( "deleting servant at index=" + index ) ;
-
- elementArray[index].delete(freeList);
- freeList = elementArray[index];
- }
-
- public synchronized byte[] getKey(java.lang.Object servant)
- {
- for ( int i=0; i<maxSize; i++ )
- if ( elementArray[i].valid &&
- elementArray[i].servant == servant )
- return elementArray[i].toBytes();
-
- // if we come here Object does not exist
- return null;
- }
-
- private void doubleSize()
- {
- // Assume caller is synchronized
-
- Element old[] = elementArray;
- int oldSize = maxSize;
- maxSize *= 2;
- elementArray = new Element[maxSize];
-
- for ( int i=0; i<oldSize; i++ )
- elementArray[i] = old[i];
-
- elementArray[maxSize-1] = new Element(maxSize-1,null);
- for ( int i=maxSize-2; i>=oldSize; i-- )
- elementArray[i] = new Element(i,elementArray[i+1]);
- freeList = elementArray[oldSize];
- }
-}
-
-
-final class Element {
- java.lang.Object servant=null; // also stores "next pointer" in free list
- java.lang.Object servantData=null;
- int index=-1;
- int counter=0;
- boolean valid=false; // valid=true if this Element contains
- // a valid servant
-
- Element(int i, java.lang.Object next)
- {
- servant = next;
- index = i;
- }
-
- byte[] getKey(java.lang.Object servant, java.lang.Object servantData)
- {
- this.servant = servant;
- this.servantData = servantData;
- this.valid = true;
-
- return toBytes();
- }
-
- byte[] toBytes()
- {
- // Convert the index+counter into an 8-byte (big-endian) key.
-
- byte key[] = new byte[8];
- ORBUtility.intToBytes(index, key, 0);
- ORBUtility.intToBytes(counter, key, 4);
-
- return key;
- }
-
- void delete(Element freeList)
- {
- if ( !valid ) // prevent double deletion
- return;
- counter++;
- servantData = null;
- valid = false;
-
- // add this to freeList
- servant = freeList;
- }
-
- public String toString()
- {
- return "Element[" + index + ", " + counter + "]" ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/orb/AppletDataCollector.java b/src/share/classes/com/sun/corba/se/impl/orb/AppletDataCollector.java
deleted file mode 100644
index ed2c984..0000000
--- a/src/share/classes/com/sun/corba/se/impl/orb/AppletDataCollector.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.applet.Applet ;
-import java.util.Properties ;
-
-public class AppletDataCollector extends DataCollectorBase {
- private Applet applet ;
-
- AppletDataCollector( Applet app, Properties props, String localHostName,
- String configurationHostName )
- {
- super( props, localHostName, configurationHostName ) ;
- this.applet = app ;
- }
-
- public boolean isApplet()
- {
- return true ;
- }
-
- protected void collect( )
- {
- checkPropertyDefaults() ;
-
- findPropertiesFromFile() ;
-
- // We do not use system properties for applets in order to
- // avoid security exceptions.
-
- findPropertiesFromProperties() ;
- findPropertiesFromApplet( applet ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/orb/DataCollectorBase.java b/src/share/classes/com/sun/corba/se/impl/orb/DataCollectorBase.java
deleted file mode 100644
index 56b3899..0000000
--- a/src/share/classes/com/sun/corba/se/impl/orb/DataCollectorBase.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, 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.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import com.sun.corba.se.impl.orbutil.GetPropertyAction ;
-
-import java.security.PrivilegedAction ;
-import java.security.AccessController ;
-
-import java.applet.Applet ;
-
-import java.util.Properties ;
-import java.util.Vector ;
-import java.util.Set ;
-import java.util.HashSet ;
-import java.util.Enumeration ;
-import java.util.Iterator ;
-import java.util.StringTokenizer ;
-
-import java.net.URL ;
-
-import java.security.AccessController ;
-
-import java.io.File ;
-import java.io.FileInputStream ;
-
-import com.sun.corba.se.spi.orb.DataCollector ;
-import com.sun.corba.se.spi.orb.PropertyParser ;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-
-public abstract class DataCollectorBase implements DataCollector {
- private PropertyParser parser ;
- private Set propertyNames ;
- private Set propertyPrefixes ;
- private Set URLPropertyNames ;
- protected String localHostName ;
- protected String configurationHostName ;
- private boolean setParserCalled ;
- private Properties originalProps ;
- private Properties resultProps ;
-
- public DataCollectorBase( Properties props, String localHostName,
- String configurationHostName )
- {
- // XXX This is fully initialized here. So do we ever want to
- // generalize this (or perhaps this is the wrong place for this?)
- URLPropertyNames = new HashSet() ;
- URLPropertyNames.add( ORBConstants.INITIAL_SERVICES_PROPERTY ) ;
-
- propertyNames = new HashSet() ;
-
- // Make sure that we are ready to handle -ORBInitRef. This is special
- // due to the need to handle multiple -ORBInitRef args as prefix
- // parsing.
- propertyNames.add( ORBConstants.ORB_INIT_REF_PROPERTY ) ;
-
- propertyPrefixes = new HashSet() ;
-
- this.originalProps = props ;
- this.localHostName = localHostName ;
- this.configurationHostName = configurationHostName ;
- setParserCalled = false ;
- resultProps = new Properties() ;
- }
-
-//////////////////////////////////////////////////////////
-// Public interface defined in DataCollector
-//////////////////////////////////////////////////////////
-
- public boolean initialHostIsLocal()
- {
- checkSetParserCalled() ;
- return localHostName.equals( resultProps.getProperty(
- ORBConstants.INITIAL_HOST_PROPERTY ) ) ;
- }
-
- public void setParser( PropertyParser parser )
- {
- Iterator iter = parser.iterator() ;
- while (iter.hasNext()) {
- ParserAction pa = (ParserAction)(iter.next()) ;
- if (pa.isPrefix())
- propertyPrefixes.add( pa.getPropertyName() ) ;
- else
- propertyNames.add( pa.getPropertyName() ) ;
- }
-
- collect() ;
- setParserCalled = true ;
- }
-
- public Properties getProperties()
- {
- checkSetParserCalled() ;
- return resultProps ;
- }
-
-//////////////////////////////////////////////////////////
-// public interface from DataCollector that must be defined
-// in subclasses
-//////////////////////////////////////////////////////////
-
- public abstract boolean isApplet() ;
-
-//////////////////////////////////////////////////////////
-// Implementation methods needed in subclasses
-//////////////////////////////////////////////////////////
-
- protected abstract void collect() ;
-
-//////////////////////////////////////////////////////////
-// methods for use by subclasses
-//////////////////////////////////////////////////////////
-
- protected void checkPropertyDefaults()
- {
- String host =
- resultProps.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ;
-
- if ((host == null) || (host.equals("")))
- setProperty( ORBConstants.INITIAL_HOST_PROPERTY,
- configurationHostName );
-
- String serverHost =
- resultProps.getProperty( ORBConstants.SERVER_HOST_PROPERTY ) ;
-
- if (serverHost == null ||
- serverHost.equals("") ||
- serverHost.equals("0.0.0.0") ||
- serverHost.equals("::") ||
- serverHost.toLowerCase().equals("::ffff:0.0.0.0"))
- {
- setProperty(ORBConstants.SERVER_HOST_PROPERTY,
- localHostName);
- setProperty(ORBConstants.LISTEN_ON_ALL_INTERFACES,
- ORBConstants.LISTEN_ON_ALL_INTERFACES);
- }
- }
-
- protected void findPropertiesFromArgs( String[] params )
- {
- if (params == null)
- return;
-
- // All command-line args are of the form "-ORBkey value".
- // The key is mapped to <prefix>.ORBkey.
-
- String name ;
- String value ;
-
- for ( int i=0; i<params.length; i++ ) {
- value = null ;
- name = null ;
-
- if ( params[i] != null && params[i].startsWith("-ORB") ) {
- String argName = params[i].substring( 1 ) ;
- name = findMatchingPropertyName( propertyNames, argName ) ;
-
- if (name != null)
- if ( i+1 < params.length && params[i+1] != null ) {
- value = params[++i];
- }
- }
-
- if (value != null) {
- setProperty( name, value ) ;
- }
- }
- }
-
- protected void findPropertiesFromApplet( final Applet app )
- {
- // Cannot use propertyPrefixes here, since there is no
- // way to fetch properties by prefix from an Applet.
- if (app == null)
- return;
-
- PropertyCallback callback = new PropertyCallback() {
- public String get(String name) {
- return app.getParameter(name);
- }
- } ;
-
- findPropertiesByName( propertyNames.iterator(), callback ) ;
-
- // Special Case:
- //
- // Convert any applet parameter relative URLs to an
- // absolute URL based on the Document Root. This is so HTML
- // URLs can be kept relative which is sometimes useful for
- // managing the Document Root layout.
- PropertyCallback URLCallback = new PropertyCallback() {
- public String get( String name ) {
- String value = resultProps.getProperty(name);
- if (value == null)
- return null ;
-
- try {
- URL url = new URL( app.getDocumentBase(), value ) ;
- return url.toExternalForm() ;
- } catch (java.net.MalformedURLException exc) {
- // Just preserve the original (malformed) value:
- // the error will be handled later.
- return value ;
- }
- }
- } ;
-
- findPropertiesByName( URLPropertyNames.iterator(),
- URLCallback ) ;
- }
-
- private void doProperties( final Properties props )
- {
- PropertyCallback callback = new PropertyCallback() {
- public String get(String name) {
- return props.getProperty(name);
- }
- } ;
-
- findPropertiesByName( propertyNames.iterator(), callback ) ;
-
- findPropertiesByPrefix( propertyPrefixes,
- makeIterator( props.propertyNames()), callback );
- }
-
- protected void findPropertiesFromFile()
- {
- final Properties fileProps = getFileProperties() ;
- if (fileProps==null)
- return ;
-
- doProperties( fileProps ) ;
- }
-
- protected void findPropertiesFromProperties()
- {
- if (originalProps == null)
- return;
-
- doProperties( originalProps ) ;
- }
-
- //
- // Map System properties to ORB properties.
- // Security bug fix 4278205:
- // Only allow reading of system properties with ORB prefixes.
- // Previously a malicious subclass was able to read ANY system property.
- // Note that other prefixes are fine in other contexts; it is only
- // system properties that should impose a restriction.
- protected void findPropertiesFromSystem()
- {
- Set normalNames = getCORBAPrefixes( propertyNames ) ;
- Set prefixNames = getCORBAPrefixes( propertyPrefixes ) ;
-
- PropertyCallback callback = new PropertyCallback() {
- public String get(String name) {
- return getSystemProperty(name);
- }
- } ;
-
- findPropertiesByName( normalNames.iterator(), callback ) ;
-
- findPropertiesByPrefix( prefixNames,
- getSystemPropertyNames(), callback ) ;
- }
-
-//////////////////////////////////////////////////////////
-// internal implementation
-//////////////////////////////////////////////////////////
-
- // Store name, value in resultProps, with special
- // treatment of ORBInitRef. All updates to resultProps
- // must happen through this method.
- private void setProperty( String name, String value )
- {
- if( name.equals( ORBConstants.ORB_INIT_REF_PROPERTY ) ) {
- // Value is <name>=<URL>
- StringTokenizer st = new StringTokenizer( value, "=" ) ;
- if (st.countTokens() != 2)
- throw new IllegalArgumentException() ;
-
- String refName = st.nextToken() ;
- String refValue = st.nextToken() ;
-
- resultProps.setProperty( name + "." + refName, refValue ) ;
- } else {
- resultProps.setProperty( name, value ) ;
- }
- }
-
- private void checkSetParserCalled()
- {
- if (!setParserCalled)
- throw new IllegalStateException( "setParser not called." ) ;
- }
-
- // For each prefix in prefixes, For each name in propertyNames,
- // if (prefix is a prefix of name) get value from getProperties and
- // setProperty (name, value).
- private void findPropertiesByPrefix( Set prefixes,
- Iterator propertyNames, PropertyCallback getProperty )
- {
- while (propertyNames.hasNext()) {
- String name = (String)(propertyNames.next()) ;
- Iterator iter = prefixes.iterator() ;
- while (iter.hasNext()) {
- String prefix = (String)(iter.next()) ;
- if (name.startsWith( prefix )) {
- String value = getProperty.get( name ) ;
-
- // Note: do a put even if value is null since just
- // the presence of the property may be significant.
- setProperty( name, value ) ;
- }
- }
- }
- }
-
- // For each prefix in names, get the corresponding property
- // value from the callback, and store the name/value pair in
- // the result.
- private void findPropertiesByName( Iterator names,
- PropertyCallback getProperty )
- {
- while (names.hasNext()) {
- String name = (String)(names.next()) ;
- String value = getProperty.get( name ) ;
- if (value != null)
- setProperty( name, value ) ;
- }
- }
-
- private static String getSystemProperty(final String name)
- {
- return (String)AccessController.doPrivileged(
- new GetPropertyAction(name));
- }
-
- // Map command-line arguments to ORB properties.
- //
- private String findMatchingPropertyName( Set names,
- String suffix )
- {
- Iterator iter = names.iterator() ;
- while (iter.hasNext()) {
- String name = (String)(iter.next()) ;
- if (name.endsWith( suffix ))
- return name ;
- }
-
- return null ;
- }
-
- private static Iterator makeIterator( final Enumeration enumeration )
- {
- return new Iterator() {
- public boolean hasNext() { return enumeration.hasMoreElements() ; }
- public Object next() { return enumeration.nextElement() ; }
- public void remove() { throw new UnsupportedOperationException() ; }
- } ;
- }
-
- private static Iterator getSystemPropertyNames()
- {
- // This will not throw a SecurityException because this
- // class was loaded from rt.jar using the bootstrap classloader.
- Enumeration enumeration = (Enumeration)
- AccessController.doPrivileged(
- new PrivilegedAction() {
- public java.lang.Object run() {
- return System.getProperties().propertyNames();
- }
- }
- );
-
- return makeIterator( enumeration ) ;
- }
-
- private void getPropertiesFromFile( Properties props, String fileName )
- {
- try {
- File file = new File( fileName ) ;
- if (!file.exists())
- return ;
-
- FileInputStream in = new FileInputStream( file ) ;
-
- try {
- props.load( in ) ;
- } finally {
- in.close() ;
- }
- } catch (Exception exc) {
- // if (ORBInitDebug)
- // dprint( "ORB properties file " + fileName + " not found: " +
- // exc) ;
- }
- }
-
- private Properties getFileProperties()
- {
- Properties defaults = new Properties() ;
-
- String javaHome = getSystemProperty( "java.home" ) ;
- String fileName = javaHome + File.separator + "lib" + File.separator +
- "orb.properties" ;
-
- getPropertiesFromFile( defaults, fileName ) ;
-
- Properties results = new Properties( defaults ) ;
-
- String userHome = getSystemProperty( "user.home" ) ;
- fileName = userHome + File.separator + "orb.properties" ;
-
- getPropertiesFromFile( results, fileName ) ;
- return results ;
- }
-
- private boolean hasCORBAPrefix( String prefix )
- {
- return prefix.startsWith( ORBConstants.ORG_OMG_PREFIX ) ||
- prefix.startsWith( ORBConstants.SUN_PREFIX ) ||
- prefix.startsWith( ORBConstants.SUN_LC_PREFIX ) ||
- prefix.startsWith( ORBConstants.SUN_LC_VERSION_PREFIX ) ;
- }
-
- // Return only those element of prefixes for which hasCORBAPrefix
- // is true.
- private Set getCORBAPrefixes( final Set prefixes )
- {
- Set result = new HashSet() ;
- Iterator iter = prefixes.iterator() ;
- while (iter.hasNext()) {
- String element = (String)(iter.next()) ;
- if (hasCORBAPrefix( element ))
- result.add( element ) ;
- }
-
- return result ;
- }
-}
-
-// Used to collect properties from various sources.
-abstract class PropertyCallback
-{
- abstract public String get(String name);
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/orb/DataCollectorFactory.java b/src/share/classes/com/sun/corba/se/impl/orb/DataCollectorFactory.java
deleted file mode 100644
index b28b4b9..0000000
--- a/src/share/classes/com/sun/corba/se/impl/orb/DataCollectorFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, 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.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.applet.Applet ;
-import java.util.Properties ;
-import java.net.URL ;
-
-import com.sun.corba.se.spi.orb.DataCollector ;
-
-public abstract class DataCollectorFactory {
- private DataCollectorFactory() {}
-
- public static DataCollector create( Applet app, Properties props,
- String localHostName )
- {
- String appletHost = localHostName ;
-
- if (app != null) {
- URL appletCodeBase = app.getCodeBase() ;
-
- if (appletCodeBase != null)
- appletHost = appletCodeBase.getHost() ;
- }
-
- return new AppletDataCollector( app, props, localHostName,
- appletHost ) ;
- }
-
- public static DataCollector create( String[] args, Properties props,
- String localHostName )
- {
- return new NormalDataCollector( args, props, localHostName,
- localHostName ) ;
- }
-
- public static DataCollector create( Properties props,
- String localHostName )
- {
- return new PropertyOnlyDataCollector( props, localHostName,
- localHostName ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/orb/NormalDataCollector.java b/src/share/classes/com/sun/corba/se/impl/orb/NormalDataCollector.java
deleted file mode 100644
index aba45bc..0000000
--- a/src/share/classes/com/sun/corba/se/impl/orb/NormalDataCollector.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.net.InetAddress ;
-
-import java.util.Properties ;
-
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.CompletionStatus ;
-
-public class NormalDataCollector extends DataCollectorBase {
- private String[] args ;
-
- public NormalDataCollector( String[] args, Properties props,
- String localHostName, String configurationHostName )
- {
- super( props, localHostName, configurationHostName ) ;
- this.args = args ;
- }
-
- public boolean isApplet()
- {
- return false ;
- }
-
- protected void collect()
- {
- checkPropertyDefaults() ;
-
- findPropertiesFromFile() ;
- findPropertiesFromSystem() ;
- findPropertiesFromProperties() ;
- findPropertiesFromArgs( args ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/orb/NormalParserAction.java b/src/share/classes/com/sun/corba/se/impl/orb/NormalParserAction.java
deleted file mode 100644
index cad8276..0000000
--- a/src/share/classes/com/sun/corba/se/impl/orb/NormalParserAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.util.Properties ;
-
-import com.sun.corba.se.spi.orb.Operation ;
-
-public class NormalParserAction extends ParserActionBase {
- public NormalParserAction( String propertyName,
- Operation operation, String fieldName )
- {
- super( propertyName, false, operation, fieldName ) ;
- }
-
- /** Create a String[] of all suffixes of property names that
- * match the propertyName prefix, pass this to op, and return the
- * result.
- */
- public Object apply( Properties props )
- {
- Object value = props.getProperty( getPropertyName() ) ;
- if (value != null)
- return getOperation().operate( value ) ;
- else
- return null ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/orb/NormalParserData.java b/src/share/classes/com/sun/corba/se/impl/orb/NormalParserData.java
deleted file mode 100644
index 4a7cff3..0000000
--- a/src/share/classes/com/sun/corba/se/impl/orb/NormalParserData.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.util.Properties ;
-
-import com.sun.corba.se.spi.orb.Operation ;
-import com.sun.corba.se.spi.orb.PropertyParser ;
-
-public class NormalParserData extends ParserDataBase {
- private String testData ;
-
- public NormalParserData( String propertyName,
- Operation operation, String fieldName, Object defaultValue,
- Object testValue, String testData )
- {
- super( propertyName, operation, fieldName, defaultValue, testValue ) ;
- this.testData = testData ;
- }
- public void addToParser( PropertyParser parser )
- {
- parser.add( getPropertyName(), getOperation(), getFieldName() ) ;
- }
-
- public void addToProperties( Properties props )
- {
- props.setProperty( getPropertyName(), testData ) ;
- }
-}
diff --git a/src/share/classes/com/sun/corba/se/impl/orb/ORBConfiguratorImpl.java b/src/share/classes/com/sun/corba/se/impl/orb/ORBConfiguratorImpl.java
deleted file mode 100644
index 1d2684d..0000000
--- a/src/share/classes/com/sun/corba/se/impl/orb/ORBConfiguratorImpl.java
+++ /dev/null
@@ -1,628 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, 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.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.InetAddress ;
-import java.security.PrivilegedAction ;
-import java.security.PrivilegedExceptionAction ;
-import java.security.AccessController ;
-import java.util.Collection ;
-import java.util.Iterator ;
-
-import org.omg.CORBA.CompletionStatus ;
-import org.omg.CORBA.portable.ValueFactory ;
-
-import com.sun.corba.se.pept.protocol.ClientRequestDispatcher ;
-import com.sun.corba.se.pept.transport.Acceptor;
-
-import com.sun.corba.se.spi.activation.Locator ;
-import com.sun.corba.se.spi.activation.Activator ;
-import com.sun.corba.se.spi.activation.LocatorHelper ;
-import com.sun.corba.se.spi.activation.ActivatorHelper ;
-import com.sun.corba.se.spi.activation.EndPointInfo ;
-
-import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
-import com.sun.corba.se.spi.copyobject.CopyobjectDefaults ;
-import com.sun.corba.se.spi.copyobject.CopierManager ;
-
-import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactories ;
-
-import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
-
-import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.spi.oa.OADefault ;
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
-
-import com.sun.corba.se.spi.orb.Operation ;
-import com.sun.corba.se.spi.orb.OperationFactory ;
-import com.sun.corba.se.spi.orb.ORBData ;
-import com.sun.corba.se.spi.orb.DataCollector ;
-import com.sun.corba.se.spi.orb.ORBConfigurator ;
-import com.sun.corba.se.spi.orb.ParserImplBase ;
-import com.sun.corba.se.spi.orb.PropertyParser ;
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.orbutil.closure.Closure ;
-import com.sun.corba.se.spi.orbutil.closure.ClosureFactory ;
-
-import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
-import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
-import com.sun.corba.se.spi.protocol.RequestDispatcherDefault ;
-import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ;
-
-import com.sun.corba.se.spi.resolver.LocalResolver ;
-import com.sun.corba.se.spi.resolver.Resolver ;
-import com.sun.corba.se.spi.resolver.ResolverDefault ;
-
-import com.sun.corba.se.spi.transport.CorbaContactInfoList;
-import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
-import com.sun.corba.se.spi.transport.SocketInfo;
-import com.sun.corba.se.spi.transport.TransportDefault ;
-
-import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
-import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults ;
-
-import com.sun.corba.se.spi.servicecontext.ServiceContext ;
-import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry ;
-import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext ;
-import com.sun.corba.se.spi.servicecontext.CodeSetServiceContext ;
-import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext ;
-import com.sun.corba.se.spi.servicecontext.ORBVersionServiceContext ;
-import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
-
-// XXX This should go away once we get rid of the port exchange for ORBD
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
-import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl;
-import com.sun.corba.se.impl.legacy.connection.SocketFactoryContactInfoListImpl;
-import com.sun.corba.se.impl.legacy.connection.USLPort;
-
-// XXX These should move to SPI
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-// XXX This needs an SPI
-import com.sun.corba.se.impl.dynamicany.DynAnyFactoryImpl ;
-
-public class ORBConfiguratorImpl implements ORBConfigurator {
- private ORBUtilSystemException wrapper ;
-
- public static class ConfigParser extends ParserImplBase {
- public Class[] userConfigurators = null ;
-
- public PropertyParser makeParser()
- {
- PropertyParser parser = new PropertyParser() ;
- Operation action = OperationFactory.compose(
- OperationFactory.suffixAction(),
- OperationFactory.classAction()
- ) ;
- parser.addPrefix( ORBConstants.SUN_PREFIX + "ORBUserConfigurators",
- action, "userConfigurators", Class.class ) ;
- return parser ;
- }
- }
-
- public void configure( DataCollector collector, ORB orb )
- {
- ORB theOrb = orb ;
- wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.ORB_LIFECYCLE ) ;
-
- initObjectCopiers( theOrb ) ;
- initIORFinders( theOrb ) ;
-
- theOrb.setClientDelegateFactory(
- // REVISIT: this should be ProtocolDefault.
- TransportDefault.makeClientDelegateFactory( theOrb )) ;
-
- initializeTransport(theOrb) ;
-
- initializeNaming( theOrb ) ;
- initServiceContextRegistry( theOrb ) ;
- initRequestDispatcherRegistry( theOrb ) ;
- registerInitialReferences( theOrb ) ;
-
- persistentServerInitialization( theOrb ) ;
-
- runUserConfigurators( collector, theOrb ) ;
- }
-
- private void runUserConfigurators( DataCollector collector, ORB orb )
- {
- // Run any pluggable configurators. This is a lot like
- // ORBInitializers, only it uses the internal ORB and has
- // access to all data for parsing.
- ConfigParser parser = new ConfigParser() ;
- parser.init( collector ) ;
- if (parser.userConfigurators != null) {
- for (int ctr=0; ctr<parser.userConfigurators.length; ctr++) {
- Class cls = parser.userConfigurators[ctr] ;
- try {
- ORBConfigurator config = (ORBConfigurator)(cls.newInstance()) ;
- config.configure( collector, orb ) ;
- } catch (Exception exc) {
- // XXX Log this exception
- // ignore this for now: a bad user configurator does nothing
- }
- }
- }
- }
-
- private void persistentServerInitialization( ORB orb )
- {
- ORBData data = orb.getORBData() ;
-
- // determine the ORBD port so that persistent objrefs can be
- // created.
- if (data.getServerIsORBActivated()) {
- try {
- Locator locator = LocatorHelper.narrow(
- orb.resolve_initial_references(
- ORBConstants.SERVER_LOCATOR_NAME )) ;
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references(
- ORBConstants.SERVER_ACTIVATOR_NAME )) ;
- Collection serverEndpoints =
- orb.getCorbaTransportManager().getAcceptors(null, null);
- EndPointInfo[] endpointList =
- new EndPointInfo[serverEndpoints.size()];
- Iterator iterator = serverEndpoints.iterator();
- int i = 0 ;
- while (iterator.hasNext()) {
- Object n = iterator.next();
- if (! (n instanceof LegacyServerSocketEndPointInfo)) {
- continue;
- }
- LegacyServerSocketEndPointInfo ep =
- (LegacyServerSocketEndPointInfo) n;
- // REVISIT - use exception instead of -1.
- int port = locator.getEndpoint(ep.getType());
- if (port == -1) {
- port = locator.getEndpoint(SocketInfo.IIOP_CLEAR_TEXT);
- if (port == -1) {
- throw new Exception(
- "ORBD must support IIOP_CLEAR_TEXT");
- }
- }
-
- ep.setLocatorPort(port);
-
- endpointList[i++] =
- new EndPointInfo(ep.getType(), ep.getPort());
- }
-
- activator.registerEndpoints(
- data.getPersistentServerId(), data.getORBId(),
- endpointList);
- } catch (Exception ex) {
- throw wrapper.persistentServerInitError(
- CompletionStatus.COMPLETED_MAYBE, ex ) ;
- }
- }
- }
-
- /**
- * This is made somewhat complex because we are currently supporting
- * the ContactInfoList/Acceptor *AND* the legacy SocketFactory
- * transport architecture.
- */
- private void initializeTransport(final ORB orb)
- {
- ORBData od = orb.getORBData();
-
- CorbaContactInfoListFactory contactInfoListFactory =
- od.getCorbaContactInfoListFactory();
- Acceptor[] acceptors = od.getAcceptors();
-
- // BEGIN Legacy
- ORBSocketFactory legacySocketFactory = od.getLegacySocketFactory();
- USLPort[] uslPorts = od.getUserSpecifiedListenPorts() ;
- setLegacySocketFactoryORB(orb, legacySocketFactory);
- // END Legacy
-
- //
- // Check for incorrect configuration.
- //
-
- if (legacySocketFactory != null && contactInfoListFactory != null) {
- throw wrapper.socketFactoryAndContactInfoListAtSameTime();
- }
-
- if (acceptors.length != 0 && legacySocketFactory != null) {
- throw wrapper.acceptorsAndLegacySocketFactoryAtSameTime();
- }
-
-
- //
- // Client and Server side setup.
- //
-
- od.getSocketFactory().setORB(orb);
-
- //
- // Set up client side.
- //
-
- if (legacySocketFactory != null) {
- // BEGIN Legacy
- // Since the user specified a legacy socket factory we need to
- // use a ContactInfoList that will use the legacy socket factory.
- contactInfoListFactory =
- new CorbaContactInfoListFactory() {
- public void setORB(ORB orb) { }
- public CorbaContactInfoList create( IOR ior ) {
- return new SocketFactoryContactInfoListImpl(
- orb, ior);
- }
- };
- // END Legacy
- } else if (contactInfoListFactory != null) {
- // The user specified an explicit ContactInfoListFactory.
- contactInfoListFactory.setORB(orb);
- } else {
- // Use the default.
- contactInfoListFactory =
- TransportDefault.makeCorbaContactInfoListFactory(orb);
- }
- orb.setCorbaContactInfoListFactory(contactInfoListFactory);
-
- //
- // Set up server side.
- //
-
- //
- // Maybe allocate the Legacy default listener.
- //
- // If old legacy properties set, or there are no explicit
- // acceptors then register a default listener. Type of
- // default listener depends on presence of legacy socket factory.
- //
- // Note: this must happen *BEFORE* registering explicit acceptors.
- //
-
- // BEGIN Legacy
- int port = -1;
- if (od.getORBServerPort() != 0) {
- port = od.getORBServerPort();
- } else if (od.getPersistentPortInitialized()) {
- port = od.getPersistentServerPort();
- } else if (acceptors.length == 0) {
- port = 0;
- }
- if (port != -1) {
- createAndRegisterAcceptor(orb, legacySocketFactory, port,
- LegacyServerSocketEndPointInfo.DEFAULT_ENDPOINT,
- SocketInfo.IIOP_CLEAR_TEXT);
- }
- // END Legacy
-
- for (int i = 0; i < acceptors.length; i++) {
- orb.getCorbaTransportManager().registerAcceptor(acceptors[i]);
- }
-
- // BEGIN Legacy
- // Allocate user listeners.
- USLPort[] ports = od.getUserSpecifiedListenPorts() ;
- if (ports != null) {
- for (int i = 0; i < ports.length; i++) {
- createAndRegisterAcceptor(
- orb, legacySocketFactory, ports[i].getPort(),
- LegacyServerSocketEndPointInfo.NO_NAME,
- ports[i].getType());
- }
- }
- // END Legacy
- }
-
- /*
- * Legacy: name.
- */
- // REVISIT: see ORBD. make factory in TransportDefault.
- private void createAndRegisterAcceptor(ORB orb,
- ORBSocketFactory legacySocketFactory,
- int port, String name, String type)
- {
- Acceptor acceptor;
- if (legacySocketFactory == null) {
- acceptor =
- new SocketOrChannelAcceptorImpl(orb, port, name, type);
- } else {
- acceptor =
- new SocketFactoryAcceptorImpl(orb, port, name, type);
- }
- orb.getTransportManager().registerAcceptor(acceptor);
- }
-
- private void setLegacySocketFactoryORB(
- final ORB orb, final ORBSocketFactory legacySocketFactory)
- {
- if (legacySocketFactory == null) {
- return;
- }
-
- // Note: the createServerSocket and createSocket methods on the
- // DefaultSocketFactory need to get data from the ORB but
- // we cannot change the interface. So set the ORB (if it's ours)
- // by reflection.
-
- try {
- AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run()
- throws InstantiationException, IllegalAccessException
- {
- try {
- Class[] params = { ORB.class };
- Method method =
- legacySocketFactory.getClass().getMethod(
- "setORB", params);
- Object[] args = { orb };
- method.invoke(legacySocketFactory, args);
- } catch (NoSuchMethodException e) {
- // NOTE: If there is no method then it
- // is not ours - so ignore it.
- ;
- } catch (IllegalAccessException e) {
- RuntimeException rte = new RuntimeException();
- rte.initCause(e);
- throw rte;
- } catch (InvocationTargetException e) {
- RuntimeException rte = new RuntimeException();
- rte.initCause(e);
- throw rte;
- }
- return null;
- }
- }
- );
- } catch (Throwable t) {
- throw wrapper.unableToSetSocketFactoryOrb(t);
- }
- }
-
- private void initializeNaming( ORB orb )
- {
- LocalResolver localResolver = ResolverDefault.makeLocalResolver() ;
- orb.setLocalResolver( localResolver ) ;
-
- Resolver bootResolver = ResolverDefault.makeBootstrapResolver( orb,
- orb.getORBData().getORBInitialHost(),
- orb.getORBData().getORBInitialPort() ) ;
-
- Operation urlOperation = ResolverDefault.makeINSURLOperation( orb,
- bootResolver ) ;
- orb.setURLOperation( urlOperation ) ;
-
- Resolver irResolver = ResolverDefault.makeORBInitRefResolver( urlOperation,
- orb.getORBData().getORBInitialReferences() ) ;
-
- Resolver dirResolver = ResolverDefault.makeORBDefaultInitRefResolver(
- urlOperation, orb.getORBData().getORBDefaultInitialReference() ) ;
-
- Resolver resolver =
- ResolverDefault.makeCompositeResolver( localResolver,
- ResolverDefault.makeCompositeResolver( irResolver,
- ResolverDefault.makeCompositeResolver( dirResolver,
- bootResolver ) ) ) ;
- orb.setResolver( resolver ) ;
- }
-
- private void initServiceContextRegistry( ORB orb )
- {
- ServiceContextRegistry scr = orb.getServiceContextRegistry() ;
-
- scr.register( UEInfoServiceContext.class ) ;
- scr.register( CodeSetServiceContext.class ) ;
- scr.register( SendingContextServiceContext.class ) ;
- scr.register( ORBVersionServiceContext.class ) ;
- scr.register( MaxStreamFormatVersionServiceContext.class ) ;
- }
-
- private void registerInitialReferences( final ORB orb )
- {
- // Register the Dynamic Any factory
- Closure closure = new Closure() {
- public java.lang.Object evaluate() {
- return new DynAnyFactoryImpl( orb ) ;
- }
- } ;
-
- Closure future = ClosureFactory.makeFuture( closure ) ;
- orb.getLocalResolver().register( ORBConstants.DYN_ANY_FACTORY_NAME,
- future ) ;
- }
-
- private static final int ORB_STREAM = 0 ;
-
- private void initObjectCopiers( ORB orb )
- {
- // No optimization or policy selection here.
- ObjectCopierFactory orbStream =
- CopyobjectDefaults.makeORBStreamObjectCopierFactory( orb ) ;
-
- CopierManager cm = orb.getCopierManager() ;
- cm.setDefaultId( ORB_STREAM ) ;
-
- cm.registerObjectCopierFactory( orbStream, ORB_STREAM ) ;
- }
-
- private void initIORFinders( ORB orb )
- {
- IdentifiableFactoryFinder profFinder =
- orb.getTaggedProfileFactoryFinder() ;
- profFinder.registerFactory( IIOPFactories.makeIIOPProfileFactory() ) ;
-
- IdentifiableFactoryFinder profTempFinder =
- orb.getTaggedProfileTemplateFactoryFinder() ;
- profTempFinder.registerFactory(
- IIOPFactories.makeIIOPProfileTemplateFactory() ) ;
-
- IdentifiableFactoryFinder compFinder =
- orb.getTaggedComponentFactoryFinder() ;
- compFinder.registerFactory(
- IIOPFactories.makeCodeSetsComponentFactory() ) ;
- compFinder.registerFactory(
- IIOPFactories.makeJavaCodebaseComponentFactory() ) ;
- compFinder.registerFactory(
- IIOPFactories.makeORBTypeComponentFactory() ) ;
- compFinder.registerFactory(
- IIOPFactories.makeMaxStreamFormatVersionComponentFactory() ) ;
- compFinder.registerFactory(
- IIOPFactories.makeAlternateIIOPAddressComponentFactory() ) ;
- compFinder.registerFactory(
- IIOPFactories.makeRequestPartitioningComponentFactory() ) ;
- compFinder.registerFactory(
- IIOPFactories.makeJavaSerializationComponentFactory());
-
- // Register the ValueFactory instances for ORT
- IORFactories.registerValueFactories( orb ) ;
-
- // Register an ObjectKeyFactory
- orb.setObjectKeyFactory( IORFactories.makeObjectKeyFactory(orb) ) ;
- }
-
- private void initRequestDispatcherRegistry( ORB orb )
- {
- RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ;
-
- // register client subcontracts
- ClientRequestDispatcher csub =
- RequestDispatcherDefault.makeClientRequestDispatcher() ;
- scr.registerClientRequestDispatcher( csub,
- ORBConstants.TOA_SCID ) ;
- scr.registerClientRequestDispatcher( csub,
- ORBConstants.TRANSIENT_SCID ) ;
- scr.registerClientRequestDispatcher( csub,
- ORBConstants.PERSISTENT_SCID ) ;
- scr.registerClientRequestDispatcher( csub,
- ORBConstants.SC_TRANSIENT_SCID ) ;
- scr.registerClientRequestDispatcher( csub,
- ORBConstants.SC_PERSISTENT_SCID ) ;
- scr.registerClientRequestDispatcher( csub,
- ORBConstants.IISC_TRANSIENT_SCID ) ;
- scr.registerClientRequestDispatcher( csub,
- ORBConstants.IISC_PERSISTENT_SCID ) ;
- scr.registerClientRequestDispatcher( csub,
- ORBConstants.MINSC_TRANSIENT_SCID ) ;
- scr.registerClientRequestDispatcher( csub,
- ORBConstants.MINSC_PERSISTENT_SCID ) ;
-
- // register server delegates
- CorbaServerRequestDispatcher sd =
- RequestDispatcherDefault.makeServerRequestDispatcher( orb );
- scr.registerServerRequestDispatcher( sd,
- ORBConstants.TOA_SCID ) ;
- scr.registerServerRequestDispatcher( sd,
- ORBConstants.TRANSIENT_SCID ) ;
- scr.registerServerRequestDispatcher( sd,
- ORBConstants.PERSISTENT_SCID ) ;
- scr.registerServerRequestDispatcher( sd,
- ORBConstants.SC_TRANSIENT_SCID ) ;
- scr.registerServerRequestDispatcher( sd,
- ORBConstants.SC_PERSISTENT_SCID ) ;
- scr.registerServerRequestDispatcher( sd,
- ORBConstants.IISC_TRANSIENT_SCID ) ;
- scr.registerServerRequestDispatcher( sd,
- ORBConstants.IISC_PERSISTENT_SCID ) ;
- scr.registerServerRequestDispatcher( sd,
- ORBConstants.MINSC_TRANSIENT_SCID ) ;
- scr.registerServerRequestDispatcher( sd,
- ORBConstants.MINSC_PERSISTENT_SCID ) ;
-
- orb.setINSDelegate(
- RequestDispatcherDefault.makeINSServerRequestDispatcher( orb ) ) ;
-
- // register local client subcontracts
- LocalClientRequestDispatcherFactory lcsf =
- RequestDispatcherDefault.makeJIDLLocalClientRequestDispatcherFactory(
- orb ) ;
- scr.registerLocalClientRequestDispatcherFactory( lcsf,
- ORBConstants.TOA_SCID ) ;
-
- lcsf =
- RequestDispatcherDefault.makePOALocalClientRequestDispatcherFactory(
- orb ) ;
- scr.registerLocalClientRequestDispatcherFactory( lcsf,
- ORBConstants.TRANSIENT_SCID ) ;
- scr.registerLocalClientRequestDispatcherFactory( lcsf,
- ORBConstants.PERSISTENT_SCID ) ;
-
- lcsf = RequestDispatcherDefault.
- makeFullServantCacheLocalClientRequestDispatcherFactory( orb ) ;
- scr.registerLocalClientRequestDispatcherFactory( lcsf,
- ORBConstants.SC_TRANSIENT_SCID ) ;
- scr.registerLocalClientRequestDispatcherFactory( lcsf,
- ORBConstants.SC_PERSISTENT_SCID ) ;
-
- lcsf = RequestDispatcherDefault.
- makeInfoOnlyServantCacheLocalClientRequestDispatcherFactory( orb ) ;
- scr.registerLocalClientRequestDispatcherFactory( lcsf,
- ORBConstants.IISC_TRANSIENT_SCID ) ;
- scr.registerLocalClientRequestDispatcherFactory( lcsf,
- ORBConstants.IISC_PERSISTENT_SCID ) ;
-
- lcsf = RequestDispatcherDefault.
- makeMinimalServantCacheLocalClientRequestDispatcherFactory( orb ) ;
- scr.registerLocalClientRequestDispatcherFactory( lcsf,
- ORBConstants.MINSC_TRANSIENT_SCID ) ;
- scr.registerLocalClientRequestDispatcherFactory( lcsf,
- ORBConstants.MINSC_PERSISTENT_SCID ) ;
-
- /* Register the server delegate that implements the ancient bootstrap
- * naming protocol. This takes an object key of either "INIT" or
- * "TINI" to allow for big or little endian implementations.
- */
- CorbaServerRequestDispatcher bootsd =
- RequestDispatcherDefault.makeBootstrapServerRequestDispatcher(
- orb ) ;
- scr.registerServerRequestDispatcher( bootsd, "INIT" ) ;
- scr.registerServerRequestDispatcher( bootsd, "TINI" ) ;
-
- // Register object adapter factories
- ObjectAdapterFactory oaf = OADefault.makeTOAFactory( orb ) ;
- scr.registerObjectAdapterFactory( oaf, ORBConstants.TOA_SCID ) ;
-
- oaf = OADefault.makePOAFactory( orb ) ;
- scr.registerObjectAdapterFactory( oaf, ORBConstants.TRANSIENT_SCID ) ;
- scr.registerObjectAdapterFactory( oaf, ORBConstants.PERSISTENT_SCID ) ;
- scr.registerObjectAdapterFactory( oaf, ORBConstants.SC_TRANSIENT_SCID ) ;
- scr.registerObjectAdapterFactory( oaf, ORBConstants.SC_PERSISTENT_SCID ) ;
- scr.registerObjectAdapterFactory( oaf, ORBConstants.IISC_TRANSIENT_SCID ) ;
- scr.registerObjectAdapterFactory( oaf, ORBConstants.IISC_PERSISTENT_SCID ) ;
- scr.registerObjectAdapterFactory( oaf, ORBConstants.MINSC_TRANSIENT_SCID ) ;
- scr.registerObjectAdapterFactory( oaf, ORBConstants.MINSC_PERSISTENT_SCID ) ;
- }
-}
-
-// End of file.
diff --git a/src/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java b/src/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java
deleted file mode 100644
index 94bb5d9..0000000
--- a/src/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-
-package com.sun.corba.se.impl.orb ;
-
-import java.net.URL ;
-
-import org.omg.CORBA.CompletionStatus ;
-import org.omg.PortableInterceptor.ORBInitializer ;
-
-import com.sun.corba.se.pept.transport.Acceptor;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.spi.orb.DataCollector ;
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBData ;
-import com.sun.corba.se.spi.orb.ParserImplTableBase ;
-import com.sun.corba.se.spi.orb.StringPair ;
-import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
-import com.sun.corba.se.spi.transport.CorbaTransportManager;
-import com.sun.corba.se.spi.transport.IORToSocketInfo;
-import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo;
-import com.sun.corba.se.spi.transport.ReadTimeouts;
-
-import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
-import com.sun.corba.se.impl.legacy.connection.USLPort;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-
-public class ORBDataParserImpl extends ParserImplTableBase implements ORBData
-{
- private ORB orb ;
- private ORBUtilSystemException wrapper ;
- private String ORBInitialHost ;
- private int ORBInitialPort ;
- private String ORBServerHost ;
- private int ORBServerPort ;
- private String listenOnAllInterfaces;
- private com.sun.corba.se.spi.legacy.connection.ORBSocketFactory legacySocketFactory ;
- private com.sun.corba.se.spi.transport.ORBSocketFactory socketFactory;
- private USLPort[] userSpecifiedListenPorts ;
- private IORToSocketInfo iorToSocketInfo;
- private IIOPPrimaryToContactInfo iiopPrimaryToContactInfo;
- private String orbId ;
- private boolean orbServerIdPropertySpecified ;
- private URL servicesURL ;
- private String propertyInitRef ;
- private boolean allowLocalOptimization ;
- private GIOPVersion giopVersion ;
- private int highWaterMark ;
- private int lowWaterMark ;
- private int numberToReclaim ;
- private int giopFragmentSize ;
- private int giopBufferSize ;
- private int giop11BuffMgr ;
- private int giop12BuffMgr ;
- private short giopTargetAddressPreference ;
- private short giopAddressDisposition ;
- private boolean useByteOrderMarkers ;
- private boolean useByteOrderMarkersInEncaps ;
- private boolean alwaysSendCodeSetCtx ;
- private boolean persistentPortInitialized ;
- private int persistentServerPort ;
- private boolean persistentServerIdInitialized ;
- private int persistentServerId ;
- private boolean serverIsORBActivated ;
- private Class badServerIdHandlerClass ;
- private CodeSetComponentInfo.CodeSetComponent charData ;
- private CodeSetComponentInfo.CodeSetComponent wcharData ;
- private ORBInitializer[] orbInitializers ;
- private StringPair[] orbInitialReferences ;
- private String defaultInitRef ;
- private String[] debugFlags ;
- private Acceptor[] acceptors;
- private CorbaContactInfoListFactory corbaContactInfoListFactory;
- private String acceptorSocketType;
- private boolean acceptorSocketUseSelectThreadToWait;
- private boolean acceptorSocketUseWorkerThreadForEvent;
- private String connectionSocketType;
- private boolean connectionSocketUseSelectThreadToWait;
- private boolean connectionSocketUseWorkerThreadForEvent;
- private ReadTimeouts readTimeouts;
- private boolean disableDirectByteBufferUse;
- private boolean enableJavaSerialization;
- private boolean useRepId;
-
- // This is not initialized from ParserTable.
- private CodeSetComponentInfo codesets ;
-
-// Public accessor methods ========================================================================
-
- public String getORBInitialHost()
- {
- return ORBInitialHost;
- }
-
- public int getORBInitialPort()
- {
- return ORBInitialPort;
- }
-
- public String getORBServerHost()
- {
- return ORBServerHost;
- }
-
- public String getListenOnAllInterfaces()
- {
- return listenOnAllInterfaces;
- }
-
- public int getORBServerPort()
- {
- return ORBServerPort;
- }
-
- public com.sun.corba.se.spi.legacy.connection.ORBSocketFactory getLegacySocketFactory()
- {
- return legacySocketFactory;
- }
-
- public com.sun.corba.se.spi.transport.ORBSocketFactory getSocketFactory()
- {
- return socketFactory;
- }
-
- public USLPort[] getUserSpecifiedListenPorts ()
- {
- return userSpecifiedListenPorts;
- }
-
- public IORToSocketInfo getIORToSocketInfo()
- {
- return iorToSocketInfo;
- }
-
- public IIOPPrimaryToContactInfo getIIOPPrimaryToContactInfo()
- {
- return iiopPrimaryToContactInfo;
- }
-
- public String getORBId()
- {
- return orbId;
- }
-
- public boolean getORBServerIdPropertySpecified()
- {
- return orbServerIdPropertySpecified;
- }
-
- public boolean isLocalOptimizationAllowed()
- {
- return allowLocalOptimization ;
- }
-
- public GIOPVersion getGIOPVersion()
- {
- return giopVersion;
- }
-
- public int getHighWaterMark()
- {
- return highWaterMark;
- }
-
- public int getLowWaterMark()
- {
- return lowWaterMark;
- }
-
- public int getNumberToReclaim()
- {
- return numberToReclaim;
- }
-
- public int getGIOPFragmentSize()
- {
- return giopFragmentSize;
- }
-
- public int getGIOPBufferSize()
- {
- return giopBufferSize;
- }
-
- public int getGIOPBuffMgrStrategy(GIOPVersion gv)
- {
- if(gv!=null){
- if (gv.equals(GIOPVersion.V1_0)) return 0; //Always grow for 1.0
- if (gv.equals(GIOPVersion.V1_1)) return giop11BuffMgr;
- if (gv.equals(GIOPVersion.V1_2)) return giop12BuffMgr;
- }
- //If a "faulty" GIOPVersion is passed, it's going to return 0;
- return 0;
- }
-
- /**
- * @return the GIOP Target Addressing preference of the ORB.
- * This ORB by default supports all addressing dispositions unless specified
- * otherwise via a java system property ORBConstants.GIOP_TARGET_ADDRESSING
- */
- public short getGIOPTargetAddressPreference()
- {
- return giopTargetAddressPreference;
- }
-
- public short getGIOPAddressDisposition()
- {
- return giopAddressDisposition;
- }
-
- public boolean useByteOrderMarkers()
- {
- return useByteOrderMarkers;
- }
-
- public boolean useByteOrderMarkersInEncapsulations()
- {
- return useByteOrderMarkersInEncaps;
- }
-
- public boolean alwaysSendCodeSetServiceContext()
- {
- return alwaysSendCodeSetCtx;
- }
-
- public boolean getPersistentPortInitialized()
- {
- return persistentPortInitialized ;
- }
-
- //public void setPersistentServerPort(int sp)
- //{
- //persistentServerPort = sp;
- //persistentPortInitialized = true;
- //}
-
- public int getPersistentServerPort()
- {
- if ( persistentPortInitialized ) // this is a user-activated server
-