UNIVERSITY OF ABERDEEN SESSION 2008-2009

Examination in CS5302 (Enterprise Programming)

29 January 2009(14.00 - 16.30)

EXAM

Answer THREE questions.

Each question is worth 25 marks; the marks for each part of a question are shown in brackets.

This example is used by all of the questions in the exam.

The computing science department (CSD) has decided that it is time to move to a Java-based web site. All content for courses, staff and student web pages, and assorted information pages, will be delivered through Apache Tomcat. Students will be able to run Java server pages and servlets from their own filespace without having to install it themselves. The department is also excited because now it will be easier to set up mobile friendly pages so that students can check up which lectures and practicals they should be attending.

1)These questions relate to the building of the CSD site described earlier.

a)One of the discussions about the change to a Java site revolves around whether it needs a ‘plain ordinary’ (POJO) Java-based site, or a ‘Spring framework’-based one. Discuss at least two or more points that you would consider as influencing factors to be brought up at one of the meetings on this issue.

[8]

b)One of the problems with the current site, i.e, the non-Java based one, is that it doesn’t handle mobile users very well. Explain why this might be happening and discuss at least two strategies that could mitigate this problem.

[7]

c)The code below is from a Java Server Page (JSP) page to display details from a table called ‘staff’ sitting behind the CSD web site. This code WORKS as it is. There are no errors with the code. However, it does not follow ‘best practices’. Explain

(1)what the issues with the page are,[5]

(2) and how you would improve the code.[5]

<table border=\"1\"<tr<%

ResultSet rs = null;

int numColumns = 0;

StringBuffer qry = new StringBuffer(1024);

qry.append("select * from staff");

stmt = dbCon.createStatement();

rs = stmt.executeQuery(qry.toString());

rsmd = rs.getMetaData();

numColumns = rsmd.getColumnCount();

while (rs.next()) {

out.println("<tr>");

out.println("<td>" + rs.getString(“fname”);

out.println(“ “ + rs.getString(“lname) + </td>");

out.println("</tr>");

}

rs.close();

stmt.close();

%>

</table>

2)Some of the members of CSD have been asking the developers about web services.

a)An issue being raised by some staff and students is that they would like to be able to use web services to retrieve details about their activities and research projects. For example, staff would like to be able to retrieve a list of projects they have worked on over a given time frame, while the students would like to retrieve a list of classes and the associated practicals and lectures. Both staff and students think that these items could better integrate the CSD site with their day-to-day needs.

(1)Explain how this could be accomplished listing the software components and the Java classes involved. [5]

(2)Provide a diagram showing the web service components and how they connect to the application classes. [4]

b)Web service responses can be in a variety of file formats. Explain what two or three different web services would offer, and which one would be the most useful for the staff and students to use to integrate RPC, doc/lit and RESTful responses into their own software applications.

[7]

c)Explain how you would code a parser of XML ‘course’ objects to take them from the document and put this into a Java ‘course’ class. You do not need to write the code for the parser. You need to explain what it would do, and how it would find and move items from the XML document to Java instances.

[9]

3)One of the new features the developers of CSD site want to provide is a ‘profile’ type of system to enable a bit of social networking within the department, and with ‘friends’ at other universities. The basic idea is that staff and students provide some details about themselves and their interests, which can be used as part of a social network API to find others with similar interests.

a)It is debatable as to what extent sessions should figure in the process. Explain what role sessions play and how you would integrate them (or avoid them altogether) in the ‘social network’ API system described here.

[7]

b)The company is having a hard time working out the best location for handling application control of the ‘social network’ API system. Should it be in a JavaBean or in a servlet? Both options seem to make sense. Explain the benefits and drawbacks of both options.

[8]

c)For the code below do the following:

(1)Explain what the it represents, [4]

(2)where similar code would be found, and [3]

(3)any other significant features about this type of code. [3]

soapenv:Envelope

xmlns:soapenv=

xmlns:xsd=

xmlns:xsi=”

<soapenv:Body>

<ns1:getCartResponse xmlns:ns1=

<ns1:result>Joe Brown, honours student, Java and ruby on rails

</ns1:result>

<ns1:getCartResponse>

</soapenv:Body>

</soapenv:Envelope>

4) A further possible extension of the departmental site is to incorporate Amazon’s Web Service (AWS) offerings. This could be done in a variety of ways, as a means to provide greater ease of access to services the department is using for research as well as a means to provide greater space for file storage.

a)Explain how Amazon’s S3 could be used in connection with file storage of student and staff files.

[8]

b)Some of the department’s projects require processing of images and files. Explain how this could be done using AWS in connection with the departmental web site.

[10]

c)What problems would need to be monitored with respect to using AWS behind the departmental web site.

[7]