List of Listings

Chapter 2: Fundamentals

Listing 2-1: Example of a JavaBean.

Chapter 3: The Architecture of Enterprise JavaBeans

Listing 3-1: Remote interface of BankAccount.
Listing 3-2: The home interface of BankAccount.
Listing 3-3: Bean class of BankAccount.
Listing 3-4: Example of a primary key class for multipart keys.
Listing 3-5: Deployment descriptor of BankAccount.
Listing 3-6: Example of mapping instructions for the persistence manager.
Listing 3-7: Finding the home interface using JNDI.

Chapter 4: Session Beans

Listing 4-1: getInitialContext: Initialization for JNDI access.
Listing 4-2: Client access to a session bean (remote client view).
Listing 4-3: Client access to a session bean (local client view).
Listing 4-4: Comparison of identities of stateful session beans.
Listing 4-5: Comparison of identities of stateless session beans.
Listing 4-6: Use of a remote handle.
Listing 4-7: Schematic deployment descriptor with the definition of an environment variable.
Listing 4-8: Schematic of selected environment variables.
Listing 4-9: Schematic deployment descriptor with reference to another bean (remote interface).
Listing 4-10: Schematic deployment descriptor with reference to another bean (local interface).
Listing 4-11: Schematic use of reference to another bean.
Listing 4-12: Schematic deployment descriptor with reference to a JDBC database.
Listing 4-13: Mapping the logical name to the JNDI name of the resource.
Listing 4-14: Schematic use of a reference to a JDBC database.
Listing 4-15: Use of a reference to administered objects.
Listing 4-16: The home interface of the stateless session bean EuroExchangeSL.
Listing 4-17: Remote interface of the stateless session bean EuroExchangeSL.
Listing 4-18: SQL commands for the exchange rate table.
Listing 4-19: Class definition for EuroExchangeBean.
Listing 4-20: EuroExchangeBean.ejbCreate().
Listing 4-21: EuroExchangeBean.ejbRemove().
Listing 4-22: Methods for state management.
Listing 4-23: EuroExchangeBean.changeFromEuro(...).
Listing 4-24: EuroExchangeBean.setExchangeRate(...).
Listing 4-25: Deployment descriptor for the session bean EuroExchangeSL.
Listing 4-26: Definitions for the deployment of an EJB container.
Listing 4-27: Client program for the session bean EuroExchangeSL.

Chapter 5: Entity Beans

Listing 5-1: Schematic deployment descriptor for an entity bean.
Listing 5-2: Definition of an attribute of an entity bean in the deployment descriptor.
Listing 5-3: Access methods for an attribute of an entity bean.
Listing 5-4: Imaginary example of a home interface with find methods.
Listing 5-5: EJB-QL for the method findByAttributeA
Listing 5-6: Pseudocode for the bean class of a select method.
Listing 5-7: EJB-QL for the bean's select methods.
Listing 5-8: Remote interface of the counter bean.
Listing 5-9: Exception CounterOverflowException.
Listing 5-10: Home interface of the counter bean.
Listing 5-11: Bean class of the counter bean.
Listing 5-12: Deployment descriptor of the counter bean.
Listing 5-13: Imaginary database mapping for the counter bean.
Listing 5-14: SQL statement for generating the table counter.
Listing 5-15: Imaginary example of a client of the counter bean.
Listing 5-16: Abstract relationship methods for an automobile bean.
Listing 5-17: Formal description of the relationship Automobile-Customer (unidirectional).
Listing 5-18: Mapping of the Automobile-Customer relationship to the database.
Listing 5-19: Abstract relationship methods of the customer bean.
Listing 5-20: Formal description of the relationship Automobile-Customer (bidirectional).
Listing 5-21: Abstract relationship methods of the department bean.
Listing 5-22: Formal description of the relationship DepartmentEmployee (unidirectional).
Listing 5-23: Mapping of the Department-Employee relationship to the database.
Listing 5-24: Setting relationships using the method setEmployee().
Listing 5-25: Adding relationships using the method Collection.add().
Listing 5-26: Navigation over the cardinality n to the department bean.
Listing 5-27: Deleting a relationship to the department bean of cardinality n.
Listing 5-28: Abstract relationship methods of the employee bean.
Listing 5-29: Formal description of the relationship Department-Employee (bidirectional).
Listing 5-30: Abstract relationship methods of the product bean.
Listing 5-31: Formal description of the relationship Product-Optionalpart (unidirectional).
Listing 5-32: Mapping of the Product-Optionalpart relationship to the database.
Listing 5-33: Abstract relationship methods of the product part bean.
Listing 5-34: Formal description of the relationship Product-Optionalpart (bidirectional).
Listing 5-35: Declaration of a cascading delete.
Listing 5-36: EJB-QL example for the entity bean Person.
Listing 5-37: Simple EJB-QL query for findAllPersons.
Listing 5-38: EJB-QL query for findByFirstname.
Listing 5-39: EJB-QL query for ejbSelectNamesInCity.
Listing 5-40: EJB-QL and persistent relationships.
Listing 5-41: Use of the IN operator.
Listing 5-42: The container class Rack.
Listing 5-43: Home interface of the Store bean.
Listing 5-44: Remote interface of the store bean.
Listing 5-45: Deployment descriptor for warehouse management.
Listing 5-46: Persistent attributes of an EJB 1.1 entity bean.
Listing 5-47: Deployment descriptor of an EJB 1.1 entity bean.
Listing 5-48: Remote interface of the counter bean (BMP).
Listing 5-49: Home interface of the counter bean (BMP).
Listing 5-50: Bean class of the counter bean (BMP).
Listing 5-51: Deployment descriptor of the counter bean (BMP).

Chapter 6: Message-Driven Beans

Listing 6-1: Sending a text message.
Listing 6-2: Example of a session pool.
Listing 6-3: Use of a session pool.
Listing 6-4: Fetching a message.
Listing 6-5: Receiving a message.
Listing 6-6: Implementation of MessageListener.onMessage().
Listing 6-7: Generation of a server session pool.
Listing 6-8: Receiver class of the server session pool.
Listing 6-9: Generation of a transactional session.
Example 1
Example 2
Listing 6-10: Request-reply with the class QueueRequestor.
Listing 6-11: A JMS client's answer to a message.
Listing 6-12: Example of a message-driven bean.
Listing 6-13: Deployment descriptor of a message-driven bean.
Listing 6-14: Example of a client of a message-driven bean.

Chapter 7: Transactions

Listing 7-1: StockHome: the home interface of the entity bean Stock.
Listing 7-2: Stock: the remote interface of the entity bean Stock.
Listing 7-3: Database design for the entity bean Stock.
Listing 7-4: StockBean.get: this method reduces the amount in storage.
Listing 7-5: Portion of the deployment descriptor of the entity bean Stock.
Listing 7-6: ProducerHome: home interface of the session bean Producer.
Listing 7-7: Producer: remote interface of the session bean Producer.
Listing 7-8: ProducerBean: class definition.
Listing 7-9: Initialization of ProducerBean.
Listing 7-10: ProducerBean.setSessionContext: setting the session context.
Listing 7-11: ProducerBean.produce: Business logic of the session bean Producer.
Listing 7-12: Extract from the deployment descriptor of the session bean producer.
Listing 7-13: A section of the test for the session bean Producer.
Listing 7-14: Definition of the interface javax.ejb.SessionSynchronization.
Listing 7-15: Client transactions: access to JTA.
Listing 7-16: Client transactions: initialization of three instances of the entity bean Stock.
Listing 7-17: Client transactions: program segment that executes production.
Listing 7-18: Client transactions: client output at run time.
Listing 7-19: Deployment descriptor of the session bean Migration.
Listing 7-20: Home interface of the session bean Migration.
Listing 7-21: Remote interface of the session bean Migration.
Listing 7-22: Bean class of the session bean Migration.

Chapter 8: Security

Listing 8-1: Sample user definition for an application server.
Listing 8-2: Definition of user roles in the deployment descriptor.
Listing 8-3: Definition of access rights for methods in the deployment descriptor.
Listing 8-4: Sample assignment of roles to users and groups.
Listing 8-5: Sample alternative assignment of roles to groups.
Listing 8-6: Use of the attribute unchecked in the assembly descriptor.
Listing 8-7: Definition of role references in the deployment descriptor.
Listing 8-8: Bean method for access protection.
Listing 8-9: Assignment of role references to roles in the deployment descriptor.
Listing 8-10: Definition of a user context for a bean.
Listing 8-11: Defining the user role Special.

Chapter 9: Practical Applications

Listing 9-1: Client code for currency conversion.
Listing 9-2: Example of a traditional client.
Listing 9-3: Example of a traditional session bean implementation.
Listing 9-4: Example of a traditional deployment descriptor.
Listing 9-5: Example: deployment descriptor with framework.
Listing 9-6: Example: session bean with framework.
Listing 9-7: Example: factory interface implementation.
Listing 9-8: Example: interface implementation.
Listing 9-9: Class EJBevent.
Listing 9-10: The interface EJBEventListener.
Listing 9-11: The class EJBEventHelper.
Listing 9-12: The class EJBEventManager.
Listing 9-13: Class EJBEventManager client.
Listing 9-14: Interface PartHome.
Listing 9-15: Interface Part.
Listing 9-16: Class PartDetails.
Listing 9-17: Class PartBean.
Listing 9-18: Class TsPartDetails.
Listing 9-19: Changed interface Part.
Listing 9-20: Changed class PartBean.
Listing 9-21: Deployment descriptor of the Part bean.
Listing 9-22: Cloning in set/getPartDetails.
Listing 9-23: PartDetails read-only.
Listing 9-24: The class EJBTestCase.
Listing 9-25: The class EJBTest.
Listing 9-26: Properties for the class EJBTest.
Listing 9-27: The class TestPartBean.
Listing 9-28: Class PartBean with logging output.
Listing 9-29: Logging output of the class PartBean.

Chapter 10: Web Services and Scheduling

Listing 10-1: XML-RPC representation of a method call.
Listing 10-2: XML-RPC representation of a method call result.
Listing 10-3: Web service interface for the EuroExchange EJB.
Listing 10-4: Using interface inheritance to create web service and EJB endpoints.
Listing 10-5: Deployment descriptor for a web service endpoint.
Listing 10-6: The WSDL file for the EuroExchange Service.
Listing 10-7: EJB deployment descriptor with service reference.
Listing 10-8: EJB as a client to a web service.
Listing 10-9: The javax.ejb.TimedObject interface.
Listing 10-10: Remote interface of the Payroll EJB.
Listing 10-11: Home interface of the Payroll EJB.
Listing 10-12: Bean implementation of the Payroll EJB.
Listing 10-13: Deployment descriptor of the Payroll EJB.



Enterprise JavaBeans 2.1
Enterprise JavaBeans 2.1
ISBN: 1590590880
EAN: 2147483647
Year: 2006
Pages: 103

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net