New York
University
Computer
Science Department
Courant
Institute of Mathematical Sciences
Course Title: Application Servers Course Number: g22.3033-011
Instructor: Jean-Claude Franchitti Session: 6
1. Ongoing
Project Background
This homework follows the course on-going project approach described in the homework #1 specification. You should keep enriching your framework-based enterprise application design, and take advantage of the application server platforms used to implement/deploy your application. Your application should be developed in such a way as to be shielded as much as possible from the underlying software infrastructure. For that reason, it is a good idea to build your applications around a portable application framework. As portability issues arise, you will learn how to improve the design of your applications to make them more portable across application server platforms.
2.
Introduction to J2EE Component-Based Computing Environments
J2EE Component-Based computing environments are an
evolution of the RMI-IIOP distributed computing platforms studied in the past
sessions. Modern J2EE environments support Enterprise JavaBeans technology that
defines a model for the development and deployment of reusable Java server
components. Components are pre-developed pieces of application code that can be
assembled into working application systems. While Java technology had a
component model called JavaBeans to supports reusable development
components, the EJB architecture
logically extends the JavaBeans component model to support server components.
To relate to the aforementioned technology, and understand its relationship to
distributed computing platforms and its role in the Application Server
technology domain, this homework extends the simple Application Server
configuration developed in previous assignments to operate on top of a J2EE
platform.
The goal of the homework is to deploy the framework-based application developed as part of previous assignments on top of a J2EE Component-Based Computing Environment, and extend it to make use of services provided by such platforms. As part of this exercise, you will study two different implementations of a sample Multi-user Object-Oriented (MOO) 2D application on top of different application server infrastructures. MOOs, in general, are derived from Multi-user Dungeons/Dimensions (MUDs), and Multi-user Shared Hallucination (MUSH) environments. On these platforms, graphical icons called “avatars” impersonate individual users. Avatars can maneuver through graphical rooms, and may chat/communicate via synthesized voice or cartoonish "speech bubbles". The first implementation provided deploys the sample application on top of an RMI-IIOP platform. The second implementation deploys the sample application on top of the WebLogic J2EE-compliant application server. Both sample implementations illustrate how to build sophisticated applications on top of distributed computing platforms.
2.1. Software Infrastructure Provided:
1.
Environment
used for homework #1 (as needed)
2.
Other
development tools best suited for J2EE development environments (e.g., IBM WSAD 5.0)
3.
All
the application software needed for this homework is contained in archives
posted on the course Web site under demos. The distribution archives contains
programs for the two types of implementations described earlier in this
section.
1.
The
chat room is implemented with RMI-IIOP, and the client side is a Java
application.
2.
RMI
interfaces:
ChatServerRMI.java describes
the interfaces to the server.
connect: called by client when the chat user
connects to the server.
disconnect: called by client when the chat user
disconnects to the
server.
sendMessage: called by server when new user
(dis)connect, or by client
when some user send a message to others.
sendLocation: called by client when some user move his/her
position in
the graph.
ChatClientRMI.java describes the interfaces to the client.
updateMessage: called
by server when new messages arrives
updateLocation: called
by server when location changed for some user
3.
Communication
Messages are transferred via
strings or integers, while more complicated messages are encoded in strings
instead of sending objects.
4.
Client
implementation
Each client has a user list
to keep track of all the online users. Each user has a record to record his/her
info: like name, location, etc.
The display of chat room is
updated at some time interval, timer is used to decide if a message should be
displayed.
5.
Server
implementation
There are five different
servers (chat rooms), and each has a user list to keep track of all its online
users. Furthermore, the client can enter any one of the five chat rooms, even
after it has left another room.
The
relevant source files are:
File name |
Description |
ChatUserBMP.java |
Business
methods for this bean that allow to read the values of its fields and
increment the count of times user has joined chat room. |
ChatUserBMPHome.java |
Finder
methods for this bean enable locating this bean via various parameterized
queries. |
ChatUserBMPBean.java |
Implementation
heavily relies on JDBC. |
ChatUserCMP.java |
Business
methods for this bean that allow to read the values of its fields and
increment the count of times user has joined chat room (same as BMP version). |
ChatUserCMPHome.java |
Finder
methods for this bean enable locating this bean via various parameterized
queries (different from BMP version). |
ChatUserCMPBean.java |
Implementation
is very easy, because the container manages all the connections with the
database guided by the XML DD file weblogic-cmp-rdbms-jar.xml. |
Admin.java |
Thorough
illustrations of both BMP and CMP implementations. |
Entity beans were used in the following manner. Both
a BMP and a CMP bean are associated with each user of the chat room. The bean
has three fields:
Field |
Description |
Name |
Name of chat user |
AvatarCode |
Integer code for the avatar of this user |
Count |
Number of times the user has joined the chat room |
Each of this fields is mapped to a column in the ejbChatUsers table. The mapping is
handled programmatically in the BMP implementation, and specified in the DD XML
files in the CMP implementation.
Each time a user joins a chat room, the
corresponding bean is found using its primary key, which is the name of the
user. If this is the first time that the user joins the chat room, a new bean
is created. Every time a user joins a chat room, the count field is incremented. A message indicating how many times
this particular user has joined the chat room is displayed in the user’s text
area.
An administration program is provided within the MOO
environment to monitor the successful
deployment of both BMP and CMP beans. The administrator can choose among a few
options, such as: list all chat users, remove chat user (parameterized by chat
user name), find most frequent chat users, find frequent chat users
(parameterized by count value). Furthermore, additional hardcoded installation
tests are run at the end, where forty beans are created, queried in various
forms, and finally removed from the database.
Generally, the options from the administrator
console are implemented as “finder” functions in both BMP and CMP
implementations.
Additional
Sample Applications
1.
No
additional sample applications are provided for this homework
2.2. Installing and Running the Homework Software Infrastructure:
1)
Extract
RMI-IIOP-MOO.zip using winzip under c:\.
2)
After
extraction, a directory named c:\RMI-IIOP-MOO is created, which includes
subdirectory ChatClientRMI and ChatServerRMI.
3)
Switch
to c:\RMI-IIOP-MOO, and run the file “env.bat” to set the CLASSPATH.
4)
Start
the naming service “tnameserv” using default settings.
5)
Test
> cd c:\RMI-IIOP-MOO
> env.bat
> start tnameserv
> c:\RMI-IIOP-MOO\ChatServerRMI\runs.bat
Open another DOS prompt
> c:\RMI-IIOP-MOO\ChatClientRMI\runc.bat prof
Open another DOS prompt
> c:\RMI-IIOP-MOO\ChatClientRMI\runc.bat student
Use a properly configured example server on a compatible platform. The following instructions are for WebLogic 6.0. Instructions for WebLogic 7.0 and later are provided in the WebLogic 7.0 archive posted on the course Web site under demos.
1)
Extract
the EJB-MOO.zip file within C:\bea\wlserver6.0sp1\samples\examples\ejb\basic
directory, so that C:\bea\wlserver6.0sp1\samples\examples\ejb\basic\Chat is
created. All the relevant files are inside the Chat directory.
2)
Open
a DOS prompt and set the environment by running C:\bea\wlserver6.0sp1\config\examples\setExamplesEnv.cmd
3)
Go
to C:\bea\wlserver6.0sp1\samples\examples\ejb\basic\Chat, and build the files
by running build.cmd. NOTE: It might
be necessary to invoke build.cmd twice
due to some compile errors the
first time around.
4)
For
the entity beans to work correctly, it is necessary to fist create the table ejbChatUsers in the Cloudscape
database, and (this is very important) in the same instance as that used
by the WebLogic’s examplesServer. To accomplish this, follow these steps,
without taking any shortcuts:
a)
Copy
ejbChatUsersSchema.ddl and createtable.bat in the directory C:\bea\wlserver6.0sp1\samples\eval\cloudscape\data.
b)
Make
sure WebLogic’s examplesServer is not running
c)
Go
to C:\bea\wlserver6.0sp1\samples\eval\cloudscape\data
d)
Invoke createtable.bat
5)
Start
WebLogic example server via the start menu, or by running this file: C:\bea\wlserver6.0sp1\config\examples\startExamplesServer.cmd
6)
Point
your browser to http://localhost:7001/console,
to bring up the configuration console.
7)
Deploy
ejb_basic_Chat.jar that can be found
in .\config\examples\applications.
8)
Always
from the Chat directory, start runs.bat batch
file that creates five different chat rooms.
9)
Start
first client: runc.bat Prof
10)
Start second client: runc.bat Student
11)
Start
more clients: runc.bat nickname
For
further illustrations and examples of BMP and CMP beans, run the administration
program runa.bat.
3. Questions
1.
Preparation
phase:
2.
Prepare
a short report documenting your refined framework-based enterprise application
(using software engineering standards), and explaining its motivation.
3.
Prepare
a short report including functional diagrams and screenshots (as needed) to
demonstrate your understanding of the infrastructure software. Explain the
infrastructure software differences between the application you developed in
previous assignments and the one you are developing for this homework.
4.
Develop
and deploy your framework-based enterprise application as follows on top of the
EJB MOO infrastructure. You are welcome to either reuse services provided by
the sample application or complement them. Document the benefits and
deficiencies of the approach on which J2EE component-based computing
environments are based and explain (as needed) how it limits your ability to
develop the various application components you have envisioned for your enterprise
application. Note that you do not need to provide a complete implementation of
your application in this homework. You should restrict yourself to what you
feel is feasible based on time and the level of support provided by the
infrastructure software. Your application should be tuned for efficiency as
allowed by the underlying infrastructure software, and you should document your
performance engineering approach. You should conclude your report by
suggesting, and implementing (as time allows) an improved Application Server
model.
5. Explain how you would refine the “analyzer” tool you started designing in previous assignments to capture information about the version of the applications deployed in previous assignments, and re-deploy them as XML-based web applications such as: (a) the “SpyWeb” applications provided as support material under demo programs on the course Web site, (b) applications based on the Cocoon 2 XSP framework, and (c) applications based on J2EE EJB frameworks. Note that the target application should again maintain a strict separation between content, style, and logic. As for previous assignments, your analyzer should strive to extract and represent a generic model of your application using a suitable markup language.
6.
Extra
Credit: Implement a prototype of the analyzer tool described in question 5.
5.
Deliverables
6. Grading
All assignments are graded on a maximum scale of 10 points. Your grade will be based equally on:
a.
The
overall quality of your documentation.
b.
The
understanding and appropriate use of application server related technologies.
c.
Your
ability to submit working and well-commented code.
d.
Extra
credit may be granted for solutions that are particularly creative.
Please let the TA know as
soon as possible about teaming arrangements. You will need to stay with the
same team for the duration of the course. You should only submit one
report/archive per team for each assignment. To balance things out, the final
grading in the course will take into account the fact that you are working as a
team instead of individually, so you should feel free to work individually as
well. Note that the final take home examination will require individual work.