sample app addressing performance problems, 643 caching, 646 synchronization, 648 WAS Tool, 644 architecture, 209, 248 <i>business logic, Implementing, 428 business interfaces, defining, 429 business interfaces, implementing, 432 custom bean definitions, 436 JMS propagating data updates, 435 caching, 247 data access, 278-83, 319 DAO pattern, 319, 353 JDBC, 319 deploying creating connection pools, 602 creating JMS destinations, 603 JBoss deployment descriptors, 605 JBoss server, 601, 607 parameters for deployment, 600 design assumptions, 182 EJBs, 222, 227, 387, 410 accessing, 417 BoxOffice, using business methods interface, 387 implementing, 410 infrastructure framework, 397 bean factory, using, 401 JavaBeans, using, 397 introduction, 179 JBoss server and, 199 JDBC abstraction framework, 324 JMS, 234 JSP views JSTL, 541 limitations, 183 oracle database and, 200 packaging, 592 Ant build tool, 594 EAR deployment, 593 performance, 198 revalidation, 670 session state, holding, 389 web containers preferred to SFSBs, reasons, 389 software issues, 200 stages of delivery, 183 transaction management, 213 user interface box office users, 198 public internet users, 183 users, 180 administrators, 182 box office users, 181 public internet users, 180 using JProbe with sample app, 627, 644, 651 view technologies, 519 formatting presented information, 519 JSP views, 538 model objects, 521 Velocity, 548 XMLC, 564 XSLT, 555 web app framework, 467 controller implementation example, 481 data validation, 498 designing, 468 implementing web tier, 506 MVC control flow, 469 request handling, 508 workflow refinements, 479 XML, 245 scalability addressing problems, 630 avoiding use of container services, 631 server choice and configuration, 630 caching, 632 clusters and, 613 compared to performance, 613 definition, 613 distributed architecture, 205 enterprise architecture goals, 16, 614 J2EE design, 678 locating problems, 623 layered testing, 623 profiling tools, 623 major issues, 672 maximizing, 208 problems with, 613 risk management, 69 robust and scalable architectures, 207 SFSB (stateful session beans) limitations, 366, 373 passivation/reactivation overcoming, 366 state management, 26 testing, 105 using EJBs, 22 scheduling EJB container, 222 scope attribute <jsp:useBean>element, 531 scoping variable scoping, 151 screens, sample app, 185 tutorial seats screen, 191 confirm reservation screen, 196 display show screen, 189 payment details screen, 194 show reservation screen, 192 welcome screen, 188 seat reservation system see sample app security see also authentication. see also authorization. custom security managers, 237 declarative security using EJB, 23 disadvantages of EJBs.216 J2EE security, 235 JAAS, 237 MDBs, 231 programmatic security using EJB, 23 role-based security, 235 role- based security using EJB, 23 testing web specific issues, 100 Using EJBs, 23 when to use messaging, 233 self-documentation, 159 semantic data valldation, 496 Seppaku pattern, 303 sequence entity beans, 271 Seriallzable Interface, java.io package, 653 serialization, 653 serialization optimizing serialization to move data efficiently, 659 custom serialization, 661 non issues, 660 primitive fields, 659 transient data, 659 serilizable objects, 653 using EJBs, 21 server choosing app server, 45-55 class loading in J2EE and, 590 configuring server to run app, 596 authentication, 597 creating connection pools, 597 creating JMS destinations, 597 installing libraries, 598 integrating JProbe with app server, 625 tuning server, 630 server affinity distributed architecture, 206 SLSB (stateless session beans) avoiding, 364 state management, 26 service definition files, JBoss, 601 installing service definition files, 604 Ant build tool, 604 JMX MBeans, 602 Service Locator pattern, 418 advantages, EJB access, 418 typed, accessing EJB using, 418 AbstractJndiLocator class, 419 afterPropertiesSet/located() methods, 419 getjndiName/Set/located () methods, 419 AbstractLocalStatelessSessionServiceLocator subclass, 422 bean definition, 422 BoxOfficeFactory interface, 421 LocalSLSBBoxOfficeFactory implementation class, 421 getBoxOffice() method, 422 setEjbHome() method, 421 transparent dynamic proxy as alternative to, 422 UML class diagram, 421 service() method, HttpServlet class, 669 Servlet 2.3 specification (SRV.9.11) class loading recommendations, 588 Java 1.3 extension mechanism, 589 web site, 30 Servlet Front strategy compared to JSP Front strategy, 454 Front Controller pattern, 454 ServletContext interface, javax.servlet package getRealPath() method, 698 ServletDispatcher class, webwork.dispatcher package, 464 <servlet-mapping> element configuring ControllerServlet class, 472 servlets compared to CGI, 443 data access, 276 Java web development, 443 limitations, 443 protecting interface code, 131 unit testing web tier components, 101 using JSP with servlets, 446 Front Controller pattern, 447 ServletUnit project web sites, 101 session beans accessing entity beans, 287 entity bean mediator, 291 errors, EJB handling, 379 EJB design/implementation guidelines, 380 SFSB (stateful session beans), 366 SLSB (stateless session beans), 364 session EJBs data access, 275 Session Facade design patterns implementing in distributed J2EE apps using SLSB, 374 RMI no. reduction, performance advantages, 374 implications of using EJB, 21 local interfaces, 223 principal, 287 Session Managed Persistence data access, 275 session management, web tier, 488 using browser, 490 cookies, 490 hidden form fields, 491 using J2EE server, 488 clustering and replication, 488 optimization, 489 SessionBean interface, javax.ejb, 413 all session beans implementing, 413 SessionContext class, EJBs, 94 SessionSynchronization interface, javax.ejb, 370 methods, 370 afterCompletion(), 370 SFSB (stateful session beans) implementing, 370 CMT use only, transaction attributes allowed, 371 design & security concerns, 371 setAttribute method, HttpSession object, 488 setDateHeader() method, HttpServletResponse interface, 668 setExceptionTranslater() method, JdbcTemplate class, 337 setFixture() method, AbstractTest class, 620 setHeader() method, HttpServletResponse interface, 468 setlgnoreWarnings() method, JdbcTemplate class, 337 setModel() method, ControllerContext interface, 462 setPropertyValue/~Values() methods, BeanWrapper, 398 example, 399 setRollbackOnly() method, EJBContext, 386 SEVERE log level constant, 163 SFSB (stateful session beans), 366 as MVC controllers, using, 373 NOT using, reasons for, 366 performance & scalability, SFSB passivation/reactivation, 366, 373 reliability, server state replication, 368 protecting from concurrent calls, 371 SessionSynchronization, implementing, 370 SLSB achieving stateful functionality, 371 using, circumstances when, 370 guidelines, 390 web containers preferred, sample app state holding, 389 short circuit evaluation avoiding NullPointerExceptions, 157 show reservation screen sample app user interface,, 192 SimpleDateFormat class, java.text package, java.text package, 539, 694 simplicity J2EE design, 675 Singleton design pattern, 139 BoxOffice/Calendar objects as singletons, disadavantages, 401 EJB problem, 222 using EJBs, 21 singletons context object, 140 EJB problem, 220-22 interfaces, 140 Java singletons, 220 JMX MBeans, 222 OO design principles summarized, 174 RMI objects, 221 startup classes, 222 stateless session beans pseudo-cache, 221 using app registry, 139 skills risk management, 68 SLSB (stateless session beans), 364, 371 benefits, 364 disadvantages, 364 EJB container managing SLSB pool, 364 reliable, avoiding server afinity, 364 EJB Command, implementing in distributed J2EE apps, 374 internal state, maintaining, 365 J2EE design, 678 pooling, 365 Session Facade, implementing in distributed J2EE apps, 374 stateful functionality, achieving, 371 object parameter, passing, 372 RequiredWorkflowException mimicking SFSB state machine, 372 smart model objects, 525 adapter beans, 526 SOAP (Simple Object Access Protocol) Apache Axis SOAP implementation web site, 19 J2EE design, 19 Source interface, javax.xml.transform package, 698 specification choosing app server, 48 determining version, 44 spike solution see performance. SpritCache caching product, 637 SQL (Structured Query language) EJB QL compared, 298 SQL Routines SQLJ structure, 313 SQL tag library see tag library, SQL. SQL Types SQLJ structure, 313 SQL-based database access, 312 JDBC (Java DataBase Connectivity), 312, 677 SQLJ. 313 SQLException class compared to DataAccessException class, 328 exception handling, 320 getErrorCode() method, 322 getNextException() method, 322 getSQLState() method, 322 limitations, 327 SQLExceptionTranslater Interface, 331 implemented by OracleSQLExceptionTranslater class, 332 implemented by SQLStateSQLExceptionTranslater class, 332 JDBC abstraction framework, 336 SqlFunction class JDBC abstraction framework, 346 run() method, 346 SQLJ advantages, 314 binding Java variables to SQL, 314 compared to JDBC, 313 disadvantages, 314 escaping in SQL, 314 example of using, 314 SQL-based database access, 313 structure Embedded SQL, 313 SQL Routines, 313 SQL Types, 313 SqlOperation class JDBC abstraction framework, 344 SqlParameter class, 344 SqlQuery class execute() method, 345, 357, 645 findObject() method, 345 JDBC abstraction framework, 344 newResultReader() method, 344 Template Method design pattern, 344 SQLStateSQLException Translater class class code, 332 converting JDBC exceptions to generic exceptions, 332 implements SQLException Translater interface, 332 SqlUpdate class JDBC abstraction framework, 347 performing updates, 350 update() method, 347, 350 SQLWarning class exception handling, 323 staging environment, 59
standalone clients state management, 26 startup classes singletons, 222 state distributed architecture, 205, 206, 207 internal state, SLSB maintaining, 365 management of state, 26 web tier session management, 488 maximizing reliability and scalability, 208 replication, 368 sample app holding, 389 web containers preferred to SFSBs, reasons, 389 stateless session beans pseudo-cache, 221, 365 stateful session beans see SFSB. StatefulSessionContext object, Oracle 9iAS, 369 SSFB replication imitating HttpSession behavior, 369 stateless session beans see SLSB. Statement interface, 323 compared to PreparedStatement interface, 323 JDBC (Java DataBase Connectivity), 323 unique key generation, 273 static attributes decoupling controllers and views, 519 template page inclusion, 575 static variables coding standards, 145 stored procedures, RDBMS, 259-62 StoredProcedure class CallableStatement interface and, 347, 351 calling stored procedures, 350, 358 JDBC abstraction framework, 347 Strategy design pattern, 119 advantages, 122 disadvantages, 122 extensibility, 120 JDBC abstraction framework, 334 MultiActionController class, 484 OO design principles summarized, 172 overriding methods, 154 protected instance variables, 150 Template Method pattern compared, 120 stress testing, 105 definition, 76 Microsoft's Web app Stress Tool, 107 web apps, 110 web interfaces, 107 StringTokenizer class, 81 Struts compared to Maverick, 461 compared to WebWork, 464 declarative exception handling, 461 description, 457 integrating web app into overall architecture, 465 JSP tag libraries, 459 nested properties, 460 limitations, 460 MVC web frameworks, 457 org.apache.struts.action package, 458 org.apache.struts.util package, 459 stub classes writing effective tests, 87 sub-classing abstract classes, 155 subscription durability MDBs, 232 when to use messaging, 233 superclasses accessing instance variables. 152 concrete inheritance, 115 exception handling, 131 exposing protected instance variables, 155 inheritance, 116 inversion of control, 117 making methods final, 154 public superclass methods, 117 subclass code compromising, 150 subclass interaction, 125 subclasses corrupting, 153 Supports transaction attribute, CMT, 382, 386 supports() method, Validator interface, 498 implementing, 499 surrogate keys, 270 Swing GUI libraries MVC (Model View Controller) pattern, 449 switch statements reflection, 133 synchronization caching, 245 code-level optimization, 641 EJB coding restrictions, 219 guidelines for using, 641 lock splitting, 642 sample app performance, 648 sessions, see SessionSynchronization. using EJBs, 23 syntactic data validation, 496 system exceptions, EJB handling, 380 discarding EJB instance, 380 logging exception, 380 RemoteException, 387 rolling back transaction irreversibly, 380 System.out logging usage, 161
Comments