Enterprise JavaBeans 3.1. Developing Enterprise Java Components. 6th Edition - Helion
ISBN: 978-14-493-9696-1
stron: 766, Format: ebook
Data wydania: 2010-09-08
Księgarnia: Helion
Cena książki: 169,14 zł (poprzednio: 198,99 zł)
Oszczędzasz: 15% (-29,85 zł)
Learn how to code, package, deploy, and test functional Enterprise JavaBeans with the latest edition of this bestselling guide. Written by the developers of JBoss EJB 3.1, this book not only brings you up to speed on each component type and container service in this implementation, it also provides a workbook with several hands-on examples to help you gain immediate experience with these components.
With version 3.1, EJB's server-side component model for building distributed business applications is simpler than ever. But it's still a complex technology that requires study and lots of practice to master. Enterprise JavaBeans 3.1 is the most complete reference on this specification. You'll find a straightforward, no-nonsense explanation of the underlying technology, including Java classes and interfaces, the component model, and the runtime behavior of EJB.
- Develop your first EJBs with a hands-on walkthrough of EJB 3.1 concepts
- Learn how to encapsulate business logic with Session Beans and Message-Driven Beans
- Discover how to handle persistence through Entity Beans, the EntityManager, and the Java Persistence API
- Understand EJB's container services such as dependency injection, concurrency, and interceptors
- Integrate EJB with other technologies in the Java Enterprise Edition platform
- Use examples with either the JBossAS, OpenEJB, or GlassFish v3 EJB Containers
Osoby które kupowały "Enterprise JavaBeans 3.1. Developing Enterprise Java Components. 6th Edition", wybierały także:
- Wprowadzenie do Javy. Programowanie i struktury danych. Wydanie XII 193,23 zł, (59,90 zł -69%)
- Spring i Spring Boot. Kurs video. Testowanie aplikacji i bezpiecze 129,00 zł, (51,60 zł -60%)
- Metoda dziel i zwyci 89,00 zł, (35,60 zł -60%)
- JavaFX. Kurs video. Wzorce oraz typy generyczne 79,00 zł, (31,60 zł -60%)
- Platforma Xamarin. Kurs video. Poziom drugi. Zaawansowane techniki tworzenia aplikacji cross-platform 99,00 zł, (39,60 zł -60%)
Spis treści
Enterprise JavaBeans 3.1. Developing Enterprise Java Components. 6th Edition eBook -- spis treści
- Enterprise JavaBeans 3.1
- SPECIAL OFFER: Upgrade this ebook with OReilly
- Preface
- Authors Note
- Who Should Read This Book
- How This Book Is Organized
- Part I
- Part II
- Part III
- Part IV
- Part V
- Software and Versions
- Conventions Used in This Book
- Using Code Examples
- Safari Books Online
- Comments and Questions
- Acknowledgments
- I. Why Enterprise JavaBeans?
- 1. Introduction
- The Problem Domain
- Breaking Up Responsibilities
- Core concerns
- Cross-cutting concerns
- Plumbing
- Code Smart, Not Hard
- Do less
- The Container
- The Enterprise JavaBeans 3.1 Specification
- EJB defined
- Review
- Breaking Up Responsibilities
- The Problem Domain
- 2. Component Types
- Server-Side Component Types
- Session Beans
- Stateless session beans (SLSBs)
- Stateful session beans (SFSBs)
- Singleton beans
- Message-Driven Beans (MDBs)
- Session Beans
- Entity Beans
- The Java Persistence Model
- The Model Isnt Everything
- Server-Side Component Types
- 3. Container Services
- Dependency Injection (DI)
- Concurrency
- Instance Pooling/Caching
- Transactions
- Security
- Timers
- Naming and Object Stores
- Interoperability
- Lifecycle Callbacks
- Interceptors
- Platform Integration
- Bringing It Together
- 4. Developing Your First EJBs
- Step 1: Preparation
- Definitions
- Bean implementation class (session and message-driven beans)
- Bean instance (session and message-driven beans)
- Client view (session and message-driven beans)
- EJB Proxy (session beans)
- Local versus remote (session beans)
- Business interface (session beans)
- Component interface (session beans)
- Home interface (session beans)
- Endpoint interface (session beans)
- Message interface (MDBs)
- Naming Conventions
- Common business name
- Conventions for the Examples
- Definitions
- Step 2: Coding the EJB
- The Contract
- The Bean Implementation Class
- Out-of-Container Testing
- Integration Testing
- Packaging
- Deployment into the Container
- The client
- Summary
- Step 1: Preparation
- 1. Introduction
- II. Server-Side Component Models
- 5. The Stateless Session Bean
- The XML Deployment Descriptor
- SessionContext
- EJBContext
- The Lifecycle of a Stateless Session Bean
- The Does Not Exist State
- The Method-Ready Pool
- Transitioning to the Method-Ready Pool
- Life in the Method-Ready Pool
- Transitioning out of the Method-Ready Pool: The death of a stateless bean instance
- Example: The EncryptionEJB
- The Contract: Business Interfaces
- Application Exceptions
- Bean Implementation Class
- Accessing Environment Properties (Injection and Lookup)
- Asynchronous Methods
- 6. The Stateful Session Bean
- The Lifecycle of a Stateful Session Bean
- The Does Not Exist State
- The Method-Ready State
- Transitioning into the Method-Ready state
- Life in the Method-Ready state
- Transitioning out of the Method-Ready state
- The Passivated State
- System exceptions
- Example: The FileTransferEJB
- The Contract: Business Interfaces
- Exceptions
- Bean Implementation Class
- POJO Testing Outside the Container
- Integration Testing
- The Lifecycle of a Stateful Session Bean
- 7. The Singleton Session Bean
- Concurrency
- Shared Mutable Access
- Container-Managed Concurrency
- Bean-Managed Concurrency
- Lifecycle
- Explicit Startup
- Example: The RSSCacheEJB
- Value Objects
- The Contract: Business Interfaces
- Bean Implementation Class
- Concurrency
- 8. Message-Driven Beans
- JMS and Message-Driven Beans
- JMS as a Resource
- JMS Is Asynchronous
- JMS Messaging Models
- Publish-and-subscribe
- Point-to-point
- Which messaging model should you use?
- Learning More About JMS
- JMS-Based Message-Driven Beans
- @MessageDriven
- @ActivationConfigProperty
- Message selector
- Acknowledge mode
- Subscription durability
- MessageDrivenContext
- MessageListener interface
- Taskflow and integration for B2B: onMessage()
- Sending messages from a message-driven bean
- @MessageDriven
- The Lifecycle of a Message-Driven Bean
- The Does Not Exist State
- The Method-Ready Pool
- Transitioning to the Method-Ready Pool
- Life in the Method-Ready Pool
- Transitioning out of the Method-Ready Pool: The death of an MDB instance
- Connector-Based Message-Driven Beans
- Message Linking
- Session Beans Should Not Receive Messages
- The JMS APIs
- TopicConnectionFactory and Topic
- Connection and Session
- MessageProducer
- Message types
- Example: The StatusUpdateEJBs
- JMS application client: Message producer
- Create a base listener
- Further testing
- JMS and Message-Driven Beans
- 5. The Stateless Session Bean
- III. EJB and Persistence
- 9. Persistence: EntityManager
- Entities Are POJOs
- Managed Versus Unmanaged Entities
- Persistence Context
- Transaction-scoped persistence context
- Extended persistence context
- Detached entities
- Persistence Context
- Packaging a Persistence Unit
- The Persistence Unit Class Set
- Obtaining an EntityManager
- EntityManagerFactory
- Getting an EntityManagerFactory in Java EE
- Obtaining a Persistence Context
- EntityManagerFactory
- Interacting with an EntityManager
- Example: A Persistent Employee Registry
- A Transactional Abstraction
- Persisting Entities
- Finding and Updating Entities
- find() and getReference()
- merge()
- Queries
- Removing Entities
- refresh()
- contains() and clear()
- flush() and FlushModeType
- Locking
- unwrap() and getDelegate()
- 10. Mapping Persistent Objects
- The Programming Model
- The Employee Entity
- The Bean Class
- XML Mapping File
- Basic Relational Mapping
- Elementary Schema Mappings
- @Table
- @Column
- Elementary Schema Mappings
- Primary Keys
- @Id
- Table Generators
- Sequence Generators
- Primary-Key Classes and Composite Keys
- @IdClass
- @EmbeddedId
- Property Mappings
- @Transient
- @Basic and FetchType
- @Lob
- @Temporal
- @Enumerated
- @Embedded Objects
- The Programming Model
- 11. Entity Relationships
- The Seven Relationship Types
- One-to-One Unidirectional Relationship
- Relational database schema
- Programming model
- Primary-key join columns
- Default relationship mapping
- One-to-One Bidirectional Relationship
- Relational database schema
- One-to-Many Unidirectional Relationship
- Relational database schema
- Programming model
- Many-to-One Unidirectional Relationship
- Relational database schema
- Programming model
- One-to-Many Bidirectional Relationship
- Relational database schema
- Programming model
- Usage
- Many-to-Many Bidirectional Relationship
- Relational database schema
- Programming model
- Many-to-Many Unidirectional Relationship
- Relational database schema
- Programming model
- One-to-One Unidirectional Relationship
- Mapping Collection-Based Relationships
- Ordered List-Based Relationship
- Map-Based Relationship
- Detached Entities and FetchType
- Cascading
- PERSIST
- MERGE
- REMOVE
- REFRESH
- ALL
- When to Use Cascading
- The Seven Relationship Types
- 12. Entity Inheritance
- Single Table per Class Hierarchy
- Advantages
- Disadvantages
- Table per Concrete Class
- Advantages
- Disadvantages
- Table per Subclass
- Advantages
- Disadvantages
- Mixing Strategies
- Nonentity Base Classes
- Single Table per Class Hierarchy
- 13. Queries, the Criteria API, and JPA QL
- Query API
- Parameters
- Date Parameters
- Paging Results
- Hints
- FlushMode
- JPA QL
- Abstract Schema Names
- Simple Queries
- Selecting Entity and Relationship Properties
- Constructor Expressions
- The IN Operator and INNER JOIN
- LEFT JOIN
- Fetch Joins
- Using DISTINCT
- The WHERE Clause and Literals
- The WHERE Clause and Operator Precedence
- The WHERE Clause and Arithmetic Operators
- The WHERE Clause and Logical Operators
- The WHERE Clause and Comparison Symbols
- The WHERE Clause and Equality Semantics
- The WHERE Clause and BETWEEN
- The WHERE Clause and IN
- The WHERE Clause and IS NULL
- The WHERE Clause and IS EMPTY
- The WHERE Clause and MEMBER OF
- The WHERE Clause and LIKE
- Functional Expressions
- Functional expressions in the WHERE clause
- Functions returning dates and times
- Aggregate functions in the SELECT clause
- COUNT (identifier or path expression)
- MAX( path expression), MIN( path expression)
- AVG( numeric ), SUM( numeric)
- DISTINCT, nulls, and empty arguments
- The ORDER BY Clause
- Bulk UPDATE and DELETE
- Native Queries
- Scalar Native Queries
- Simple Entity Native Queries
- Complex Native Queries
- Native queries with multiple entities
- Named Queries
- Named Native Queries
- Query API
- 14. Entity Callbacks and Listeners
- Callback Events
- Callbacks on Entity Classes
- Entity Listeners
- Default Entity Listeners
- Inheritance and Listeners
- 9. Persistence: EntityManager
- IV. Container Services
- 15. Security
- Authentication and Identity
- Authorization
- Example: A Secured School
- The Business Interface
- Assigning Method Permissions
- Programmatic Security
- The RunAs Security Identity
- 16. JNDI, the ENC, and Injection
- Global JNDI
- The JNDI ENC
- What Can Be Registered in the JNDI ENC?
- How Is the JNDI ENC Populated?
- XML population
- Annotation population
- How Are Things Referenced from the ENC?
- Using EJBContext
- Annotation injection
- Default ENC name
- XML injection
- XML overrides
- Injection and inheritance
- Reference and Injection Types
- EJB References
- @javax.ejb.EJB
- Ambiguous and overloaded EJB names
- Resolving EJB references
- EntityManagerFactory References
- @javax.persistence.PersistenceUnit
- XML-based EntityManagerFactory references
- Scoped and overloaded unit names
- EntityManager References
- @javax.persistence.PersistenceContext
- Resource References
- @javax.annotation.Resource
- Shareable resources
- Resource Environment and Administered Objects
- Environment Entries
- Message Destination References
- XML-based resource references
- Using @Resource
- EJB References
- 17. Transactions
- ACID Transactions
- Example: The BlackjackEJB
- Helper EJBs for Testing Transactions
- Is the BlackjackEJB Atomic?
- Is the BlackjackEJB Consistent?
- Is the BlackjackEJB Isolated?
- Is the BlackjackEJB Durable?
- Declarative Transaction Management
- Transaction Scope
- Transaction Attributes
- Using the @TransactionAttribute annotation
- Transaction attributes defined
- EJB 3.0 persistence and transaction attributes
- Message-driven beans and transaction attributes
- EJB endpoints and transaction attributes
- Transaction Propagation
- Transactions and persistence context propagation
- Isolation and Database Locking
- Dirty, Repeatable, and Phantom Reads
- Dirty reads
- Repeatable reads
- Phantom reads
- Database Locks
- Transaction Isolation Levels
- Balancing Performance Against Consistency
- Controlling isolation levels
- Optimistic Locking
- Programmatic Locking
- Dirty, Repeatable, and Phantom Reads
- Nontransactional EJBs
- Explicit Transaction Management
- Transaction Propagation in Bean-Managed Transactions
- Message-driven beans and bean-managed transactions
- Heuristic Decisions
- UserTransaction
- Status
- EJBContext Rollback Methods
- Transaction Propagation in Bean-Managed Transactions
- Exceptions and Transactions
- Application Exceptions Versus System Exceptions
- System exceptions
- Application exceptions
- Application Exceptions Versus System Exceptions
- Transactional Stateful Session Beans
- The Transactional Method-Ready State
- Transitioning into the Transactional Method-Ready state
- Life in the Transactional Method-Ready state
- The Transactional Method-Ready State
- Conversational Persistence Contexts
- ACID Transactions
- 18. Interceptors
- Intercepting Methods
- Interceptor Class
- Applying Interceptors
- Annotated methods and classes
- Applying interceptors through XML
- Default interceptors
- Disabling interceptors
- Interceptors and Injection
- Intercepting Lifecycle Events
- Custom Injection Annotations
- Exception Handling
- Aborting a Method Invocation
- Catch and Rethrow Exceptions
- Interceptor Lifecycle
- Bean Class @AroundInvoke Methods
- Intercepting Methods
- 19. Timer Service
- Example: A Batch Credit Card Processing System
- The Business Interface
- javax.ejb.ScheduleExpression and @javax.ejb.Schedule
- The Bean Implementation Class
- The TimerService
- The Timer
- Canceling timers
- Identifying timers
- Retrieving other information from timers
- The TimerHandle object
- Exceptions
- Transactions
- Stateless Session Bean Timers
- Message-Driven Bean Timers
- Example: A Batch Credit Card Processing System
- 20. EJB 3.1: Web Services Standards
- Web Services Overview
- XML Schema and XML Namespaces
- XML Schema
- XML Namespaces
- SOAP 1.1
- Web Services Styles
- Exchanging SOAP Messages with HTTP
- Now You See It, Now You Dont
- WSDL 1.1
- The <definitions> Element
- The <portType> and <message> Elements
- The <types> Element
- The <binding> and <service> Elements
- UDDI 2.0
- From Standards to Implementation
- 21. EJB 3.1 and Web Services
- Accessing Web Services with JAX-RPC
- Generating JAX-RPC Artifacts from WSDL
- Calling a Service from an EJB
- The <service-ref> Deployment Element
- The JAX-RPC Mapping File
- Defining a Web Service with JAX-RPC
- The WSDL Document
- The Service Endpoint Interface
- The Stateless Bean Class
- The Deployment Files
- The WSDL file
- The JAX-RPC mapping file
- The webservices.xml file
- Using JAX-WS
- The @WebService Annotation
- The @WebMethod Annotation
- The @SOAPBinding Annotation
- The @WebParam Annotation
- The @WebResult Annotation
- The @OneWay Annotation
- Separating the Web Services Contract
- The Service Class
- The Service Endpoint Interface
- The @WebServiceRef Annotation
- Other Annotations and APIs
- JAXB
- Taking JAXB Further
- Conclusion
- Accessing Web Services with JAX-RPC
- 15. Security
- V. Examples
- A. FirstEJB Example
- Description
- Online Companion Information
- Source Listing
- Implementation Resources
- CalculatorBeanBase.java
- CalculatorCommonBusiness.java
- CalculatorLocal.java
- CalculatorLocalBusiness.java
- CalculatorLocalHome.java
- CalculatorRemote.java
- CalculatorRemoteBusiness.java
- CalculatorRemoteHome.java
- ManyViewCalculatorBean.java
- NoInterfaceViewCalculatorBean.java
- SimpleCalculatorBean.java
- Test Resources
- CalculatorAssertionDelegate.java
- CalculatorIntegrationTestCase.java
- CalculatorUnitTestCase.java
- MultiViewCalculatorIntegrationTestCase.java
- jndi.properties
- Implementation Resources
- B. Stateless Session EJB: Encryption Example
- Description
- Online Companion Information
- Source Listing
- Implementation Resources
- EncryptionBean.java
- EncryptionCommonBusiness.java
- EncryptionException.java
- EncryptionLocalBusiness.java
- EncryptionRemoteBusiness.java
- META-INF/ejb-jar.xml
- Test Resources
- EncryptionIntegrationTestCase.java
- EncryptionTestCaseSupport.java
- EncryptionUnitTestCase.java
- Implementation Resources
- C. Stateful Session EJB: FTP Client Example
- Description
- Online Companion Information
- Source Listing
- Implementation Resources
- FileTransferBean.java
- EncryptionBean.java
- EncryptionCommonBusiness.java
- EncryptionException.java
- EncryptionLocalBusiness.java
- EncryptionRemoteBusiness.java
- META-INF/ejb-jar.xml
- Test Resources
- EncryptionIntegrationTestCase.java
- EncryptionTestCaseSupport.java
- EncryptionUnitTestCase.java
- FileTransferCommonBusiness.java
- FileTransferException.java
- FileTransferRemoteBusiness.java
- Test Resources
- FileTransferIntegrationTestCase.java
- FileTransferTestCaseBase.java
- FileTransferUnitTestCase.java
- FtpServerPojo.java
- ftpusers.properties
- Implementation Resources
- D. Singleton Session EJB: RSS Cache Example
- Description
- Online Companion Information
- Source Listing
- Implementation Resources
- ProtectExportUtil.java
- RomeRssEntry.java
- RssCacheBean.java
- RssCacheCommonBusiness.java
- RssEntry.java
- Test Resources
- RssCacheTestCaseBase.java
- RssCacheUnitTestCase.java
- TestRssCacheBean.java
- jndi.properties
- Implementation Resources
- E. Message-Driven EJB: Status Update Listeners Example
- Description
- Online Companion Information
- Source Listing
- Implementation Resources
- StatusUpdate.java
- StatusUpdateConstants.java
- EnvironmentSpecificTwitterUtil.java
- LoggingStatusUpdateMdb.java
- SecurityActions.java
- StatusUpdateBeanBase.java
- TwitterUpdateMdb.java
- hornetq-jms.xml
- Test Resources
- MockObjectMessage.java
- StatusUpdateIntegrationTest.java
- StatusUpdateTestBase.java
- StatusUpdateUnitTestCase.java
- TwitterUpdateBlockingTestMdb.java
- Implementation Resources
- F. Java Persistence APIs: Employee Registry Example
- Description
- Online Companion Information
- Source Listing
- Implementation Resources
- SimpleEmployee.java
- EmbeddedEmployeePK.java
- EmployeeType.java
- EmployeeWithEmbeddedPK.java
- EmployeeWithExternalCompositePK.java
- EmployeeWithMappedSuperClassId.java
- EmployeeWithProperties.java
- ExternalEmployeePK.java
- Address.java
- Computer.java
- Customer.java
- Employee.java
- Phone.java
- PhoneType.java
- Task.java
- Team.java
- Customer.java
- Employee.java
- Person.java
- Customer.java
- Employee.java
- Person.java
- Customer.java
- Employee.java
- Person.java
- EntityListenerEmployee.java
- EventTracker.java
- persistence.xml
- Test Resources
- EmployeeIntegrationTest.java
- Implementation Resources
- G. Security: Secured School Example
- Description
- Online Companion Information
- Source Listing
- Implementation Resources
- FireDepartmentLocalBusiness.java
- SchoolClosedException.java
- SecureSchoolLocalBusiness.java
- FileDepartmentBean.java
- Roles.java
- SecureSchoolBean.java
- Test Resources
- SecureSchoolIntegrationTest.java
- groups.properties
- users.properties
- Implementation Resources
- H. Transactions: Blackjack Game Example
- Description
- Online Companion Information
- Source Listing
- Implementation Resources
- BankLocalBusiness.java
- BlackjackGameLocalBusiness.java
- InsufficientBalanceException.java
- Account.java
- User.java
- BankBean.java
- BlackjackGameBean.java
- BlackjackServiceConstants.java
- persistence.xml
- Test Resources
- TransactionalBlackjackGameIntegrationTest.java
- DbInitializerBean.java
- ExampleUserData.java
- Implementation Resources
- I. Interceptors: TV Channel Service Example
- Description
- Online Companion Information
- Source Listing
- Implementation Resources
- AuditedInvocation.java
- CachingAuditor.java
- Channel2AccessPolicy.java
- Channel2ClosedException.java
- Channel2Restrictor.java
- TunerBean.java
- TunerLocalBusiness.java
- Test Resources
- CachingInterceptorUnitTestCase.java
- Channel2RestrictorUnitTestCase.java
- InterceptorIntegrationTest.java
- MockInvocationContext.java
- SecurityActions.java
- Implementation Resources
- J. Timer Service: Credit Card Processor Example
- Description
- Online Companion Information
- Source Listing
- Implementation Resources
- CreditCardTransaction.java
- CreditCardTransactionProcessingLocalBusiness.java
- CreditCardTransactionProcessingBean.java
- Implementation Resources
- A. FirstEJB Example
- Index
- About the Authors
- Colophon
- SPECIAL OFFER: Upgrade this ebook with OReilly