User Tools

Site Tools


at-m42:lecture15

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
at-m42:lecture15 [2009/04/25 10:42] eechrisat-m42:lecture15 [2011/01/14 12:45] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ~~SLIDESHOW~~ ~~SLIDESHOW~~
-====== Business-tier Services ======+====== Enterprise Integration Tier Services ======
    
 In principle, the business logic of an enterprise application could be performed by //domain objects// which implement a model of the business concept as Plain-Old Java Objects (POJOs). In principle, the business logic of an enterprise application could be performed by //domain objects// which implement a model of the business concept as Plain-Old Java Objects (POJOs).
Line 15: Line 15:
   * [[#The key business tier services]]   * [[#The key business tier services]]
   * [[#The Java solution: Enterprise Java Beans]]   * [[#The Java solution: Enterprise Java Beans]]
-  * [[#Reimplementing PerfectTime as a session bean]]+  * [[#Reimplementing TimeHere as a session bean]]
   * [[#Is the Java solution a good solution?]]   * [[#Is the Java solution a good solution?]]
  
Line 107: Line 107:
   * **[[#The key business tier services]]**   * **[[#The key business tier services]]**
   * [[#The Java solution: Enterprise Java Beans]]   * [[#The Java solution: Enterprise Java Beans]]
-  * [[#Reimplementing PerfectTime as a session bean]]+  * [[#Reimplementing TimeHere as a session bean]]
   * [[#Is the Java solution a good solution?]]   * [[#Is the Java solution a good solution?]]
  
Line 136: Line 136:
     * Or simply to be stored in non-volatile memory.     * Or simply to be stored in non-volatile memory.
   * Your business objects want this to //just happen//!   * Your business objects want this to //just happen//!
-    * **Transparent persistence**, as discussed in the [[lecture14|last lecture]], is obviously important,+    * **Transparent persistence**, as discussed in the [[lecture15|last lecture]], is obviously important,
     * but persistence should also be a key part of transaction management and is a cornerstone of data integrity.     * but persistence should also be a key part of transaction management and is a cornerstone of data integrity.
  
Line 172: Line 172:
   * [[#The key business tier services]]   * [[#The key business tier services]]
   * **[[#The Java solution: Enterprise Java Beans]]**   * **[[#The Java solution: Enterprise Java Beans]]**
-  * [[#Reimplementing PerfectTime as a session bean]]+  * [[#Reimplementing TimeHere as a session bean]]
   * [[#Is the Java solution a good solution?]]   * [[#Is the Java solution a good solution?]]
  
Line 273: Line 273:
   * [[#The key business tier services]]   * [[#The key business tier services]]
   * [[#The Java solution: Enterprise Java Beans]]   * [[#The Java solution: Enterprise Java Beans]]
-  * **[[#Reimplementing PerfectTime as a session bean]]**+  * **[[#Reimplementing TimeHere as a session bean]]**
   * [[#Is the Java solution a good solution?]]   * [[#Is the Java solution a good solution?]]
  
Line 291: Line 291:
 package uk.ac.swan.atm42.ejb; package uk.ac.swan.atm42.ejb;
  
-public interface PerfectTime extends EJBObject { +public interface TimeHere extends EJBObject { 
-  public String getPerfectTime() throws RemoteException;+  public String getTimeHere() throws RemoteException;
 } }
 </code> </code>
Line 300: Line 300:
 In EJB 3, the details can be left to the container: interface is a plain-old-Java interface //annotated//  with ''javax.ejb.Remote''. In EJB 3, the details can be left to the container: interface is a plain-old-Java interface //annotated//  with ''javax.ejb.Remote''.
      
-<code java 1|Example 2: Remote interface for the DateHereBean (at-m42/Examples/lecture14/TimeHere.java)> +<code java 1|Example 2: Remote interface for the DateHereBean (at-m42/Examples/lecture15/TimeHere.java)> 
-extern> http://cpjobling.org.uk/~eechris/at-m42/Examples/lecture14/TimeHere.java+extern> http://cpjobling.org.uk/~eechris/at-m42/Examples/lecture15/TimeHere.java
 </code> </code>
  
Line 322: Line 322:
  
 ===== Home interface for the TimeHere (EJB 2) ===== ===== Home interface for the TimeHere (EJB 2) =====
-<code java 1|Example 3: Remote interface for the DateHereBean (at-m42/Examples/lecture14/TimeHereHome.java)> +<code java 1|Example 3: Remote interface for the DateHereBean (at-m42/Examples/lecture15/TimeHereHome.java)> 
-extern> http://cpjobling.org.uk/~eechris/at-m42/Examples/lecture14/TimeHereHome.java+extern> http://cpjobling.org.uk/~eechris/at-m42/Examples/lecture15/TimeHereHome.java
 </code> </code>
  
Line 334: Line 334:
   - The return value and arguments of all methods must be valid RMI-IIOP data types.   - The return value and arguments of all methods must be valid RMI-IIOP data types.
  
-===== PerfectTimeBean (Session Bean) EJB 2 Version =====+===== TimeHereBean (Session Bean) EJB 2 Version =====
  
 <code java 1| Example 4: SessionBean implemented using EJB 2 conventions> <code java 1| Example 4: SessionBean implemented using EJB 2 conventions>
Line 368: Line 368:
   * EJB is now a "Plain Old Java Object" (POJO)) annotated with ''javax.ejb.Stateless''   * EJB is now a "Plain Old Java Object" (POJO)) annotated with ''javax.ejb.Stateless''
  
-===== PerfectTimeBean (Session Bean) EJB 3 Version ===== +===== TimeHereBean (Session Bean) EJB 3 Version ===== 
-<code java 1| Example 5: SessionBean implemented using EJB 3 conventions (at-m42/Examples/lecture14/TimeHereBean.java)> +<code java 1| Example 5: SessionBean implemented using EJB 3 conventions (at-m42/Examples/lecture15/TimeHereBean.java)> 
-extern> http://www.cpjobling.org.uk/~eechris/at-m42/Examples/lecture14/TimeHereBean.java+extern> http://www.cpjobling.org.uk/~eechris/at-m42/Examples/lecture15/TimeHereBean.java
 </code> </code>
  
 ===== Deployment Descriptor (EJB 2) ===== ===== Deployment Descriptor (EJB 2) =====
  
-An XML file that describes the EJB component. Should be stored in a file called ''ejb-jar.xml''.  +An XML file that describes the EJB component. Should be stored in a file called ''ejb-jar.xml''
-<code xml 1|Example 6: Deployment Descriptor for the TimeHereBean (not required in EJB 3 containers) (at-m42/Examples/lecture14/ejb-jar.xml)> +<code xml 1|Example 6: Deployment Descriptor for the TimeHereBean (not required in EJB 3 containers) (at-m42/Examples/lecture15/ejb-jar.xml)> 
-extern> http://www.cpjobling.org.uk/~eechris/at-m42/Examples/lecture14/ejb-jar.xml+extern> http://www.cpjobling.org.uk/~eechris/at-m42/Examples/lecture15/ejb-jar.xml
 </code> </code>
 ===== Deploying the EJB ===== ===== Deploying the EJB =====
Line 385: Line 385:
   * The deployment process is quite "GUI intensive2 and specific to the individual EJB Container.   * The deployment process is quite "GUI intensive2 and specific to the individual EJB Container.
   * The deployment process creates some client stubs for calling the EJB component. These classes should be placed on the CLASSPATH of the client application.   * The deployment process creates some client stubs for calling the EJB component. These classes should be placed on the CLASSPATH of the client application.
-  * When a client program wishes to invoke an EJB it must look up the EJB component inside JNDI and obtain a reference to the home interface of the EJB component. The Home interface is used to create an instance of the EJB.  +  * When a client program wishes to invoke an EJB it must look up the EJB component inside JNDI and obtain a reference to the home interface of the EJB component. The Home interface is used to create an instance of the EJB. 
  
 ===== The Client ===== ===== The Client =====
  
-  * Here a simple Java program but could just as easily be a servlet, a JSP or even a CORBA or RMI distributed object. +  * Here a simple Java program but could just as easily be a servlet, a JSP or even a CORBA or RMI distributed object.
  
-<code java 1| Example 7: Client program for PerfectTimeBean (at-m42/Examples/lecture14/TimeHereClient.java)>  +<code java 1|Example 7: Client program for TimeHereBean (at-m42/Examples/lecture15/TimeHereClient.java)> 
-extern> http://www.cpjobling.org.uk/~eechris/at-m42/Examples/lecture14/TimeHereClient.java+extern> http://www.cpjobling.org.uk/~eechris/at-m42/Examples/lecture15/TimeHereClient.java 
 +</code> 
 +<code java 1| Example 7: Client program for TimeHereBean (at-m42/Examples/lecture15/TimeHereClient.java)>  
 +extern> http://www.cpjobling.org.uk/~eechris/at-m42/Examples/lecture15/TimeHereClient.java
 </code> </code>
  
Line 400: Line 403:
   * [[#The key business tier services]]   * [[#The key business tier services]]
   * [[#The Java solution: Enterprise Java Beans]]   * [[#The Java solution: Enterprise Java Beans]]
-  * [[#Reimplementing PerfectTime as a session bean]]+  * [[#Reimplementing TimeHere as a session bean]]
   * **[[#Is the Java solution a good solution?]]**   * **[[#Is the Java solution a good solution?]]**
  
 +===== Is the Java Solution a Good Solution? =====
  
 +  * During 2004, the developer community decided that the answer is probably no.
 +  * EJB 3 was a response to this, and uses annotations to simplify it.
 +  * We will discuss this issue, and some of the alternatives in the final lecture.
 +  * The TimeHere session EJB example gives a flavour of the complexity! To run the example, you’ll need an implementation of a Java EE container (e.g. Glassfish) to which you can deploy the bean.
  
-===== Is the Java Solution a Good Solution? ===== +=====  Lecture Summary =====
-During 2004, the developer community decided that the answer is probably no. +
-We will discuss this issue, and some of the alternatives in the final lecture. +
-Eckel’s PerfectTime session EJB example gives a flavour of the complexity! To run the example, you’ll need an implementation of a J2EE container to which you can deploy the bean. +
-It’s a good example of a bad design if nothing else! +
- +
-=====  Lecture Content =====+
  
   * [[#An example]]   * [[#An example]]
   * [[#The key business tier services]]   * [[#The key business tier services]]
   * [[#The Java solution: Enterprise Java Beans]]   * [[#The Java solution: Enterprise Java Beans]]
-  * [[#Reimplementing PerfectTime as a session bean]]+  * [[#Reimplementing TimeHere as a session bean]]
   * [[#Is the Java solution a good solution?]]   * [[#Is the Java solution a good solution?]]
  
Line 423: Line 425:
 ---- ----
  
-[[Home]] | [[lecture14|Previous Lecture]] | [[Lectures]] | [[lecture16|Next Lecture]] +[[Home]] | [[lecture15|Previous Lecture]] | [[Lectures]] | [[lecture16|Next Lecture]] 
  
-=====  Lecture Content ===== 
- 
-  * [[#An example]] 
-  * [[#The key business tier services]] 
-  * [[#The Java solution: Enterprise Java Beans]] 
-  * [[#Reimplementing PerfectTime as a session bean]] 
-  * **[[#Is the Java solution a good solution?]]** 
- 
- 
- 
-===== Is the Java Solution a Good Solution? ===== 
-During 2004, the developer community decided that the answer is probably no. 
-We will discuss this issue, and some of the alternatives in the final lecture. 
-Eckel’s PerfectTime session EJB example gives a flavour of the complexity! To run the example, you’ll need an implementation of a J2EE container to which you can deploy the bean. 
-It’s a good example of a bad design if nothing else! 
- 
-=====  Lecture Content ===== 
- 
-  * [[#An example]] 
-  * [[#The key business tier services]] 
-  * [[#The Java solution: Enterprise Java Beans]] 
-  * [[#Reimplementing PerfectTime as a session bean]] 
-  * [[#Is the Java solution a good solution?]] 
- 
- 
- 
----- 
  
-[[Home]] | [[lecture14|Previous Lecture]] | [[Lectures]] | [[lecture16|Next Lecture]]  
at-m42/lecture15.1240656145.txt.gz · Last modified: 2011/01/14 12:24 (external edit)