Table of Contents
preface xvii
acknowledgments xxi
about the exam xxiii
about the exam simulator xxvii
about the cover illustration xxix
- Part 1 Enterprise JavaBeans 1
- 1 Introduction to J2EE 3
- 1.1 The J2EE architecture 4
- Bird's-eye view of the J2EE architecture 4
- Characteristics of the J2EE architecture 5
- J2EE platform containers 7
- 1.2 J2EE application system 8
- Using J2EE technologies for application development 9
- J2EE platform support for applications 10
- 1.3 The J2EE implementation 12
- J2EE implementation roles 12
- The J2EE reference implementation 14
- 1.4 The J2EE and EJB versions 14
- 1.5 Summary 14
- 2 Overview of Enterprise JavaBeans 16
- 2.1 Understanding the EJB architecture 17
- EJB architecture: The big picture 18
- Defining container requirements 20
- 2.2 Understanding the EJB components 21
- Characteristics of enterprise beans 22
- JavaBeans and Enterprise JavaBeans 23
- 2.3 Benefits of EJB technology 24
- Reduced time to market 24
- Cost effectiveness 24
- Reliability and robustness 25
- 2.4 Three flavors of enterprise beans 25
- Beans that handle synchronous communication: Entity beans and session beans 26
- Beans that handle asynchronous communication: Message-driven beans 27
- 2.5 Specifying EJB roles and responsibilities 28
- Enterprise bean provider 28
- Application assembler 29
- Bean deployer 29
- EJB server provider and container provider 30
- System administrator 31
- Overlap of roles 31
- 2.6 Programming the beans 32
- Coding the bean class 32
- Coding the bean interfaces 33
- Writing the deployment descriptor 36
- Programming restrictions 37
- 2.7 The EJB environment 39
- The bean's home in the environment: JNDI 39
- Deployment descriptor elements for the environment 40
- Required APIs and services 45
- 2.8 Packaging the beans into a JAR file 46
- 2.9 Lab exercise 46
- 2.10 Summary 47
- Part 2 Session beans 55
- 3 Client view of a session bean 57
- 3.1 Session beans in EJB land 58
- 3.2 Session bean remote home interface 59
- Required methods in the remote home interface 59
- The create and remove methods in the home interface 62
- 3.3 Session bean remote component interface 65
- Methods in the remote component interface 65
- Methods from the EJBObject interface 67
- Getting and using the remote component interface 69
- 3.4 Local interfaces 69
- Local interfaces and their methods 70
- Writing local interfaces 72
- 3.5 Using the client view 73
- Locating the home interface 73
- Accessing a session bean concurrently 75
- 3.6 Summary 76
- 4 Birth of a session bean 81
- 4.1 Introducing session beans 82
- 4.2 Implementing a session bean 84
- Implementing the methods from the client view 84
- Implementing methods from the SessionBean interface 86
- Putting it all together in code 88
- 4.3 Constructing and creating a session bean 90
- Creating a session bean instance 90
- The stateful session bean creation process 91
- The ejbCreate methods 92
- 4.4 Using the SessionContext interface 93
- 4.5 Operations permitted during bean creation 96
- Operations allowed during bean construction 96
- Operations permitted during bean creation 98
- 4.6 Responsibilities of the container 99
- 4.7 Summary 99
- 5 Lifecycle of a session bean 105
- 5.1 The stateful session bean lifecycle: An overview 106
- The does not exist state 106
- The method ready state 108
- The passive state 108
- 5.2 The stateless session bean lifecycle: To be or not to be 109
- 5.3 Into and out of a nap: Passivation and activation 111
- Implementing ejbPassivate() and ejbActivate() 111
- Permitted operations and access 112
- 5.4 Removing a session bean instance 114
- 5.5 Where the bean rocks: The business methods 116
- Implementation of business methods 116
- Operations from the business methods 117
- 5.6 Summary 118
- Part 3 Entity beans 123
- 6 Client view of an entity bean 125
- 6.1 Introducing entity beans 126
- The core functionality of an entity bean 127
- Entity, entity bean, and entity bean instance 129
- Characteristics of an entity bean 131
- 6.2 Entity bean remote home interface 131
- Required methods in the remote home interface 132
- Additional methods in the home interface 134
- 6.3 Entity bean remote component interface 138
- Methods in the remote component interface 138
- Getting and using the remote component interface 140
- 6.4 Local interfaces 141
- 6.5 Using the client view 142
- Locating the home interface 143
- Accessing an entity bean 144
- Accessing an entity bean concurrently 145
- 6.6 Summary 146
- 7 Birth of an entity bean 151
- 7.1 Here comes entity bean persistence 152
- Synchronizing entity and entity bean 153
- CMP and BMP entity beans 154
- 7.2 Implementing a CMP entity bean 155
- Implementing methods from the interfaces 155
- Methods for virtual persistent fields 159
- Putting it all together in code 160
- 7.3 Constructing an entity bean 163
- Constructing a bean instance 163
- Using the EntityContext interface 164
- Operations allowed during bean construction 166
- 7.4 Creating an entity bean 168
- CMP entity bean creation process 168
- Operations allowed during bean creation 171
- 7.5 Identifying entity beans 172
- Constructing the primary key 173
- Identifying entity beans with primary keys 174
- 7.6 Summary 175
- 8 Lifecycle of an entity bean
181
- 8.1 Entity bean lifecycle overview 182
- The does not exist state 182
- The pooled state: No strings attached 184
- The ready state: I'm yours until I go back to the pool 185
- 8.2 Finding a bean and doing a select 186
- The ejbFind methods 186
- The ejbSelect methods 187
- 8.3 Doing business from home 188
- Writing home business methods 189
- Using EntityContext: Communicating with the container 189
- 8.4 In and out of the pool 190
- Activating a bean instance 191
- Passivating a bean instance 192
- 8.5 Where the bean rocks: The ready state 193
- Implementation of business methods 193
- Operations from business methods 194
- Removing a bean instance 195
- 8.6 Summary 196
- 9 Entity bean relationships 202
- 9.1 Using beans to represent database tables 203
- Beans representing related tables 203
- Establishing a relationship between two entity beans 206
- 9.2 Container-managed relationships 207
- One-to-one relationships 207
- One-to-many relationships 208
- Many-to-many relationships 210
- 9.3 Managing persistence and relationships 211
- Container-managed persistent fields 212
- Container-managed relationship fields 214
- 9.4 Programming for CMP and CMR 217
- 9.5 Relationships and remove protocols 221
- 9.6 Summary 221
- 10 EJB query language 227
- 10.1 The role of EJB QL in persistence 228
- Pieces of the persistence puzzle 228
- From abstract schema to database table 229
- 10.2 Abstract schema and query syntax 231
- EJB QL syntax and definitions 231
- Handling the query return types 232
- 10.3 Query domains and navigation 233
- Navigating the path 233
- Dealing with Collections in path navigation 234
- 10.4 Identifiers and input parameters 235
- Identifiers 235
- Input parameters 236
- 10.5 Operators and expressions 237
- Operators 237
- Expressions 238
- 10.6 Summary 239
- Part 4 Message-driven beans 245
- 11 Message-driven beans 247
- 11.1 Using message-driven beans for asynchronous communication 248
- Message-driven bean: A JMS message consumer 249
- Client view of an MDB 250
- 11.2 Implementing a message-driven bean 251
- Writing an MDB class 251
- Requirements for an MDB class 253
- 11.3 The lifecycle of a message-driven bean 254
- States of the lifecycle 254
- Using the MessageDrivenContext interface 256
- 11.4 The message destination types 258
- The Queue destination 258
- The Topic destination 258
- 11.5 Summary 259
- Part 5 EJB services 265
- 12 EJB transactions 267
- 12.1 Understanding transactions 268
- Defining transactions 268
- Distributed transactions 270
- 12.2 Implementing EJB transactions 270
- Interfaces for transactions 271
- Using bean-managed transactions demarcation 272
- Using container-managed transaction demarcation 274
- 12.3 Transaction attributes 274
- Defining transaction attributes 275
- Transaction attributes in action 278
- Using transaction attributes 279
- Transaction attributes used by beans 281
- 12.4 Specifying transactions in a deployment descriptor 282
- Specifying the transaction type for a bean 282
- Specifying the transaction attribute for a bean method 282
- 12.5 Transaction synchronization 284
- 12.6 Summary 286
- 13 EJB exceptions 292
- 13.1 Exceptions in Java 293
- The exceptions tree in Java 293
- Checked exceptions and runtime exceptions 294
- 13.2 Exceptions in EJB 295
- Standard EJB application exceptions 295
- Standard EJB system exceptions 298
- 13.3 Bean provider's responsibilities 301
- Dealing with application exceptions 301
- Dealing with system exceptions 303
- 13.4 Container's responsibilities 304
- Application exceptions 304
- System exceptions 304
- 13.5 Summary 305
- 14 EJB security 310
- 14.1 Implementing security in EJB 311
- Understanding basic security concepts 311
- Security in EJB 312
- 14.2 Defining the security roles 313
- 14.3 Defining method permissions 314
- Granting permission to all methods 314
- Granting permission method by method 315
- Distinguishing between overloaded methods 316
- Distinguishing between interfaces 316
- 14.4 Controlling the propagating security identity 317
- 14.5 Disabling methods 319
- 14.6 Programming security 319
- Limitations of declarative security 319
- Implementing programmatic security 320
- References to security roles 321
- 14.7 Responsibilities in implementing EJB security 322
- Implementing EJB security 322
- Deploying EJB security 323
- 14.8 Summary 324
- A Installing and running RI J2SDKEE 1.3 329
- B An introduction to XML 344
- C A sample deployment descriptor file 355
- D Review questions and answers 359
- E Exam Quick Prep 404
-
index 447