NockIX.fm Page 445 Friday, August 8, 2003 2:06 PM

Index

A with Selection Factory 52, 201 Abstract Factory (pattern) with Update Factory 52, 224 with Cache Collector 344 Active Record (pattern) with Data Accessor 31 with Active Domain Object 52 with Domain Object Factory 213 ActiveDomainObject (class) with Selection Factory 201 participant in Active Domain Object with Update Factory 224 38–39 access plan 129 Adapter (pattern) Active Domain Object (pattern) 33–52 with Data Accessor 31 connection factory 43 with Layers 78, 93 connection management 42–43 Address (class) 4–5 connection pool 43 example in Active Domain Object 34– data model encapsulation 36–37, 40 36, 48–49, 50 data model inconsistency 34–37 example in Domain Object Factory 209–212 domain logic 41 aggregation 62–64 domain object attribute 41 Apache Software Foundation 65 domain object collection 41, 50–51 see also Object/Relational Bridge logical attribute 38 (OJB) logical operation 38 AS/400 161, 164, 166–167, 172 saved state 43–48 atomicity 380 with Active Record 52 attribute with Cache Accessor 280 changes 219 with Data Accessor 31, 52 domain object 215–219 with Domain Object Assembler 52, transaction 389–390 252 unmapped 61–62 with Domain Object Factory 52, 213 authorization 80 with Layers 52, 76, 78, 91–93 authorization (example) with Object/Relational Map 52, 73 example in Primed Cache 291–292, with Paging Iterator 52 301–303 with Resource Descriptor 169 AuthorizationData (class) with Resource Pool 49

445

NockIX.fm Page 446 Friday, August 8, 2003 2:06 PM

446 Index

example in Primed Cache 301–303 collection AuthorizationKeyFactory (class) see Cache Collector (pattern) example in Primed Cache 302–303 complexity 270 configuration 362 B creation timestamp 336–338 badge reader system (example) debugging 361–362 example in Cache Search Sequence decoupled 271–272, 273 306–308, 312–314, 317–320, 322 demand BadgeAccessRecord (class) see Demand Cache (pattern) example in Cache Search Sequence description 365–370 306–308, 322 distributed notification 353 BaseConnectionDecorator (class) domain object 268–269 example in Resource Decorator 111– efficiency 362 114 encapsulation 275 example in Resource Pool 127, 130 expired data 325–344 example in Resource Timer 146, 154 fixed expiration 326, 328, 336–338 BasePreparedStatementDecorator (class) hash table 276 example in Resource Pool 132 heterogeneous notification 353 BaseResourceDecorator (class) hits 362, 365–370 participant in Resource Decorator 107, 109–110 housekeeping 269 BaseStatementDecorator (class) identity object 62 example in Resource Decorator 111– inactive expiration 326, 330, 338–341 115 initialization 268, 281–282, 285 bean-managed persistence (BMP) 52 interprocess notification 353 begin 381, 384, 388 key 268, 273–274, 276–279, 292–303 buffer 97 key access queue 338–343 key creation queue 336–338 C key generalization 310, 314, 317–322 cache last access timestamp 338–341 accesses 365–370 layer 79 accessor least-recently-used expiration 326, see Cache Accessor (pattern) 341–344 administration 276–277, 361–362 memory leak 285, 296, 331 candidate 281 metadata 328–330, 335 clear 276–277 minimal data set 285 coherency 346 notification 346–359

NockIX.fm Page 447 Friday, August 8, 2003 2:06 PM

Index 447

operation 268 write operation 275 optimized data set 296 Cache (class) partial key 292–303 participant in Cache Accessor 273– patterns 267–270 277 persistence manager 62 participant in Cache Search Sequence placeholder entry 285, 296–297, 311, 309–311 315 participant in Demand Cache 283– population 268, 281–282, 284–285, 285 291–293 participant in Primed Cache 294–297 prime operation 292, 295–296, 298 Cache (interface) primed participant in Cache Replicator 350, see Primed Cache (pattern) 353 read operation 274, 284–287 Cache Accessor (pattern) 271–280 redundant notification 352 multiple instances 276 refresh 276–277 read operation 274 replication stale data 275 see Cache Replicator (pattern) transparency 273 result set data 105 with Active Domain Object 280 scope 275 with Cache Collector 326 search sequence with Cache Replicator 280, 359 see Cache Search Sequence (pat- with Cache Search Sequence 280, 315, tern) 323 shortcut entry 307–314, 316–317 with Cache Statistics 280, 370 size 365–370 with Data Accessor 273, 280 size threshold 341–343 with Demand Cache 274, 280, 283, 290 specific key 292–303 with Domain Object Assembler 252, stale data 275, 345–346 280 statement 125 with Layers 280 statement handle 129–135 with Object/Relational Map 280 statistics with Primed Cache 274, 280, 292, 304 see Cache Statistics (pattern) write operation 275 synchronization 332–333 Cache Collector (pattern) topology 347–349, 352–353 325–344 transparency 268, 273 collection strategy 326–344 utilitization 275 creation timestamp 336–338 visibility 268 daemon thread 331–335

NockIX.fm Page 448 Friday, August 8, 2003 2:06 PM

448 Index

decoupled cache logic 326–328, 331 peer cache replicator 347–348 expired data 325–344 redundant notification 352 fixed expiration 326, 328, 336–338 replicated cache 347–356, 358–359 inactive expiration 326, 330, 338–341 scalability 346 initialization 343–344 stale data 345–346 key access queue 338–343 topology 347–349, 352–353 key creation queue 336–338 with Cache Accessor 280, 359 last access timestamp 338–341 with Decorator 350, 359 least-recently-used expiration 326, with Demand Cache 359 341–344 with Observer 359 metadata 328–330, 335 Cache Search Sequence (pattern) 305–323 multiple strategies 331 directed graph 314, 320–322 performance 332 key generalization 310, 314, 317–322 queue threshold 341–343 placeholder entry 311, 315 synchronization 332–333 sequence keys 309–317 thread 331–335 shortcut entry 307–314, 316–317 with Abstract Factory 344 with Cache Accessor 280, 315, 323 with Cache Accessor 326 with Cache Statistics 323 with Cache Statistics 344, 370 with Demand Cache 323 with Demand Cache 290, 344 with Primed Cache 323 with Primed Cache 304, 344 Cache Statistics (pattern) 361–370 with Strategy 344 accesses 365–370 Cache Replicator (pattern) 345–359 administration 361–362 central cache 348–349, 358–359 cache efficiency 362 centralized cache replicator 348–349, configuration 362 358–359 console interface 362, 369–370 clustering 346 current statistics 364, 367–368 coherency 346 debugging 361–362 decoupled replication logic 349, 352 decoupled presentation 362–363 distributed notification 353 description 365–370 event 347 graphical interface 362, 369–370 heterogeneous notification 353 hits 362, 365–370 interprocess notification 353 misses 365–370 Java event idiom 353 pool size 362 load balancing 346 resource leak 362 notification 346–359 snapshot statistics 366–368

NockIX.fm Page 449 Friday, August 8, 2003 2:06 PM

Index 449

with Cache Accessor 280, 370 CacheEntryFactory (interface) with Cache Collector 344, 370 example in Cache Collector 332–344 with Cache Search Sequence 323 participant in Cache Collector 327– with Demand Cache 370 329, 344 with Model-View-Controller 370 CacheReplicator (class) with Primed Cache 370 participant in Cache Replicator 350– with Resource Pool 136, 370 353 CacheAccessor (class) CacheSearchSequence (class) example in Cache Accessor 277–279 example in Cache Search Sequence 315–317, 322 example in Cache Collector 332–335, 343–344 participant in Cache Search Sequence 309–311 example in Cache Search Sequence 315–316 CacheUpdateEvent (class) example in Cache Statistics 368–369 example in Cache Replicator 357–358 example in Demand Cache 286–287, CacheUpdateListener (interface) 289 example in Cache Replicator 353–359 example in Primed Cache 297–303 CacheUpdateObserver (interface) participant in Cache Accessor 273– participant in Cache Replicator 350 277 call records (example) participant in Cache Search Sequence example in Pessimistic 405–407, 309–311 411–414 participant in Demand Cache 283– CallRecord (class) 285 example in Pessimistic Lock 411–414 participant in Primed Cache 293–297 CALLS (table) CacheAccessor (interface) example in Pessimistic Lock 406, participant in Cache Collector 327– 411–414 331 centralized cache replicator 348–349, CacheCollector (interface) 358–359 example in Cache Collector 332–344 Chain of Responsibility (pattern) participant in Cache Collector 327– with Layers 93 331 with Resource Decorator 116 CachedStatement (class) change identifier 400 example in Resource Pool 130–134 clustering 346 CacheEntry (interface) CollectionStatistics (class) example in Cache Collector 334–343 example in Cache Statistics 367–369 participant in Cache Collector 327– column list 207–208 330 Command (pattern)

NockIX.fm Page 450 Friday, August 8, 2003 2:06 PM

450 Index

with Data Accessor 31 example in Data Accessor 21–29 with Retryer 176–177, 183 example in Layers 89–91 commit 381, 384–385, 388, 392–393 concurrency Compensatable (interface) dirty read 374, 388–389, 391 example in Compensating Transac- missing update 373–374, 388–389, tion 424–429 396–397, 406–408, 419, 424 participant in Compensating Trans- non-repeatable read 374, 388–389 action 421–422 patterns 371–377 compensatable operation phantom read 374–375, 388–389 see Compensating Transaction (pat- problems 373–375 tern) resource 97, 99–100 compensating serialization 375–376 see Compensating Transaction (pat- solutions 375–376 tern) timer 375 Compensating Transaction (pattern) unit of work 371–376 417–430 working copy 372–377 compensatable operation 419–429 configuration data 281–282 compensate 421–422, 424–429 connection 98 compensating 419–429 close 124 create operation 424 factory 43 delete operation 424 initialization 117–118 delta operation 419–420, 423–424 key 125–128 distributed transaction 418–420 management 20–29, 42–43, 76, 86–88 local transaction 419 management layer (example) missing update 419, 424 example in Layers 86–88 multiple data sources 418–420 pool 43, 88, 125–128, 134–136, 180– perform 421–422, 424–429 181 transaction manager 419–420 pool (example) with Transaction 393, 418, 430 example in Resource Pool 125– CompensatingTransaction (class) 128 example in Compensating Transac- stale 135–136, 165–167, 172, 180–183 tion 425–430 stale recovery (example) participant in Compensating Trans- example in Retryer 180–183 action 421–422 timer (example) ConcreteConnectionManager (class) example in Resource Timer 146– example in Layers 86–88 156 ConcreteDataAccessor (class)

NockIX.fm Page 451 Friday, August 8, 2003 2:06 PM

Index 451

Connection (interface) example in Pessimistic Lock 405–407, example in Resource Decorator 104 411–414 example in Resource Pool 125–134 CustomerFactory (class) example in Resource Timer 146–156 example in Domain Object Factory participant in Transaction 382–385 211–212 ConnectionCloser (class) CustomerList (class) example in Resource Timer 146, 153– example in Active Domain Object 50– 155 51 ConnectionFactory (class) example in Layers 91–92 example in Active Domain Object 49 CUSTOMERS (table) 4–5 ConnectionManager (interface) example in Active Domain Object 34– 36 example in Layers 86, 89–91 example in Domain Object Factory ConnectionPool (class) 203–204, 207–212 example in Resource Pool 125–128 example in Object/Relational Map example in Retryer 180–181 91–92 consistency 380 example in Transaction 379–380, container-managed persistence (CMP) 73 391–393 container-managed transaction demarca- tion 389–393 D current statistics 364, 367–368 data access 4 CurrentStatistics (interface) decoupled 185, 195, 206–207, 218– example in Cache Statistics 367–368 219, 227 participant in Cache Statistics 364 encapsulation 11–14, 55–59 cursor 98, 254–255, 258 enhancement 16–19 scrollable 260 optimization 13, 17–19 updatable 376 orthogonality 75–76 Customer (class) 4–5 Data Access Command Beans (pattern) example in Active Domain Object 34– with Data Accessor 31 36, 43–50 (pattern) example in Domain Object Factory with Data Accessor 31 203–204, 208–212 Data Accessor (pattern) 9–31 customer names and addresses (example) connection management 20–29 example in Active Domain Object 34– data conversion 13 36, 43–51 encapsulation 11–14 example in Domain Object Factory enhancement 16–19 203–204, 209–212 factory 20 customer service tracking (example)

NockIX.fm Page 452 Friday, August 8, 2003 2:06 PM

452 Index

logical connection 13, 19 219, 227 logical operation 12–14, 17–18 encapsulation 36–37, 40, 55–61 logical resource 13 inconsistency 34–37 optimization 13, 17–19 multiple data models 58, 60–61 platform detail 13 orthogonality 75–76 resource management 20–29 DataAccessor (interface) SQL statement generation 21–29 example in Data Accessor 20–21 swappable implementation 17 example in Demand Cache 286–289 with Abstract Factory 31 example in Layers 88–89, 92–93 with Active Domain Object 31, 52 participant in Cache Accessor 273– with Adapter 31 275 with Cache Accessor 273, 280 participant in Cache Search Sequence with Command 31 309 with Data Access Command Beans 31 participant in Data Accessor 15 with Data Access Object 31 participant in Demand Cache 283– 284 with Demand Cache 286 participant in Domain Object Assem- with Domain Object Assembler 231, bler 231–234 252 participant in Primed Cache 294–295 with Domain Object Factory 205, 213 DataAccessorFactory (class) with Layers 31, 76–79, 88–91, 93 example in Layers 92–93 with Logical Connection 31 with Object/Relational Map 31 driver 103–105 with Paging Iterator 264 metadata 161–162, 164 with Resource Decorator 116 DatabaseMetaData (interface) with Resource Descriptor 169 example in Resource Descriptor 161, with Resource Pool 135 169 with Selection Factory 194, 201 DataException (class) with Singleton 19, 31 example in Active Domain Object 49– with Update Factory 217, 224 50 data conversion 13, 79, 186 example in Data Accessor 30 data distribution 79 example in Demand Cache 287–289 Data Mapper (pattern) declarative transaction 389–390 with Domain Object Assembler 252 Decorator (pattern) with Domain Object Factory 213 with Cache Replicator 350, 359 data model 3 with Resource Decorator 104, 116 decoupled 185, 195, 206–207, 218– see also Resource Decorator (pattern)

NockIX.fm Page 453 Friday, August 8, 2003 2:06 PM

Index 453

decoupling patterns 1–7 example in Domain Object Assem- delta operation 419–420, 423–424 bler 243–249 Demand Cache (pattern) 281–290 DirectDepositAccount (class) cache candidate 281 example in Domain Object Assem- cache initialization 281–282, 285 bler 243–252 cache population 281–282, 284–285 DirectDepositAccountAccessor (class) configuration data 281–282 example in Domain Object Assem- bler 249–252 memory leak 285 DirectDepositAccountFactory (class) minimal data set 285 example in Domain Object Assem- placeholder entry 285 bler 247–248 read operation 284–287 DirectDepositAccountKey (class) with Cache Accessor 274, 280, 283, example in Domain Object Assem- 290 bler 243–252 with Cache Collector 290, 344 DirectDepositAccountSelectionFactory with Cache Replicator 359 (class) with Cache Search Sequence 323 example in Domain Object Assem- with Cache Statistics 370 bler 246–247 with Data Accessor 286 DirectDepositAccountUpdateFactory with Identity Map 290 (class) with Primed Cache 290, 291–292, example in Domain Object Assem- 296–297, 304 bler 248–249 demarcation 380–381, 383–385 directed graph 314, 320–322 begin 381, 384, 388 DirectedGraph (class) commit 381, 384–385, 388, 392–393 example in Cache Search Sequence container-managed 389–390 320–322 rollback 381, 384–385, 392 dirty read 374, 388–389, 391 setRollbackOnly 381, 388, 393 distributed transaction 418–420 Department (class) see also Transaction (pattern) example in Cache Search Sequence domain logic 41 317–320 domain object 4–5, 40–42, 185–190 descriptor active see Resource Descriptor (pattern) see Active Domain Object (pat- direct deposit accounts (example) tern) example in Domain Object Assem- assembler bler 243–252 see Domain Object Assembler DIRECT_DEPOSIT_ACCOUNTS (table) (pattern)

NockIX.fm Page 454 Friday, August 8, 2003 2:06 PM

454 Index

attribute 41, 203–209, 215–219 with Cache Accessor 252, 280 cache 268–269 with Data Accessor 231, 252 collection 41, 50–51 with Data Mapper 252 delete 187, 228, 229–230, 234, 239 with Domain Object Factory 213, factory 228, 231, 252 see Domain Object Factory (pat- with Layers 79, 93, 252 tern) with Object/Relational Map 73, 252 identity 187–189 with Paging Iterator 252, 254–255, mapping 4–6, 33–52, 53–73, 78–79, 264 185–190, 191–195, 203–209, 215– with Selection Factory 201, 228, 231, 219, 227–252, 254–259 252 operation 186–187 with Table Data Gateway 252 persistence 187, 228, 229, 233–234, with Update Factory 225, 228, 231, 238–239 252 population 187, 228, 229, 232, 237– wrapper 236, 249–252 238, 247–248 write 228, 229, 233–234, 238–239 read 228, 229, 232, 237–238, 247–248 Domain Object Factory (pattern) 203– saved state 43–48 213 update 187, 215–225, 228, 229, 233– client interface 207 234, 238–239 column list 207–208 write 228, 229, 233–234, 238–239 constructor 207 Domain Object Assembler (pattern) 227– decoupling data access 206–207 252 decoupling data model 206–207 decoupling data access 227 domain object mapping 203–209 decoupling data model 227 generic implementation 208–209 delete 228, 229–230, 234, 239 result set 205 identity object 232–234, 237–243 row data 205–206, 209–213 mapping infrastucture 235 with Abstract Factory 213 persistence 228, 229, 233–234, 238– with Active Domain Object 52, 213 239 with Data Accessor 205, 213 population 228, 229, 232, 237–238, with Data Mapper 213 247–248 with Domain Object Assembler 213, read 228, 229, 232, 237–238, 247–248 228, 231, 252 read only mapping 236 with Layers 205, 213 SQL statement generation 240–243 with Object/Relational Map 73, 213 update 228, 229, 233–234, 238–239 with Paging Iterator 254–255, 265 with Active Domain Object 52, 252 with Selection Factory 201, 213

NockIX.fm Page 455 Friday, August 8, 2003 2:06 PM

Index 455

with Update Factory 213, 215, 225 example in Compensating Transac- with Value Object Assembler 213 tion 417–420, 426–427 DomainObjectAssembler (class) EnrollmentsOperation (class) example in Domain Object Assem- example in Compensating Transac- bler 236–252 tion 426–430 participant in Domain Object Assem- Enterprise Application Integration (EAI) bler 231–236 3 DomainObjectException (class) Enterprise JavaBeans (EJB) example in Domain Object Assem- bean-managed persistence (BMP) 52 bler 243 container-managed persistence example in Paging Iterator 260–262 (CMP) 73 DomainObjectFactory (interface) container-managed transaction de- example in Domain Object Assem- marcation 389–393 bler 236–238, 247–248 error example in Domain Object Factory analysis 160, 171–173, 177, 181–183 209–212 recovery 172–183 example in Paging Iterator 260–264 event participant in Domain Object Assem- cache notification 347 bler 231–235 Java idiom 353 participant in Domain Object Factory EventListener (interface) 205–209 example in Cache Replicator 357–358 participant in Paging Iterator 256– EventObject (class) 257, 259 example in Cache Replicator 357 durability 380 F E factory Employee (class) 4–5 abstract example in Active Domain Object 34– see Abstract Factory (pattern) 36, 49 connection 43 example in Cache Search Sequence 317–320 data accessor 20, 92–93 example in Object/Relational Map 64 domain object EMPLOYEES (table) 4–5 see Domain Object Factory (pat- tern) example in Active Domain Object 34– 36 resource 110, 112–114 example in Object/Relational Map 64 selection ENROLLMENTS (table) see Selection Factory (pattern) update

NockIX.fm Page 456 Friday, August 8, 2003 2:06 PM

456 Index

see Update Factory (pattern) identity fault-tolerance 171–183 attribute 61–62, 192, 195 fetch mapping 192 size 260, 261 object 187–189, 191–201, 232–234, strategy 254, 258 237–243, 273 file handle 95–97 Identity Map (pattern) fixed expiration cache collection (exam- with Demand Cache 290 ple) inactive expiration cache collection (ex- example in Cache Collector 336–338 ample) FixedExpirationCacheCollector (class) example in Cache Collector 338–341 example in Cache Collector 336–338 InactiveExpirationCacheCollector (class) FixedExpirationCacheEntry (class) example in Cache Collector 338–341 example in Cache Collector 336–338 InactiveExpirationCacheEntry (class) FixedExpirationCacheEntryFactory example in Cache Collector 338–341 (class) InactiveExpirationCacheEntryFactory example in Cache Collector 336–337 (class) free-form text (example) example in Cache Collector 339–340 example in Pessimistic Lock 405–407 inactivity threshold 138, 143–144 inheritance 64–65 G class table 64 garbage collection 99–100, 105, 138 concrete table 64 Grid (class) single table 64–65 example in Resource Descriptor 161 input operation 186–187 grid (example) input patterns 185–190 example in Resource Descriptor 161 INVENTORY (table) example in Transaction 379–380, H 391–393 hash table 276 inventory availability (example) HashMap (class) example in Optimistic Lock 395–397, example in Cache Replicator 353–356 400–403 InventoryItem (class) I example in Optimistic Lock 400–403 IBM iSeries 161, 164, 166–167, 172 AS/400 161, 164, 166–167, 172 iSeriesResourceDescriptor (class) iSeries 161, 164, 166–167, 172 example in Resource Descriptor 164, Toolbox for Java 161, 164, 166–167 166–167 isolation 380

NockIX.fm Page 457 Friday, August 8, 2003 2:06 PM

Index 457

isolation level 384, 388–391 L read committed 388 Layers (pattern) 75–93 read uncommitted 388, 391 authorization 80 repeatable read 389 cache 79 serializable 389 combining patterns 7 iterator connection management 76, 86–88 see Paging Iterator (pattern) connection pool 88 data conversion 79 J data distribution 79 Jakarta Project 65 domain object mapping 78–79 see also Object/Relational Bridge initialization 84–85 (OJB) logging 80 Java 2 Enterprise Edition (J2EE) logical operation 79, 88–89 transaction support 386, 393 non-strict 82 Java Data Objects (JDO) 65–73 orthogonality 75–76, 80 example in Primed Cache 297–301, resource management 79 303 resource optimization 79 query filter 300–301 SQL statement generation 76 Java Database Connectivity (JDBC) 103– statement leak 88 105, 124, 135 stub implementation 85, 88 Java Transaction API (JTA) 386, 392–393 with Active Domain Object 52, 76, 78, Java Transaction Service (JTS) 386 91–93 journalling 172 with Adapter 78, 93 K with Cache Accessor 280 with Chain of Responsibility 93 Key (class) with Data Accessor 31, 76–79, 88–91, example in Cache Accessor 277–279 93 example in Primed Cache 298–303 with Domain Object Assembler 79, Key (interface) 93, 252 example in Cache Search Sequence with Domain Object Factory 205, 213 317–322 with Object/Relational Map 73, 78, 93 participant in Cache Search Sequence with Paging Iterator 264 310 with Resource Decorator 88 KeyFactory (interface) with Resource Timer 88 example in Primed Cache 297–303 with Selection Factory 194, 201 participant in Primed Cache 294–295 with Update Factory 217, 225

NockIX.fm Page 458 Friday, August 8, 2003 2:06 PM

458 Index

63–64 407 leak detection decorator (example) updatable cursor 396–397, 406–407 example in Resource Decorator 105, user identifier 410 111–116 Lock (class) LeakDetectionConnectionDecorator participant in Pessimistic Lock 408– (class) 409 example in Resource Decorator 112– logging 80, 97, 104, 144 116 logical LeakDetectionStatementDecorator attribute 38, 60 (class) connection 13, 19, 31 example in Resource Decorator 112– operation 12–14, 17–18, 38, 79, 88–89 115 resource 13, 116, 135 least-recently-used expiration cache col- lection (example) Logical Connection (pattern) example in Cache Collector 341–344 with Data Accessor 31 LINE_ITEMS (table) LRUCacheCollector (class) example in Object/Relational Map example in Cache Collector 341–343 54–55, 62–64, 68–69 LRUCacheEntry (class) LineItem (class) example in Cache Collector 341–342 example in Object/Relational Map LRUCacheEntryFactory (class) 54–57, 62–66, 68–69, 71–72 example in Cache Collector 342–343 List (interface) example in Paging Iterator 260–264 M load balancing 346 Manager (class) lock example in Object/Relational Map 64 column 407–414 MANAGERS (table) optimistic example in Object/Relational Map 64 see Optimistic Lock (pattern) many-to-many relationship 63 orphan 399, 410, 413 Map (interface) performance 381–382, 384, 389, 396– example in Cache Accessor 277–279 397, 399 example in Cache Replicator 353–356 pessimistic example in Domain Object Factory see Pessimistic Lock (pattern) 209–212 scalability 381–382, 384, 389, 396– example in Update Factory 220–224 397, 399 MapMetadata (class) timestamp 410 participant in Object/Relational Map transaction 381, 384, 396–397, 406– 58–60

NockIX.fm Page 459 Friday, August 8, 2003 2:06 PM

Index 459

metadata object identity 61–62 cache 328–330, 335 one-to-many relationship 63 database 161–162, 164 one-to-one relationship 63 in Object/Relational Map 56, 58–60, persistence manager 58–65 68–70 third-party product 57–60, 65–73 missing update 373–374, 388–389, 406– unmapped attribute 61–62 408, 419, 424 with Active Domain Object 52, 73 Model-View-Controller (pattern) with Cache Accessor 280 with Cache Statistics 370 with Data Accessor 31 MySQL 161, 164 with Domain Object Assembler 73, MySQLResourceDescriptor (class) 252 example in Resource Descriptor 164 with Domain Object Factory 73, 213 with Layers 73, 78, 93 N with Paging Iterator 73 non-repeatable read 374, 388–389 with Resource Descriptor 169 notification 346–359 with Selection Factory 73, 201 distributed 353 with Update Factory 73, 224 heterogeneous 353 see also Java Data Objects (JDO) interprocess 353 see also Object Relational Bridge (OJB) O object-oriented database 5, 61, 72 Object Management Group (OMG) 386 Observer (pattern) Object Transaction Service (OTS) 386 with Cache Replicator 359 Object/Relational Bridge (OJB) 65–72 one-to-many relationship 63 descriptor 68–70 one-to-one relationship 63 repository definition 70 Open Database Connectivity (ODBC) Object/Relational Map (pattern) 53–73 103 aggregation 62–64 Open Group, The 386 caching 62 Optimistic Lock (pattern) 395–404 commercial product 57–60, 65–73 change identifier 400 identity attribute 61–62 diagnostic information 397–399, 403 inheritance 64–65 external components 399 lazy initialization 63–64 lock 396–397 many-to-many relationship 63 lost work 399 mapping concepts 56–57 missing update 396–397 metadata 56, 58–60, 68–70 orphan lock 399

NockIX.fm Page 460 Friday, August 8, 2003 2:06 PM

460 Index

performance 396–397, 399 Page (class) row data subset 400 participant in Paging Iterator 256– scalability 396–397, 399 257 timestamp 396, 399–403 Paging Iterator (pattern) 253–265 trigger 400 close 259–260, 262 version 396–403 concurrency 258 version test 396–400, 402–403 cursor 254–255, 258 with Optimistic Offline Lock 404 fetch size 260, 261 with Pessimistic Lock 406 fetch strategy 254, 258 with Transaction 393, 400, 404 last page 259 with Version Number 404 lock 258 working copy 395–403 page 254–255, 258–260 Optimistic Offline Lock (pattern) page size 257 with Optimistic Lock 404 scrollable 260 OptimisticLockException (class) with Active Domain Object 52 example in Optimistic Lock 403 with Data Accessor 264 Order (class) with Domain Object Assembler 252, example in Object/Relational Map 254–255, 264 54–57, 63–64, 67–72 with Domain Object Factory 254– order processing (example) 255, 265 example in Object/Relational Map with Layers 264 54–57, 62–64, 65–72 with Object/Relational Map 73 example in Optimistic Lock 395–397, with Resource Timer 259, 265 400–403 with Value List Handler 264 ORDERS (table) PagingIterator (class) example in Object/Relational Map example in Paging Iterator 260–264 54–55, 63–64, 67, 69–70 participant in Paging Iterator 256– orphan lock 399, 410, 413 257, 259–260 orthogonality 75–76, 80 parameter marker 129–130 output operation 186–187 payroll system (example) output patterns 185–190 example in Data Accessor 9–10 peer cache replicator 347–348 P persistence page 254–255, 258–260 domain object 187, 228, 229, 233– last 259 234, 238–239 size 257 persistence manager 58–65

NockIX.fm Page 461 Friday, August 8, 2003 2:06 PM

Index 461

PersistenceManager (interface) resource 139 example in Object/Relational Map statistics 70–71 see Cache Statistics (pattern) example in Primed Cache 297–299, see also Resource Pool (pattern) 303 Pool Allocation (pattern) participant in Object/Relational Map with Resource Pool 135 58–61 PooledConnection (class) Pessimistic Lock (pattern) 405–415 example in Resource Pool 125–128 diagnostic information 407–409, 414 PooledResource (class) external components 410 participant in Resource Pool 119– lock column 407–414 122, 135 missing update 406–408 preferences (example) orphan lock 410, 413 example in Cache Accessor 279 timestamp 410 example in Cache Replicator 345–346 trigger 410–411 example in Demand Cache 282, 289 user identifier 410 PREFERENCES (table) with Optimistic Lock 406 example in Cache Accessor 279 with Pessimistic Offline Lock 415 example in Demand Cache 289 with Resource Timer 410, 415 prepared statement 98, 129–135 with Transaction 393, 409, 415 literal value 129–130 working copy 406–414 parameter marker 129–130 Pessimistic Offline Lock (pattern) PreparedStatement (interface) with Pessimistic Lock 415 example in Resource Pool 130–134 PessimisticLockException (class) pricing application (example) example in Pessimistic Lock 412–414 example in Cache Collector 325–326 phantom read 374–375, 388–389 primary key 188 placeholder entry 285, 296–297, 311, 315 Primed Cache (pattern) 291–304 point-of-sale application (example) cache population 291–293 example in Transaction 379–381, key 292–303 391–393 memory leak 296 pool optimized data set 296 accesses 365–370 partial key 292–303 connection 134–136, 180–181 placeholder entry 296–297 description 365–370 prime operation 292, 295–296, 298 hits 365–370 primed partial key list 294–295, 297 misses 365–370 specific key 292–303

NockIX.fm Page 462 Friday, August 8, 2003 2:06 PM

462 Index

with Cache Accessor 274, 280, 292, 353 304 resource 95–101 with Cache Collector 304, 344 close 124 with Cache Replicator, 359 concurrency 97, 99–100 with Cache Replicator (pattern) with context 96 Primed Cache 359 decorator with Cache Search Sequence 323 see Resource Decorator (pattern) with Cache Statistics 370 dependent 124 with Demand Cache 290, 291–292, descriptor 296–297, 304 see Resource Descriptor (pattern) project management application (exam- factory 110, 112–114 ple) 372–375 inactivity 138–139 project planning application (example) 372–375 inactivity threshold 138, 143–144 initialization 96, 117–118, 122 Q key 120, 123, 125–133 query leak 99–100, 104–105, 124, 137–140, filter 300–301 362 results 253–265 logical 135 QueryOperation (class) management 20–29, 79, 99–100, 122, 138 example in Resource Descriptor 168 multiple closes 145 example in Retryer 180–183 optimization 79 queue patterns 95–101 key access 338–343 pool 100, 139 key creation 336–338 see also Resource Pool (pattern) threshold 341–343 reference 107, 109, 111–112 R releasing 139 read committed 388 timer read uncommitted 388, 391 see Resource Timer (pattern) ReadOnlyGrid (class) Resource (interface) example in Resource Descriptor 161 participant in Resource Decorator 107, 109–110 repeatable read 389 participant in Resource Pool 119– ReplicatedCache (class) 122, 135 example in Cache Replicator 353– participant in Resource Timer 140– 356, 358–359 141, 157 participant in Cache Replicator 350–

NockIX.fm Page 463 Friday, August 8, 2003 2:06 PM

Index 463

Resource Decorator (pattern) 103–116 with Singleton 169 combination 108–109 Resource Pool (pattern) 117–136 complete implementation 109 cleaning 124–125 construction 109 closing resources 124 custom behavior 107–108, 109–110, connection pool 117–118, 125–128, 112–115 134–135 database driver 103–105 growth increment 123 delegation 107–112 inactivity 139 logging 104 initial size 123 logical resource 116 logical resource 135 preventing write operations 105 maximum resources 124 reference resource 107, 109, 111–112 properties 123–124 related interface 110 releasing 139 resource factory 110, 112–114 resource initialization 117–118, 122 resource leak 104–105 resource key 123, 125–133 result set caching 105 resource management 122 result set scrollability 105 statement cache 129–135 tweaking SQL statements 105 statement category 135 with Chain of Responsibility 116 statement morphing 134–135 with Data Accessor 116 with Active Domain Object 49 with Decorator 104, 116 with Cache Statistics 136, 370 with Layers 88 with Data Accessor 135 with Resource Pool 116, 119, 127, with Pool Allocation 135 130, 132, 135 with Resource Decorator 116, 119, with Resource Timer 116, 140, 145, 127, 130, 132, 135 154, 157 with Resource Timer 125, 135, 157 Resource Descriptor (pattern) 159–169 with Retryer 136 error analysis 160 Resource Timer (pattern) 137–157 global registry 165–168 concurrency solution 375 SQL differences 160 end user scenario 138, 139 standards incompatibilities 159–160 event 143, 145, 147–149 static resolution 164–165 garbage collection 138 with Active Domain Object 169 inactivity threshold 138, 143–144 with Data Accessor 169 logging 144 with Object/Relational Map 169 multiple resource closes 145 with Retryer 168, 169, 181–183 releasing 139

NockIX.fm Page 464 Friday, August 8, 2003 2:06 PM

464 Index

resource inactivity 138–139 result set 98 resource leak 137–140 cache 105 resource management 138 close 139, 259–260, 262 result set inactivity 139 concurrency 258 thread 144–145 cursor 98, 254–255, 258 timer thread 149–151 disconnected 98 transaction inactivity 139 domain object mapping 205 with Layers 88 fetch size 260, 261 with Paging Iterator 259, 265 inactivity 139 with Pessimistic Lock 410, 415 lock 258 with Resource Decorator 116, 140, scrollable 105, 260 145, 154, 157 updatable 160–161, 165–167, 376 with Resource Pool 125, 135, 157 ResultSet (interface) with Transaction 157, 393 example in Paging Iterator 260–264 ResourceDescriptor (interface) example in Resource Decorator 104 example in Resource Descriptor 165– Retryable (interface) 168 participant in Retryer 174–183 participant in Resource Descriptor Retryer (class) 163–165 example in Retryer 178–183 ResourceDescriptorRegistry (class) participant in Retryer 174–177 example in Resource Descriptor 165– Retryer (pattern) 171–183 168 commercial product defects 172 ResourcePool (class) configuration 177 participant in Resource Pool 119–122 configuration semantics 172 ResourceTimer (class) error analysis 171–173, 177, 181–183 example in Resource Timer 146–156 error recovery 172–183 participant in Resource Timer 140– 143, 145 fault-tolerance 171–183 ResourceTimerEvent (class) product interactions 172 example in Resource Timer 146–156 retryable template 176–177 ResourceTimerListener (interface) with Command 176–177, 183 example in Resource Timer 146–156 with Resource Descriptor 168, 169, 181–183 ResourceTimerListenerList (class) with Resource Pool 136 example in Resource Timer 146–153 RetryFailedException (class) ResourceTimerThread (class) example in Retryer 179–180 example in Resource Timer 146, 149– 152 Role (class)

NockIX.fm Page 465 Friday, August 8, 2003 2:06 PM

Index 465

example in Cache Search Sequence decoupling data access 195 317–319 decoupling data model 195 rollback 381, 384–385, 392 domain object mapping 191–195 ROSTER (table) generic implementation 196 example in Compensating Transac- identity object attribute 195 tion 417–420, 427–429 identity object mapping 192 RosterOperation (class) ordering information 195 example in Compensating Transac- with Abstract Factory 201 tion 427–430 with Active Domain Object 52, 201 Row (class) with Data Accessor 194, 201 example in Cache Accessor 277–279 with Domain Object Assembler 201, example in Data Accessor 29 228, 231, 252 row data 205–206, 209–213 with Domain Object Factory 201, 213 Row Data Gateway (pattern) with Layers 194, 201 with Selection Factory 201 with Object/Relational Map 73, 201 with Row Data Gateway 201 S with Update Factory 201, 225 savepoint 390 SelectionFactory (interface) scalability 346 example in Domain Object Assem- scrollable bler 236–237, 240, 246–247 cursor 260 example in Selection Factory 196–201 iterator 260 participant in Domain Object Assem- result set 105, 260 bler 231–235 search form (example) participant in Selection Factory 194– example in Paging Iterator 253–254 196 next button 259 self-service class registration (example) search sequence example in Compensating Transac- see Cache Search Sequence (pattern) tion 417–420, 426–430 selection 191–201 serializable 389 see also Selection Factory (pattern) setRollbackOnly 381, 388, 393 Selection (interface) Singleton (pattern) participant in Selection Factory 194– with Data Accessor 19, 31 195 with Resource Descriptor 169 Selection Factory (pattern) 191–201 snapshot statistics 366–368 client interface 195 SnapshotStatistics (class) constructor 195–196 example in Cache Statistics 366–368

NockIX.fm Page 466 Friday, August 8, 2003 2:06 PM

466 Index

participant in Cache Statistics 364 example in Cache Statistics 365–370 socket 97 participant in Cache Statistics 363– stale 364 connection 165–167, 172, 180–183 StatisticsServlet (class) connection recovery (example) example in Cache Statistics 369–370 example in Retryer 180–183 Strategy (pattern) data 345–346 with Cache Collector 344 stale data 275 Structured Query Language (SQL) standards incompatibilities 159–160 column list 207–208 statement DELETE operation 27, 242–243, 427 cache 125, 129–135 differences 160 cache (example) INSERT operation 24–25, 43, 216, example in Resource Pool 129– 220, 222–223, 241–242, 426 134 ORDER BY clause 23, 90, 195 category 135 preventing write operations 105 close 124 SELECT operation 23, 43, 50, 89–90, compiled 129–135 188, 212, 240, 288, 412, 428 handle 98, 129–135 SET clause 26, 220, 241 key 130–133 statement generation 21–29, 76, 240– 243 leak 88 tweaking statements 105 literal value 129–130 UPDATE operation 26, 44, 216, 220, morphing 134–135 223–224, 240–241, 398, 400, 402, parameter marker 129–130 413 prepared 98, 129–135 VALUES clause 25, 242 Statement (interface) WHERE clause 23, 26–27, 28–29, 90, example in Resource Decorator 104 192, 194, 196–201, 246–247 StatementCachingConnection (class) stub implementation 85, 88 example in Resource Pool 130–135 system administration (example) statistics example in Cache Search Sequence cache 305 see Cache Statistics (pattern) current 364, 367–368 T pool Table Data Gateway (pattern) see Cache Statistics (pattern) with Domain Object Assembler 252 snapshot 366–368 table inheritance 64–65 Statistics (interface) class 64

NockIX.fm Page 467 Friday, August 8, 2003 2:06 PM

Index 467

concrete 64 consistency 380 single 64–65 declarative transaction 389–390 thread demarcation 380–381, 383–385, 389– cache collection 331–335 390 timer 144–145, 149–151 distributed transaction 386–388, TimedConnection (class) 392–393 example in Resource Timer 146–156 durability 380 TimedResource (class) isolation 380 participant in Resource Timer 140– isolation level 384, 388–391 145, 157 local transaction 385, 391–392 timer lock 381, 384 see Resource Timer (pattern) multiple data sources 386–388, 392– timestamp 393 creation 336–338 native support 380–382, 384, 393 last access 338–341 performance 381–382, 384, 389 version 396, 399–403 read committed 388 Timestamp (class) read uncommitted 388, 391 example in Optimistic Lock 401–403 repeatable read 389 TITLES (table) resource manager 386–388 example in Transaction 379–380, rollback 381, 384–385, 392 391–393 savepoint 390 topology 347–349, 352–353 scalability 381–382, 384, 389 transaction 98 serializable 389 inactivity 139 serialization 380, 384 lock 139 setRollbackOnly 381, 388, 393 see also Compensating Transaction transaction manager 386–388 (pattern) transaction processing monitor 386– see also Transaction (pattern) 388 timer 139 two-phase commit 387 Transaction (interface) unit of work 379–382 participant in Transaction 383–385 with Compensating Transaction 393, Transaction (pattern) 379–393 418, 430 atomicity 380 with Optimistic Lock 393, 400, 404 attribute 389–390 with Pessimistic Lock 393, 409, 415 begin 381, 384, 388 with Resource Timer 157, 393 commit 381, 384–385, 388, 392–393 TransactionContext (interface)

NockIX.fm Page 468 Friday, August 8, 2003 2:06 PM

468 Index

participant in Transaction 383–385 update representation 217 TreeMap (class) with Abstract Factory 224 example in Cache Accessor 278 with Active Domain Object 52, 224 trigger 400, 410–411 with Data Accessor 217, 224 two-phase commit 387 with Domain Object Assembler 225, 228, 231, 252 U with Domain Object Factory 213, unit of work 371–376, 379–382 215, 225 serialization 375–376, 380, 384 with Layers 217, 225 timer 375 with Object/Relational Map 73, 224 university registration (example) with Selection Factory 201, 225 example in Compensating Transac- UpdateFactory (interface) tion 417–420, 426–430 example in Domain Object Assem- unmapped attribute 61–62 bler 236–237, 240–242, 248–249 updatable grid (example) example in Update Factory 220–224 example in Resource Descriptor 161 participant in Domain Object Assem- UpdatableGrid (class) bler 231, 233–236 example in Resource Descriptor 161 participant in Update Factory 217– 220 update user preferences (example) concurrent 373–376 example in Cache Accessor 279 missing 373–374, 388–389, 396–397, 406–408, 419, 424 example in Cache Replicator 345–346 operation 216, 217–218 example in Demand Cache 282, 289 representation 217 UserTransaction (interface) Update (interface) example in Transaction 392–393 participant in Update Factory 217– 218 V Update Factory (pattern) 215–225 Value List Handler (pattern) attribute changes 219 with Paging Iterator 264 client interface 219 Value Object Assembler (pattern) constructor 219 with Domain Object Factory 213 decoupling data access 218–219 Vehicle (class) 185–189 decoupling data model 218–219 example in Paging Iterator 262–264 domain object mapping 215–219 example in Update Factory 216, 220– 224 generic implementation 219–220 vehicle inventory (example) 187–189 update operation 216, 217–218 example in Paging Iterator 253–254,

NockIX.fm Page 469 Friday, August 8, 2003 2:06 PM

Index 469

262–264 participant of Optimistic Lock 397 example in Selection Factory 192, Version Number (pattern) 196–201 with Optimistic Lock 404 example in Update Factory 216 video rental store (example) VehicleCriteria (class) 188–189 example in Transaction 379–381, example in Selection Factory 192, 391–393 196–201 VINSelectionFactory (class) VehicleCriteriaSelectionFactory (class) example in Selection Factory 198 example in Selection Factory 198–201 VehicleFactory (class) W example in Paging Iterator 262–264 web search form (example) VEHICLES (table) 185–189 example in Paging Iterator 253–254 example in Paging Iterator 262–263 web site authorization (example) example in Selection Factory 192, example in Primed Cache 291–292, 196–201 301–303 example in Update Factory 216, 220– working copy 372–377, 395–403, 406–414 224 read only 375 VehicleUpdateFactory (class) serialization 375–376 example in Update Factory 222–224 validation 376 version WorkingCopy (class) change identifier 400 participant in Optimistic Lock 397– column 396–403 398 row data subset 400 participant in Pessimistic Lock 408– test 396–400, 402–403 409 timestamp 396, 399–403 Version (class) X XA Specification 386