If you can't read please download the document
Upload
jason-shepherd
View
1.057
Download
0
Embed Size (px)
Citation preview
2. Introducing JBoss AS 7
Java Enterprise Edition (JEE) 6
3. Managed Beans 4. Context and Dependency Injection Integration Testing with Arquallian
5. Community vs Enterprise Releases
JBoss AS 7.1
EAP 6 due in early 2012 6. JBoss EAP 6 based on AS 7.1 7. Key features Lightweight Container
Simplified Classloading
User focused configuration
Manage multiple instances at once
Smaller memory footprint
8. Fast Startup
No need to Slim unused features 9. Simplified Classloading
10. Greeter cannot access org.slf4jcom.redhat.greeter org.slf4j org.jboss.weld.core 11. Benefits of Java EE?
13. Powerful mechanisms for free 14. Portable knowledge 15. Drawbacks of Java EE 5
16. Non Embeddable EJB container 17. Complex packaging 18. Verbose XML configuration 19. Boilerplate JNDI lookups 20. EJB 3.1 to the rescue!
21. Embeddable EJB container 22. EJBs in WAR 23. Annotation based configuration 24. EJB in light weight Web Profile 25. EE 6 Web profile Key components
EJB 3.1
26. EJBs in WAR archives! 27. What are managed beans?
28. EJB 29. Seam 30. Spring 31. Guice 32. CDI Need aunified bean definition 33. Managed bean specification
34. Instances managed by the container 35. Common services
36. Resource injections 37. Interceptors Foundation spec How managed beans evolved: http://www.infoq.com/news/2009/11/weld10 JSF EJB CDI JAX-RS Managed Beans 38. Resource Injection Revisited in JEE 6
39. Closed set of injectable resources
40. @PersistenceContext ,@PersistenceUnit 41. @Resource(e.g., DataSource, UserTransaction) Name-based injection is fragile
42. Requires special tooling to validate 43. Context and Dependency Injection (CDI) Web tier (JSF) Transactional tier (EJB) 44. What CDI provides
45. Automatic transaction management for web apps! 46. A type-safe approach tod ependencyi njection 47. Based on Seam 2 48. Other features 49. http://tinyurl.com/weld-reference-101 50. Injection 101 ... public classManagedGreeter { @InjectGreeterg ; Stringmessage= null; public voidsetMessage(Stringm ) { this . message=g .greet( m ); } public StringgetMessage(){ returnmessage ; } } 51. Welcome to CDI, EJB 3.1 session beans! @Statelesspublic classGreeter { publicString greet(String name) { return "Hello "+ name +"!" ; }} 52. Welcome to CDI, JSF!
53. From JEE 5 to JEE6 CDI JSF managed beans Facelets JSP 54. Stashing the bean in a context @RequestScoped public classManagedGreeter { @InjectGreeterg ; Stringmessage= null; public voidsetMessage(Stringm ) { this . message=g .greet( m ); } public StringgetMessage(){ returnmessage ; } } 55. Scope types and contexts
Servlet scopes
56. @RequestScoped 57. @SessionScoped JSF conversation scope -@ConversationScoped 58. Custom scopes
59. Implement the context API in an extension 60. Conversation context
61. No fear of exceptions on lazy fetch operations 62. Controlling the conversation @ConversationScoped public classBookingAgent { @Inject @BookingDatabaseEntityManagerem ; @Inject Conversation conversation ; privateHotelselected ; privateBookingbooking ; public voidselect(Hotel h) { selected=em .find(Hotel. class , h.getId()); conversation.begin() ; } ... 63. Controlling the conversation ... public booleanconfirm() { if(!isValid()) { return false ; } em .persist( booking ); conversation.end() ; return true ; } } 64. Container-oriented testing for Java EE
JavaArchive archive = ShrinkWrap. create ( "archive.jar" , JavaArchive. class ) .addClasses(MyClass. class , MyOtherClass. class ) .addResource( "mystuff.properties" );
65. Pluggable container support (embedded or remote) 66. Supports injection into test class 67. Tests can be run from IDE or build script 68. Arquillian Maven integration < dependency > < groupId > org.jboss.arquillian.junit groupId > < artifactId > arquillian - junit -container artifactId > < version > ${arquillian.version} version > < scope > test scope > dependency > 69. Arquillian Remote vs. Embedded
70. No startup/shutdown 71. Deployed to running container Managed
72. Startup/Shutdown managed by test harness 73. How do I get started?
Generatea project using Eclipse & JBoss Tools
Viewthe JBoss Quickstart documentation
Readthe Weld reference guide
Browsethe CDI JavaDoc
74. What is Openshift?
75. Java, Perl, PHP, Python, and Ruby Flex
76. Performance monitoring 77. Application Management Java and PHP 78. Openshift Express
79. Install the RHC command line tools 80. Create a domain
Create an application
Copy app into git managed directory 81. Git push 82. Try JBoss AS 7 today!
83. Java EE 6 compliant 84. Test in the container using Arquallian 85. Deploy instantly to Openshift