I need to change code in Appendix A to form an MVC architecture, to send payload from the Controller to the View, then send the
I need to change code in Appendix A to form an MVC architecture, to send payload from the Controller to the View, then send the payload from the Controller to Model, and then send the payload from the Model to the View.I don't need a complete program. Just need provide the codes to reflect the necessary changes.
static class System { public void createArchitecture() { /**************************************************************** * Create the three modules/layers for 3-layered architecture * The constructors of the ModuleA and ModuleB, and ModuleC have * similar design and those all extend from Module base class: * The parameterized constructor for Module class: * public Module(Module upstreamModule, Module downstreamModule){ * * } * Create the modules without any interconnectivity. Bind the * connections later to form needed architectural pattern. *****************************************************************/ModuleA layer1 = new ModuleA(null, null);ModuleB layer2 = new ModuleB(null, null);ModuleC layer3 = new ModuleC(null, null);/* *********************************************************** * Interconnect all the layers to form a layered architecture. * Layer 1 is the top layer, Layer 2 is the middle layer, and * Layer 3 is the bottom layer. * For each layer/module: * DownstreamModule is the next (lower) layer and * UpstreamModule is the previous (upper) layer * For the top layer/module (layer 1) there is no UpstreamModule * For the bottom layer/module (layer 3) there is no DownstreamModule *************************************************************/layer1.setDownstreamModule(layer2);layer2.setUpstreamModule(layer1);layer2.setDownstreamModule(layer3);layer3.setUpstreamModule(layer2);//Create the payload with the value "My payload" string literal.Payload payload = new Payload(" My downward payload ");/* ************************************************************* * Push the payload down the layers by calling the sendDownstream method * of 1ayer 1, which will in turn move the payload to the next layer * downwards. The payload will move all the way to layer 3 and will be out. **************************************************************/layer1.sendDownstream(payload);/* ************************************************************ * Push the payload up the layers by calling the sendUpstream method * of 1ayer 3, which will in turn move the payload to the next layer * upwards. The payload will move all the way to layer 1 and will be out. **************************************************************/payload.setPayload("My new upwards payload");layer3.sendUpstream(payload);} }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started