Sie sind auf Seite 1von 4

Online Examination

QUESTION PAPER

Curriculum: ACCP2005 Exam Date:


Subject: EJB 03/03/2009

Duration: 120 minutes Total Marks: 25

MODUL TEST PRACTICAL

EJB

Practical Paper QP Page 1 of 4


Question 1: [15]
Create a Stateless Session Bean application to do the following tasks:
1. Create a bean named “PriceList”, which provide the price of some Mobile

phones [4]
2. Create 2 bussiness methods named “Nokia7200()” and “SamsungE700()”,
which return the price of a Nokia7200 and a SamsungE700 mobile phone.

Return type is integer [3]

3. Create a web client application to use that bean

When user choose the corresponding mobile phone in the form and submit, then

connect to the bean and display the result [6]

4. Set BASIC Security mode in Web Application so that only role “admin” can

use the services [2]


Question 2: [10]
Create a BMP entity bean application to do the following tasks:
- The bean map to table tblProduct (id,productName) in the Database (SQL
Server 2005). There are methods findByPrimaryKey() and remove().
- Create a Swing Client to connect to BMP Bean
o Find a product by id with id=1. Display productName of that
product
o Remove a product.

* Note:
Use file sqljdbc.jar included to connect to this database when needed
Driver: com.microsoft.sqlserver.jdbc.SQLServerDriver

Practical Paper QP Page 2 of 4


URL: jdbc:sqlserver://serverName:port;databaseName=…";
- Refer the getInitialContext() method
private static Context getInitialContext() throws NamingException
{ Properties properties = new Properties();
properties.put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.factory.url.pkgs",
"jboss.naming:org.jnp.interfaces");
properties.put("java.naming.provider.url", "jnp://127.0.0.1:1099");
properties.put("jnp.disableDiscovery", "true");
return new InitialContext(properties); }
- Refer this jboss.xml file for session bean:
<?xml version="1.0" encoding="UTF-8"?>
<jboss>
<enterprise-beans>
<session>
<ejb-name>Test</ejb-name>
<jndi-name>Test</jndi-name>
</session>
</enterprise-beans>
</jboss>
- Refer this web.xml file for security:
<security-constraint>
<display-name>Constraint1</display-name>
<web-resource-collection>
<web-resource-name>AllResource</web-resource-name>
<description/>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>admin</role-name>
</auth-constraint>
<user-data-constraint>
<description/>

Practical Paper QP Page 3 of 4


<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>My Security Zone</realm-name>
</login-config>
<security-role>
<description/>
<role-name>member</role-name>
</security-role>
<security-role>
<description/>
<role-name>admin</role-name>
</security-role>
- Refer this jboss-web.xml file for security:
<security-domain flushOnSessionInvalidation="false">
java:/jaas/yourPolicy
</security-domain>

Practical Paper QP Page 4 of 4