Java/J2EE

335 views
283 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
335
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Java/J2EE

  1. 1. Enterprise Applications & Java/J2EE Technologies Dr. Douglas C. Schmidt [email_address] http://www.dre.vanderbilt.edu/~schmidt/ Professor of EECS Vanderbilt University Nashville, Tennessee
  2. 2. Agenda <ul><li>What makes an application “Enterprise”? </li></ul><ul><li>Java/J2EE to develop Enterprise Applications </li></ul><ul><li>EJB Specification </li></ul><ul><li>JBoss Application Server + AOP </li></ul><ul><li>What is an Architect’s role? </li></ul>
  3. 3. Enterprise Architectures <ul><li>They all have well thought out solutions to the “-ilities” of software development. </li></ul>
  4. 4. Enterprise = “-ilities” <ul><li>Availability </li></ul><ul><li>Dependability </li></ul><ul><li>Distributability </li></ul><ul><li>Maintainability </li></ul><ul><li>Reusability </li></ul><ul><li>Reliability </li></ul><ul><li>Scalability </li></ul><ul><li>Recoverability </li></ul><ul><li>Etc… </li></ul>
  5. 5. Availability <ul><li>The accessibility of a system resource in a timely manner; for example, the measurement of a system's uptime. </li></ul>
  6. 6. Dependability <ul><li>&quot; [..] the trustworthiness of a computing system which allows reliance to be justifiably placed on the service it delivers [..] &quot; </li></ul><ul><ul><ul><ul><li>IFIP WG10.4 on DEPENDABLE COMPUTING AND FAULT TOLERANCE </li></ul></ul></ul></ul>
  7. 7. Distributability <ul><li>Involve Multiple Environments/Servers </li></ul><ul><li>Can span across geographical locations </li></ul><ul><li>Hand held devices to Multiprocessor Servers </li></ul>
  8. 8. Maintainability <ul><li>“You are developing tomorrow’s legacy code” </li></ul><ul><li>To keep up or carry on; continue. </li></ul><ul><li>To keep in a condition of good repair or efficiency. </li></ul><ul><ul><li>What makes a system maintainable? </li></ul></ul>
  9. 9. Reusability <ul><li>To use again, especially after salvaging or special treatment or processing. </li></ul><ul><li>Reduces duplicate code / “Copy & Paste” </li></ul><ul><li>Easier to maintain </li></ul><ul><li>Faster to develop </li></ul>
  10. 10. Reliability <ul><li>The trustworthiness to do what the system is expected or designed to do. </li></ul><ul><li>Available 24-7-365 </li></ul><ul><li>Performs within acceptable thresholds </li></ul>
  11. 11. Scalability <ul><li>“Refers to how much a system can be expanded. The term by itself implies a positive capability. For example, &quot;the device is known for its scalability&quot; means that it can be made to serve a larger number of users without breaking down or requiring major changes in procedure.” </li></ul><ul><ul><ul><ul><li>Computer Desktop Encyclopedia </li></ul></ul></ul></ul>
  12. 12. Recoverability <ul><li>Single point of failure </li></ul><ul><li>Clustered servers </li></ul><ul><li>Emergency backup plans </li></ul><ul><li>Disaster backup plans </li></ul>
  13. 13. Questions / Comments?
  14. 14. Java/J2EE to develop Enterprise Applications <ul><li>EE = Enterprise Edition </li></ul><ul><li>Specifications and Standards </li></ul><ul><li>Enabled Vendors to build Application Servers </li></ul><ul><li>Focus on Business Logic, not on infrastructure </li></ul><ul><li>Removed some complexities, introduced others </li></ul>
  15. 15. Standards & Specifications <ul><li>EJB </li></ul><ul><li>JSP </li></ul><ul><li>JAXP </li></ul><ul><li>JMS </li></ul><ul><li>JNDI </li></ul><ul><li>JMX </li></ul><ul><li>Servlets </li></ul><ul><li>JDBC </li></ul><ul><li>JTA </li></ul><ul><li>JCA </li></ul><ul><li>RMI </li></ul><ul><li>JNI </li></ul>Some but not all…
  16. 16. J2EE Architecture
  17. 17. Containers <ul><li>“ Containers provide the runtime support for J2EE application components. Containers provide a federated view of the underlying J2EE APIs to the application components. J2EE application components never interact directly with other J2EE application components. They use the protocols and methods of the container for interacting with each other and with platform services. Interposing a container between the application components and the J2EE services allows the container to transparently inject the services defined by the components’ deployment descriptors, such as declarative transaction management, security checks, resource pooling, and state management.” </li></ul><ul><li>-J2EE Specification v1.4 </li></ul>
  18. 18. EJB Specification <ul><li>Session, Entity, and Message Driven Beans </li></ul><ul><li>Instance Lifecycle </li></ul><ul><li>Declarative Transaction Management </li></ul><ul><li>Security </li></ul><ul><li>Threading/Locking </li></ul><ul><li>Remote/Local Invocation </li></ul>
  19. 19. Session Beans <ul><li>Executes on behalf of a single client. </li></ul><ul><li>Can be transaction-aware. </li></ul><ul><li>Updates shared data in an underlying database. </li></ul><ul><li>Does not represent directly shared data in the database, although it may access and update such data. </li></ul><ul><li>Is relatively short-lived. </li></ul><ul><li>Is removed when the EJB container crashes. The client has to re-establish a new session object to continue computation. </li></ul><ul><li>Can be either Stateful or Stateless. </li></ul>
  20. 20. When to use Session Beans <ul><li>Session Façade pattern </li></ul><ul><li>Front end a web service </li></ul><ul><li>Manage transactions, threading, pooling, etc. </li></ul><ul><li>Expose a remote interface </li></ul>
  21. 21. Entity Beans <ul><li>Provides an object view of data in the database. </li></ul><ul><li>Allows shared access from multiple users. </li></ul><ul><li>Can be long-lived (lives as long as the data in the database). </li></ul><ul><li>The entity, its primary key, and its remote reference survive the crash of the EJB container. </li></ul>
  22. 22. When to use Entity Beans <ul><li>Services that have a small limited object model. </li></ul><ul><li>Object model needs to perform CrUD operations. </li></ul><ul><li>No complex joins are needed to retrieve data. </li></ul><ul><li>No need to walk complex object graphs. </li></ul>
  23. 23. Message Driven Beans <ul><li>Executes upon receipt of a single client message (JMS). </li></ul><ul><li>Is asynchronously invoked. </li></ul><ul><li>Can be transaction-aware. </li></ul><ul><li>May update shared data in an underlying database. </li></ul><ul><li>Does not represent directly shared data in the database, although it may access and update such data. </li></ul><ul><li>Is relatively short-lived. </li></ul><ul><li>Is stateless. </li></ul><ul><li>Is removed when the EJB container crashes. The container has to re-establish a new message-driven object to continue computation. </li></ul>
  24. 24. When to use MDB <ul><li>Distributed systems </li></ul><ul><li>JMS </li></ul><ul><li>Asynchronous calls </li></ul><ul><li>Manage Transactions, threading, pooling, etc. </li></ul>
  25. 25. Bean Lifecycle
  26. 26. Declarative Transactions <ul><li>Declare the transaction level through configuration of a bean. </li></ul><ul><li>Container manages these transactions for you. </li></ul><ul><li>Valid transaction Values: </li></ul><ul><ul><li>Not Supported </li></ul></ul><ul><ul><li>Required </li></ul></ul><ul><ul><li>Supports </li></ul></ul><ul><ul><li>Requires New </li></ul></ul><ul><ul><li>Mandatory </li></ul></ul><ul><ul><li>Never </li></ul></ul>
  27. 27. Application Servers <ul><li>Implement the specification for EJB containers. </li></ul><ul><li>Provide environment which allows developers to focus on business logic. </li></ul>
  28. 28. JBoss Application Server <ul><li>J2EE application server – open source </li></ul><ul><li>www.jboss.org </li></ul><ul><li>EJB Container and more </li></ul><ul><li>Implements Specification through “Interceptors” – AOP-like </li></ul>
  29. 29. AOP – Aspect Oriented Programming <ul><li>“ Aspect-Oriented Programming (AOP) complements OO programming by allowing the developer to dynamically modify the static OO model to create a system that can grow to meet new requirements. Just as objects in the real world can change their states during their lifecycles, an application can adopt new characteristics as it develops.” </li></ul><ul><li>-Graham O’Regan </li></ul>
  30. 30. JBoss EJB Interceptor Stack
  31. 31. Implementing Declarative Transactions using Interceptors <ul><li>Not Supported </li></ul><ul><li>Required </li></ul><ul><li>Supports </li></ul><ul><li>Requires New </li></ul><ul><li>Mandatory </li></ul><ul><li>Never </li></ul>
  32. 32. Not Supported
  33. 33. Required
  34. 34. Supports
  35. 35. Requires New
  36. 36. Mandatory
  37. 37. Never
  38. 38. Custom Interceptors <ul><li>AOP – Aspect Oriented Programming </li></ul><ul><li>Logging </li></ul><ul><li>Timing </li></ul><ul><li>Metrics </li></ul><ul><li>Any business logic that should be applied widely </li></ul>
  39. 39. Developers Focus on Business Logic

×