Download Midterm Exam Problems - Component-Based Software Development | SWE 645 and more Exams Engineering in PDF only on Docsity!
George Mason University
Information and Software Engineering
SWE 645 Component-based Software Development Y. Wu
Fall 2003
Mid Term Exam
October 15, 2003
This exam is closed book. But you can bring 2 pieces of papers with anything. Be sure to
print your name on the test. Allocate your time according to the points assigned for each
question. Please show all work on the test.
You have until 10:00pm.
PROBLEM SCORE POINTS
TOTAL 100
NAME (please print):
ID (please print):
Question 1: (34 points, 2 points each). For the following statements, mark them True
or False.
1. It is possible for the J2EE container to assign the same or different
stateless EJB objects to two different EJB clients.
2. CMP can achieve code reduction in EJB entity bean development,
therefore it is easier to debug and maintain.
3. For heavy clients, because the clients and server are tightly
coupled, it may affect the scalability of the application.
4. Object activation is able to improve performance because of the
fact that under certain circumstances, it is able to make local object
references rather than making remote RMI calls.
5. Within JMS point-to-point model, one and ONLY one receiver is
able to receive messages from a message queue.
6. Within JMS publisher/consumer model, more than one consumer
is able to receive messages from a topic.
7. Greater complexity and learning curve are two of the EJB’s
disadvantages. Therefore, EJB technology should be used for
simple applications where complexity can be easily controlled.
8. Message driven bean is similar to Stateless session bean in the way
that it has a home interface, a remote interface and an EJB
implementation class. But message driven beans do not require
explicit interactions with clients.
9. The smallest unit of transaction support in EJB beans is a method.
10. JDO is a similar technology to CMP entity bean, but it can be used
outside the J2EE container while CMP entity bean cannot.
11. JNDI is a type of naming and directory service.
12. With proper management, when migrating EJB beans from one
J2EE container to another J2EE container, EJB programs do not
need to be changed.
13. Component-based software can always be efficiently and
effectively built, tested and maintained.
3. Which methods in the following diagram need to be exposed to a
client?
Not Exist
Method Ready
1. newInstance()
2. setMessageDrivenContex()
3. ejbCreate()
5. ejbRemove()
4. onMessage()
Message Bean
A) 1 – 5 B) 1-3 and 5 C) 4 D) 3 and 5
4. The “verifier” command in J2EE can verify the integrity of an ear file
or a jar file. Which one of the following java technology enables it to
do so?
A) Serialization B) Externalization
C) Java Reflection D) Java RMI
5. A transaction support is required in an EJB application to log all
successful method invocations. Which one of the following transaction
attributes will be suitable for this scenario?
A) support B) require C) require-new D) mandatory
Question 3: (16 points) Answer the following 4 questions briefly and concisely.
Use the space provided.
Q1. (4 points) How do we manage different system resources, such as JDBC
resources and JMS resources, in J2EE? Why?
Q2. (4 points) Why do we introduce activatable objects in RMI? Who manages
object activation?
Q3. (4 points) What are the benefits to have different deployment descriptors,
such as ejb-jar.xml and application-client.xml?
Q4. (4 points) What happens in J2EE application server when deploying a
stateless session been with the “asadmin deploy” command?
3. (4 points) If the business process requires frequent updates (keep the same
interfaces, but change the internal processing), what do you do to minimize the
impacts of the updates on the client side?
Question 5: (12 points) Based on the program given below, answer questions 1-3.
public class BClassEJB implements EntityBean { public String className, pName; private Connection con; private EntityContext context;
public void setClass(String className) {……} public void setProf(String pName) {……} public String getClasses(){……} public String getProf(){……}
public String ejbCreate(String className)throws CreateException {} public void ejbPostCreate(String className, String pName) {} public void ejbLoad(){……} public void ejbRemove(){……} public void unsetEntityContext() {……} public void setEntityContext(EntityContext context) {……} public void ejbActivate(){……} public void ejbPassivate(){……} public void ejbStore(){……}
public String ejbFindByPrimaryKey(String primaryKey) throws FinderException {……}
public Collection ejbFindByProfessor(String pName) throws FinderException {……}
/**************** Database Routines ********************/ private void makeConnection() throws SQLException {……} … … /*******************************************************/
1. (4 points) Derive the Home interface and remote (component) interface of the
corresponding BMP entity bean.
2. (4 points) What do you do in ejbLoad() and ejbStore()?
3. (4 points) Where do you create the database connection and where do you release
that connection?
3. (4 points) Can we directly call local interfaces of the new CMP 2.0 entity bean in
this client program? If yes, what are the changes we need to perform for the client
program? If not, and we would like to take the advantage of the local interfaces,
what should we do?
4. (4 points) Is "java:comp/env/ejb/CEntityEJB" the real JNDI name for the
corresponding entity bean. If yes, where do we define the JNDI name, if not, how
do we find out the JNDI name, and why do we want to do that?