Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Cyrus is preparing an online exam application with Java EJB technology so that the application can generate 60 different sets of questions with no

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

1) Cyrus is preparing an online exam application with Java EJB technology so that the application can generate 60 different sets of questions with no single question identical. The structure of the EJB application is as follow (img-1). Descriptions of the classes are listed in table-1. Based on the description and the comments in magenta (a colour between red and purple) in code snippet (img-2, img-3, img-4, img-5), fill in table-2 with corresponding annotation, and provide justification. Annotation-1 is provided as an example. img-1 table-1 dients File Name Description Source Packages e- mao3.dients LoadConfig.java EJB that loads configuration file, and preserve the config. value in this ejb. It provides functions that Main.java consumed by othe ejbs in same container. ExamHandler.java: EJB that consumed by EJB application clients in application container. Clients consume functions in this ejb mulitple times, when the exam taker response to each question. Response of exam taker should be preserved with same session. EJB that provides functions only in same ejb module. Variables/states do not need to be preserved within same session. Utils.java LoadConfigInterface.java- The interface for LoadConfig.java oh Test Packages Libraries Test Libraries - Configuration Fles Server Resources ejbs - Source Packages - tma03.jbs.config 2LoadConfig.java e tma03.ebs.logic ExamHandler.java Luuls.java Test Packages Libraries Test Libraries Enterprise Configuration Files e Server Resources interface t Source Packages tma3.interfaces.config LoadConfigInterface.java - tma3.interfaces.config.models AppsConfig.java tma3.interfaces.logic Examhandler interface.java Libraries ExamHandlerinterface.java The interface for ExamHandler.java AppsConfig.java A model class that act as a container to send/return between ejbs method call. Main.java The exam application cliente img-2 package tma03.ejbs.config; LoadConfig.java 3 import tma03.interfaces.config.LoadConfigInterface; import tma03.interfaces.config.models.AppsConfig; 4 6 7 8 9 10 11 //1. What type of session bean annotation should be used? 1/2. What type of concurrenyManagementType should be used? //3. What annotation to add here to ensure the ReadConfig() is called before other method? public class LoadConfig implements LoadConfigInterface { 12 private AppsConfig_config; 13 14 15 16 17 1/4. What type of annotation should be used, so that this method will run automatically after this beans is created? public void ReadConfig() { _config = new AppsConfig(); } 18 19 20 21 @Override 1/5. What type of LockType should be used? public AppsConfig GetConfig() { return config; @ 23 24 26 27 @Override 776. What type of LockType should be used? public void UpdateConfig (AppsConfig config) { _config = config; } 29 30 31 } 1 /* img-3 LoadConfigInterface.java 2 3 4 * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package tma03. interfaces.config; 5 6 7 8 import tma03. interfaces.config.models.AppsConfig; 9 10 /** 11 12 * @author Cyrus Cheng 13 */ 14 15 /* 7. All methods in its corresponding ejbs are only accessible by ejbs in same 16 container. 17 What of interface view annotation should place here? */ @r public interface LoadConfigInterface { 19 AppsConfig GetConfig(); 21 void UpdateConfig (AppsConfig config); 23 24 img-4 Utils.java 1 / * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools Templates * and open the template in the editor. package tma03.ejbs.logic; 9 10 * @author Cyrus Cheng */ 11 12 13 14 /* 8. This bean is consumed by client/ejb in same ejb modules just one time, and can be disposed after method called. What type of session bean annotation should be used? */ 15 16 17 18 /* 9. This ejb provides functions that only accessible in same ejb modules (not for ejbs in same container!) What of interface view annotation should place here? */ public class Utils { 19 20 21 22 // Add business logic below. (Right-click in editor and choose // "Insert Code > Add Business Method") 23 } 24 25 img-5 ExamHandler.java 1 /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. * package tma03.ejbs.logic; 5 6 import tma03. interfaces.config.models.AppsConfig; import tma03. interfaces.logic. ExamHandler Interface; 9 10 11 12 13 * @author Cyrus Cheng 14 15 16 17 /* 10. This ejb should perserve variables that across mulitple method calls within same session. What type of session bean annotation should be used? /* 11. This ejb consumed by EJB Application clients. What type of interface view annotation should be used? */ public class ExamHandler implements ExamHandlerInterface { 18 19 20 21 22 private AppsConfig confg; 23 24 3 25 Table-2 le Annotation @Singletone Justification The values are the same and only need to be load once only. This ejb should share among all ejbs. Therefore, Singleton is suitable. 22 Annotation Justification 32 Annotation Justificatione 42 Annotation Justificatione 5e Annotation Justificatione Annotatione Justificatione 72 Annotation Justificatione 8 Annotation Justificatione 92 Annotation 4 Justification 10 Annotation Justificatione 11 Annotatione Justification 1) Cyrus is preparing an online exam application with Java EJB technology so that the application can generate 60 different sets of questions with no single question identical. The structure of the EJB application is as follow (img-1). Descriptions of the classes are listed in table-1. Based on the description and the comments in magenta (a colour between red and purple) in code snippet (img-2, img-3, img-4, img-5), fill in table-2 with corresponding annotation, and provide justification. Annotation-1 is provided as an example. img-1 table-1 dients File Name Description Source Packages e- mao3.dients LoadConfig.java EJB that loads configuration file, and preserve the config. value in this ejb. It provides functions that Main.java consumed by othe ejbs in same container. ExamHandler.java: EJB that consumed by EJB application clients in application container. Clients consume functions in this ejb mulitple times, when the exam taker response to each question. Response of exam taker should be preserved with same session. EJB that provides functions only in same ejb module. Variables/states do not need to be preserved within same session. Utils.java LoadConfigInterface.java- The interface for LoadConfig.java oh Test Packages Libraries Test Libraries - Configuration Fles Server Resources ejbs - Source Packages - tma03.jbs.config 2LoadConfig.java e tma03.ebs.logic ExamHandler.java Luuls.java Test Packages Libraries Test Libraries Enterprise Configuration Files e Server Resources interface t Source Packages tma3.interfaces.config LoadConfigInterface.java - tma3.interfaces.config.models AppsConfig.java tma3.interfaces.logic Examhandler interface.java Libraries ExamHandlerinterface.java The interface for ExamHandler.java AppsConfig.java A model class that act as a container to send/return between ejbs method call. Main.java The exam application cliente img-2 package tma03.ejbs.config; LoadConfig.java 3 import tma03.interfaces.config.LoadConfigInterface; import tma03.interfaces.config.models.AppsConfig; 4 6 7 8 9 10 11 //1. What type of session bean annotation should be used? 1/2. What type of concurrenyManagementType should be used? //3. What annotation to add here to ensure the ReadConfig() is called before other method? public class LoadConfig implements LoadConfigInterface { 12 private AppsConfig_config; 13 14 15 16 17 1/4. What type of annotation should be used, so that this method will run automatically after this beans is created? public void ReadConfig() { _config = new AppsConfig(); } 18 19 20 21 @Override 1/5. What type of LockType should be used? public AppsConfig GetConfig() { return config; @ 23 24 26 27 @Override 776. What type of LockType should be used? public void UpdateConfig (AppsConfig config) { _config = config; } 29 30 31 } 1 /* img-3 LoadConfigInterface.java 2 3 4 * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package tma03. interfaces.config; 5 6 7 8 import tma03. interfaces.config.models.AppsConfig; 9 10 /** 11 12 * @author Cyrus Cheng 13 */ 14 15 /* 7. All methods in its corresponding ejbs are only accessible by ejbs in same 16 container. 17 What of interface view annotation should place here? */ @r public interface LoadConfigInterface { 19 AppsConfig GetConfig(); 21 void UpdateConfig (AppsConfig config); 23 24 img-4 Utils.java 1 / * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools Templates * and open the template in the editor. package tma03.ejbs.logic; 9 10 * @author Cyrus Cheng */ 11 12 13 14 /* 8. This bean is consumed by client/ejb in same ejb modules just one time, and can be disposed after method called. What type of session bean annotation should be used? */ 15 16 17 18 /* 9. This ejb provides functions that only accessible in same ejb modules (not for ejbs in same container!) What of interface view annotation should place here? */ public class Utils { 19 20 21 22 // Add business logic below. (Right-click in editor and choose // "Insert Code > Add Business Method") 23 } 24 25 img-5 ExamHandler.java 1 /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. * package tma03.ejbs.logic; 5 6 import tma03. interfaces.config.models.AppsConfig; import tma03. interfaces.logic. ExamHandler Interface; 9 10 11 12 13 * @author Cyrus Cheng 14 15 16 17 /* 10. This ejb should perserve variables that across mulitple method calls within same session. What type of session bean annotation should be used? /* 11. This ejb consumed by EJB Application clients. What type of interface view annotation should be used? */ public class ExamHandler implements ExamHandlerInterface { 18 19 20 21 22 private AppsConfig confg; 23 24 3 25 Table-2 le Annotation @Singletone Justification The values are the same and only need to be load once only. This ejb should share among all ejbs. Therefore, Singleton is suitable. 22 Annotation Justification 32 Annotation Justificatione 42 Annotation Justificatione 5e Annotation Justificatione Annotatione Justificatione 72 Annotation Justificatione 8 Annotation Justificatione 92 Annotation 4 Justification 10 Annotation Justificatione 11 Annotatione Justification

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Performance Indexing In SQL Server

Authors: Jason Strate, Grant Fritchey

2nd Edition

1484211189, 9781484211182

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago