0 ratings 0% found this document useful (0 votes) 14 views 19 pages Advance Java Assignment
The document discusses web frameworks in Java, highlighting popular options like Spring MVC, Spring Boot, Apache Struts, and JavaServer Faces, along with their advantages for web application development. It also introduces Remote Method Invocation (RMI) and Common Object Request Broker Architecture (CORBA), explaining their architectures and processes for creating distributed applications. Additionally, it outlines the pros and cons of RMI and compares it with CORBA, emphasizing their respective functionalities and limitations.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here .
Available Formats
Download as PDF or read online on Scribd
Go to previous items Go to next items
Save Advance Java Assignment For Later
Ju
ATP Assignment rae Le
Fo
_ 4 hatis web framework? Lisrdome popular Web frameso” |
i
A
Java with descriptions for cach» What art the advan ob
anol Als advantages of uslog web framework’ fer Pf |
development 2
A web framework $5 soprware fm
@ shuctured vony to buill web applicatons Irogfers
Macle tools , librarlty ,ancl APLs tohandle common
lopment tasks suvh as request cut routing datab4s ¢
mework thar provides
ready - |
web deve
ACESS: SAplon Management jandl secur.
Some Popular Web frameworks for Java arer
Spring MVC:
Spring MVC ts a wide used Java web framework that
follows “the Model- View Controller (MVC) architecture « It separ:
atu business logic, user tnterace , 9nd Control flow, mania
applications easier 10 maintain and scales Spring MVC supporTs
RESTful web services and Integrates smooth}y with other Spring.
modules imag IF Saltable for enterprise -lwel applicatto ng «
Spring Boot s-
ring Boot * an extension atthe Spring Framework desig-
ned i lenplfey applicaton derlofent ir rnuces ¢on fi orate
Complealty by providin lefaylt settings aod embedded fervers
such as Tomcat and Tettye Spring Boot allow § developers to
create standalone ; prodticton- tad y applicators quickly and
Is commonly Viel for microservices architectures «
‘) Apa che Struts §-
Apache StutS Ny an Open-Source Java web framework taf
aljo follows MVC patterns H- hd ps developed organl2€ Ia web |
applicaHons eR bushes) logle from presentaHon
togios \r was reo jee ar in the pagF, Hs usage has decline
eC
In (erns+WI! JavaServer Faces (ISP)
| VS is acomponent - based java web frame wo 1K mala
| Ved for bulleling user Interfaces: He providles reusable ms .
| Components and simplifies event hondlling andl page naviga nn
itis often ysedl in enterprise applicators that requires Wich of
| Voterace:
LH? bernate t- o
| Hibernate fs nota ful] web framework but ty frequer
Used with Java web pisses r clatabase thew is
[HFS an Object ReleHonal Mapping (ORM) foo! Strat slmplift
(database operatons allowing dévelopers te work with Yava
[Objects Instead of (aL querlde HHintegrates well with framusolk
Nike Spring MV Cand JSF: |
Advi Ing Wi mewo/K) Are t-
+ Speeds up applicator development with ready -macle components |
| andl libraries: |
. | Encourages code reusablilfy and modular design. |
«| Follows standard design pattern (e-g- MVC For better oganizeHon
| and malataln qb lity. |
‘ | Provides puilt-in securlty features I'ke authenticatlon, authorizet-
| Fon and data validation: |
Maka applicatons mort, Scalable and easler to Manage au they gros.
|
Sreep learning curve for beginners duc to framework
trae ioe pe 9 fremewors Se3N
May inhoduce performance overhead becauje of Addittong| absiva.
GHon layers:
Limited flexibiligy 4 developers must follow the framework's rule, |
and structure»
Dependen vy andh companllty isue Can arse with frameso/K
| updates:OT
2) Give short intracluctlon of RML tn java and caplain the architec
[ture of RMI Deacribe the process of Creatlon andl execution éf
| Simple RM appllcatton with suitable. exomples
Ass Remote Method Anvocaton (RML) tS 4 Java technoleg that
| Allows an object running in on ¢ Java Virtual Machine ( vm)
| to Invoke methods of a9 object running in another Tv, possl-
[bly on a different computers RMZ enables distributed Computiey
| by allowing Java program to communicate and share object ovr
| a network asl ny were local It follows 4 ollent ~ server model).
Where the client quests Services andl the Jerver_provideg them
| Architecture of RML
{
| aed [sar]
Skeleton
RRL “ee x0
Netwotk Connection “ra sport Ts
os ee: ig yor
fF
Transport Layer
The archifecture of Java RML is based on several Components
that work together tocnable remote Communication -
Glient
Stub
RRL (Remote Reference bayer)
Transport bayer
©) Skeleton
eo Sever
seemiss oo ce The oppor layers.
fl Stub
“The Clitot ts the application or program that requests servis
Fm a remote objects In AML: the cliemt fateracts with the
remote object as fit were a local object. It docs not need ie
Know the details of network Communitaton or the locaton of f
Server object. The (lleat invokeayremote abject throygh a stv?
methods on
Which acts aya local representative ofthe remote objects:
The Stub is @ Client-Side proy r the Femote object ree
the Complulty of remote commin{catonfrom the cleats When he
Client Calls & meth ed on the Stub the Stub forward the requot
othe temote object VIG the RMI runtmes The stub is responsi
ble for marshalliag 1 whlch 15 the process of Convertn es
Parameters into 4 format Suitabl¢ for tranimisslon aver the 0
VK
3 TRRL [Remote Reference Layer ) i
“The RRL fs responslble for managing references to remok
objects and malatelnin the ComniuntcaHon between Clients ano
Server Stubse [+ estublishes a Virtual connecHon between the
Glink and the Servers The RRL ensured that requats from phe
Stub reach the correct remote object on the server ) andl that
yaponse are retuned properly the Cleat:
+ | Transport Layer i-
“The FransporF layer handl ts the actual network CommunicaHon
between the Ultat Gnd Jervers/+ Manages the network Connect
data transfer, and low-level protocol detyll 3 such a4 TPIZp.
| The trunspork lager ensures that the remote method InvoceHon o¢ey
| reliably over the network , absiva cting the detally of deta ra Up
in Sa
én,SSL
| The Skeleton is the Server-Side Gounterpart of
Older Fava verslons:, in newer verslonsy Skeletons are
Internally). Ht receives tequests from the RR} and vamarshals
| 1 beet
[the patameters, passing them to the actual temote Ob) f
|Implementarton. Nyter the method exccuts, the skeleton Jone
| the rauits back to the CHent via the \tuh-
the stab Cie
handled
|
| “The server hosts the actual remote objects that prov’ ater
| Services requesteol hi Cllonts IF implements the ee -
| face And (ontelns Ye logic for the method 5 invoked by 2.
| Glleat «The server register § ity remote objects with peal
tq se $0 that ollent$ can look them up and estearblls
| unicedion via Stubs.
| Process of Creating and Executing a Simple RMZ Applicaton:
The development of 4 Simple RML application involves the follow!
Ing skpsir
4)| First, a remote be is created that declare the methods
lo be invoked remotefy + This integae must extencl fava etmi+
| Remote , and allmethods must throw Remote ExcepHon «
J) Second) @ remote abject implemeaterHon Class is whtten that
implement the remote interface: This Class (ontalns the actua )
| method definitions:
3)|thivds @ server program is created» The server create an
| instance of the Femot object and registastt with the RM].
| Registry vlog 4 unique name+
wil Fourth , a clleat Program is written «The Cleat looks up the remy.
lye object from the RML Reghstry and invokes HU methods.
ide Woe| eee
Wy, the applic is cor pileet acl exec uted Stating the
RML Regism then the server, anc finally the élerts
mpott java-rmi. %;
Public interface AdderInterface extends Remote |
| Public int add Lint x, tot y) throws Remoteé xeephon :
| 9
|
StepI- Implementation of Remote object
| Code
j
import javastmi. *;
| import Jovavimis Servers t;
| public Class AdderClass extends Unicast Remete Object implenrents
|
|
|
|
|
Adder Interface
protectecl AdderClass() throws Remote fxcepHon
| Super ();
| 4
public int AddCintx , inty )
Yeturn xty 1
jStep3e Greate Adderserver and hos Pamgeic |.
Code.
Import Java. rmi, *;
Wn port [Link]. Yegiony Registry
Public class AdlderServer
igi State vold man (String Flaws)
try
£
j AdderInterace obj = new Rdder Class () 5
| Namlag. reblad ("ADD obj); // +o Magister the name
Systerns out printin(" Server Started 1");
Catch Exception )
&
€- print Stack Trace () $
5
j
5
Step 4 Create Cllent Program
Codle
| import javarmin® 5
Import [Link]). ras tj
poblic Class Client
&
pedlic Stare vold maln
' (Stray (1 args)
"y
\AdderIntceface obj = (Adder Interface) Naming. lookup" ADD i a
| int Yess objeadd (30,40)
| System. out. printin(" The result of additlon is 5 “4 03) 5
Catch CExcepHon ¢)
; o£
| e-priatstackTrace ();
5
|
Ps
Steps 40 ron +hls RMZ applleaHoa -
«| Save il the above java file into a dire ctoy and nome itas
| “ymidemg "
Compile all the jova file LL jovac ava]
| Start RML regis tat Ymiregl
9 ne [s mireg sy]
Run Addersuver, L java AdderServer el 7]
| Run Cllant file in another prompt L java AMeotel J]
Agter that See the reyult:
°|
8:| List the pros ong Cons oF RMI |
S| Pros of RMI ares |
| Allows calling methods: on remete objects as if they were local
Supports object- orenteel programming and distibukel Compete:
* | Provides shang type safety using Jova interpeces:
© | Automatically hand) es object sertalizaten and desertalizahen:
. Offers bull#ain Securtty features:
e |taiegrates well with other Java techno legies & frameworks:
|
|
| Gons of RMZ are:
Rael Ts |
Werks ony with java; lack S Support for other programming Jaa-
| uage-
| Performan c¢ overhead duc to network Communication Ga¢l serialize
athens
| Diffcult te debug and tert distributed! applicatens.
|More cemplex setup invelving AML regisiny Anel ConfigureHen.
| Net ideal for large —Scale interact.
.
oehs What is CORBA? Explain the architecture. of CORBA:
GORBA Common object Request Broker Architecture ) is a stend-
ard defined by the Object Management hroup (OMG) that
tnableo commtnicaten between distributed objects written a)
differen + PIA IAg languages and running on digteren t |
Platform CORBA allows G cllen+ to lavoke methods 0A 4 |
{
Pemote object as Yit were afacal abject hiding netuo(kand
Platform differences. |
“The Architecture of CORBA Oe +
TOL Skeleton
Object Request Broker CORB)
Fig- Architecture. of ZORBA
+ | Client
The Client is the application or program that initiates for e
service from a remote objects In (ORBA, the cllent cloun'tneed
+o Know the detalls oF Wher or how the server object is iemplemarteel
He Simply call$ methods on the object ay if if were local y while the
under [ying CORBA infrastructure handles Communtcaton , requ est
forwading , and response remeval.The IDL Canterface Definition Language) Stub-acts as a prory fo" 4
Cleat H+ provides the Llitat with an interface to the remote
object and hidy the Compleaity of net oork communication “The |
Stub tronslates the cient) method! calls lato 4 requerk message flow
Mat that the ORB can undedtand ;Inclucling marhalling T+ |
Parameter so thay Can be transmitted over the nctwork To tH |
| Savers
30RD Lobject Request Broker) :- |
| The ORG ts the core Component of CORBA arcaleectures HH |
| facilitates Communicaton between clients and server objects 1T¢G-|
| Ardless of thar location oF the Programming langage theg are,
| lmplementeel In» The ORB recelves requests trom the. Cleat stv |
locatuy the appropriate Sewer object 1 forwarels the request Ae |
returm the upon (e back fo the clleat
He Request t-
The request repaesents the message or operation Seat by the |
Gllent +o the Server VIG. ORIB- IF contain J Informertto a tout the
Method to be invoked and an Y Associated parameters. The request |
19 responsible for tain spor Hing Cllent Intention) to the sevvyy In
astaadardlcol format, enabling Seam) el) remote. proe edure Calls.
eee —
S| LOL Skeleton ;-
The IDL Skcleton resides on the serverside and acts as a
Counter part to the clicat Stub: It tecedva the requat from the
ORB, vamacshalt the parameters, and invokes’ the actual metho of
on the server Object. The Skeleton translates the serves éPonse
foack Into 4 menage format sultable for ORG to send to the
| Clute+| Server
The Server hosts the actual object that Implements the reque-
Fed opteationy «It performs the necenary provening and buslncss
logic as defined Inthe objcet!s metrods:I
s Digfercoigne between RMT and CoRis Ae
oy! the, Alypererces between RMI and CORBA are i
a Tbjeck Requedt Bo
Remote Melhor nl Towecatien (Re) Sh sw] [ae q08 Kr Cg GAL-——
Supports unly Je ao oth ae, manga
YpPo unly Savas i fost, tir, Pylon ie)
Used IDL Claterpare Deptalttea
Language) +
2)} Uses Java inter fares
3) Uses Tava RM runHne:
VS & Object Request Broker
CORB) « |
Sultable gor full range of dish
buked system
5) “Hat bettwr Joalabilgy.
4)| Suitable. for $mall cllyiibuked
scalability is q
tee HO 8
Major concerns
Java ohject-40- object com.
munication:
)) Gros) ~ “language object communi-
caton+ |
7] More c Complex due Fo WL and
ORB:
Slightly Slower due ty extra ]
abshacHon+
eee ~19)] High Interaperabliltg-
Simpler “Pe le chvelop and
Vse*
Fastw in pure “Java environ.
ments
=.
“CBA security service.Discuss aboot JDL .-
Totipace DefintHon Language (1Db) iN 4 language wed Ve
CORBA to define the interfaces of Alstrtbutecl objects * - |
langua ge “independent and platform ~Independlent aniee |
1+ dpecitits whet operators an abject can ee an
Typ cs I+ Uae and the method (Ignaturcsy but i+ docan'® dee
how those operatlins are implemeatcel- LOL acts as 4 conte
Yack betucen the Cleat and the jevvir, ensuring that both
SIA understand how to Communkgate With €4ch other:
|
|
In CoRBA architecture, IDL plays Central role in enabll-
Ng Communication between clleatand ervey. The decloper 14
wrote an Interfact Using IDL Syntax. An LDL lompller then
translates this defniHon Into fan 4 eypcufic-code- On the
lent Side (lt generates IDL ioe Harnad as 4 pro xg fo
remote objects: On the server ide, |
+ genurates LDL Skeleton
that reeelve Cllr requests and forward them te the
adyal object (Server) * This process ensures Seamless
Communlcaten Though ORIB-are
ple png
Explain how a CORBA pragma works wlth The ie oe, td
AM CORGA pragram works by allowing 4 client objec |
™cthods on 4 remote server object usin g ORB as middleware |
© Communication tj Independent of programming fanguag ©
Ino Platform «(ORBA achieves thy ving IDL sohlch defins
© Contract between lent andl server:
¥
>
|
First, the developer defines the interface of the remote object 4
Hang 2OL-This LOL file spceifies/4he actheds, porame#rs, an
"hr tupes but déen't include implementeHon detalls
Next an ZDL Compiler Converts the 1p)
L file Into language ~peclHe.
Gode*This process generates étubs for cheat side and skedefens |
for Saver slde«thae goreated files hanelle Communlcatlon
wlth the ORB:
Onthe server side , the developer implemcats the methods defin col
inthe LOL hy extending the generated skelehon alas) TK eset
iniHalles the ORB, creates the Servant object, andl re Iters
it wlth the Naming Savlee $0 that dlents can locate IL.
On the Ulleat lde, the chen hitall2e the ORB, looks up the rem
ote objet [0 the aml SUC and Invakes meth eos Opp
the stub-The OR} forwardls the requats t0 the Jevver, cxeeestes
the Mtthod and reums results to the Cltente
The entre Communication Procem i Hardie by the ORB «
Steps fe Develop ancl Execute CORBA Program o
write the ZDL file
: Compile the IDL Using an LDL compller.
i dmplement the Server-side Object.
4 create and ton the CORBA Sayver.
¢} Greate aad Yon the CoRGA Glleate
Bea age Lat
ee a a
aORBA Program Example =
Step4: ZDL File CHello-tal)
Code
Module HelloApp
x
interface Hello
4
Sting SqyHello ())
jy
Step-2: Server Amplumenterton (Hellodmpl- java)
bode
import HelloApp. #5
import argeom “CORBA ty
Import ory omg Porta bleSevvey-.#
aes ass HelloZmp! extends ae
ri String SayHello (J
roure "Halo from Congn Server";
;
Stp3; Server Program (Hello Sex
Gods
import HelloApp-*:
impor org Org. Coega.*)
import org. ang Portab Ie Server, t;
Import org: ong. CaNaming +; t
St
vor java)Eo —
‘public. Class Helloseever
L
Publle grate volol main (Sting £Jacgs) |
& |
‘9 |
£ |
ORB orb > ORBs IniF Grgs null); |
POA reo#POR = POAHe per. nanow (
orb» Fegolve —Inltial references ("RootPOA’))i |
YootPON. the. -POAManagey (J) actlve ()5 |
HalloImp! hellolmpl > new Hellodenp! (J) \
01g 09: CORGA. Object ref toeHPOR. servant reference (|
hellodmpl); |
Hallo href = HelloHelper, narrow (ref]} |
Org: OMG: CORBA Object obj Ref 2 |
OY bs Fsolve Inia. reperen des ('Nameservite "5 |
NamingleotaskExt ncRef> Naninglotstécthelpernaro beg)
NERY. rebind (ncRys to-nam¢ ("Adloserviee ‘) hr¢)j |
System «out Panta (" CORBA Sever Feady "yy |
orb-run Ls |
Catch CExcepHon ©)
if
+ PrintStackTrace ())
|
|etc cg nage nner
Step 4s ChenF Program ¢ HulolIlent. java)
Code
Import HulloApp.* 5
import 0-079 «CoROA.;
Import arg 0 a. (asNaming +}
Poblie class Hellolilear
L
fea Vold Main ( String (1 argu)
ORB orb > ORG-Inl+ Largs, null);
org: omg. CORBA. Object objR 2
Orb « Feolve- Initlal—reperences U" Mame feyvleg*))
Naminglakeat B+ neRep Naming Contertéxt Helpar narrow (obj
Halo hello = Mellor. nanow( NRE Kole SH (
"Halloservice"));
Lhello-SayHtellol J)
/
Systems out printing
Catuh dxcepHon e)
L
€ prot St9CK Trace () )
j
}
Executon Provey
+ | Compile ZOL us Ing IDL Compiler,
+| Complle java las,
| starr Naming Javice.
| Ron CORBA Sewer
=|Run CORBA Ulleat.
a
Brews<——————___— smcsicanhegmsientanisi
| Ust the Pros and Cons of CORBA:
fos Pros of. CORBA ore
* Supports moltipl Programmiag languages and platforms:
Enables interoperabity in heteragencous dunbubecl ystems
Provides locatton Trani parency for remote objects:
Uses TOL for ear Separatlon of interface ancl Implementertea-
Offers standard services Ike Naming: Securty and Tranjachon
Sorvices -
°
.
Sultable per large Scale and enterprise-level applcatons
Gons of CORBA ares:
© | Complex architecture. and algfcult to leam.
Requlra addin al STEPS Suh oS ZL writing ancl CompllerHon,
| Higher development ane maintenance ver head.
| Performance Can be Slower duc to ORB and abstracton layer?-
pebagging and fesheg 4c Complicated! In cllctrib uttet coulronmen
Cs
e
o
‘Lew populay today lomparcel to mocle web Jerulee technologies
|
|