COMP 655: Distributed/Operating Systems - Summer 2011
2024-05-03 08:11:11 UTC
Home
Lectures
Assignments
Books, web, tools
 
Turnitin.com
Guidelines
Writing help
Plagiarism
 
DiNo
Glassfish
RESTful client
Menu service
JAX-RS
JAXB
EJB
Java
 
Bulletin board
Contact
 JAX-RS, JAXB, and EJB lab

Part 1 - install and start GlassFish

Download and install GlassFish

Follow the instructions in the installing-GlassFish page (you can skip steps 8 and 9 if you want to, and, if you prefer some other client, you can install that instead of the RESTful client)

When you finish this process, the menu service will be up and running on your PC

Deploy menu-ejb-svc

For information about the menu EJB service, see the EJB page.

Deploy the menu-ejb-svc.war. (You may want to use the Web Admin interface at http://localhost:4848 to deploy and be sure that the "Compatibility" box is checked.)

Check that it works. You can use the "menu ejb svc" drop-down in the RESTful client, or use your favorite client to interact with http://localhost:8080/menu-ejb-svc/ 


Part 2 - JAX-RS, JAXB, EJB intro

Open menu-ejb-svc.war with WinZip and extract the files from the war file and look at the source files in WEB-INF/classes

In Eclipse (newer versions), you can

  • Import > Web > WAR  file
    • import from menu-ejb-svc.war
    • you can hit Finish in the WAR Import dialog. If you continue into the WAR Import: Web libraries dialog, make sure the Jersey jar files are UN-selected.
  • Delete index.jsp and WebContent/WEB-INF/sun-web.xml (if it's there)
  • If Eclipse on your lab PC won't do this, you'll have to do more manual work:
    • create a dynamic web project
    • import the menu package from menu-ejb-svc.war
    • import the web.xml from menu-ejb-svc.war
    • import the jar files from menu-ejb-svc.war to WebContent/WEB-INF/lib
  • Import > EJB > EJB JAR file
    • import from menu-ejb.jar
    • add menu-ejb-client.jar to the project's build path

Your instructor will give a short introduction to JAX-RS, (a small piece of) JAXB, and EJB using the menu EJB service source as an example.

  • JAX-RS
    • @Path
    • @GET, @POST, @PUT, @DELETE
    • @PathParam
    • Request content
    • @Produces, @Consumes
    • Response class
    • @Provider
  • JAXB
    • @XmlRootElement
    • @XmlElement
    • @XmlAttribute
    • @XmlType
  • EJB
    • @Remote
    • @Stateless

Part 3 - Build a directory service front-end

  1. Deploy directory service reference implmenetation
  2. Create and annotate DirectoryEntry class
  3. Create and annotate DirectoryResource class
  4. add the directory client jar to your classpath
  5. getEntry method
  6. lookup directory service
  7. web.xml
  8. deploy
  9. test with RESTful client
  10. createEntry method
  11. re-deploy
  12. test with RESTful client
  13. compare with directory service front-end demo