0% found this document useful (0 votes)
170 views

An Adaptive Programming Model For Fault-Tolerant Distributed Computing - Datamining

Our proposed system provides upper-layer applications with sufficient process state information (the sets) that can be used to adapt to the available system synchrony or GOS (in terms of timely and untimely channels), providing more efficient solutions to fault tolerant problems when possible. Implementing our hybrid programming model requires some basic facilities such as the provision and monitoring of GOS communications with both bounded and unbounded delivery times, and also a mechanism to adapt the system.

Uploaded by

Usha Baburaj
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
170 views

An Adaptive Programming Model For Fault-Tolerant Distributed Computing - Datamining

Our proposed system provides upper-layer applications with sufficient process state information (the sets) that can be used to adapt to the available system synchrony or GOS (in terms of timely and untimely channels), providing more efficient solutions to fault tolerant problems when possible. Implementing our hybrid programming model requires some basic facilities such as the provision and monitoring of GOS communications with both bounded and unbounded delivery times, and also a mechanism to adapt the system.

Uploaded by

Usha Baburaj
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 68

An Adaptive Programming Model for Fault-Tolerant Distributed Computing

CONTENTS 1. INTRODUCTION 1.1About Fault Tolerance 1.2Benefits of Fault Tolerance 2. ORGANIZATION PROFI ! ". #$#T!% ANA $#I# ".1 !&istin' #(ste) ".2 i)itations "." Pro*ose+ #(ste) "., A+-anta'es of *ro*ose+ s(ste) ,. PROB !% FOR%U ATION ,.1 Ob.ecti-es ,.2 /ar+0are #*ecification ,." #oft0are #*ecification ,., #oft0are Descri*tions 1. #$#T!% D!#IGN 1.1 Desi'n O-er-ie0 1.2 Conte&t Anal(sis Dia'ra) 1." Data Flo0 Dia'ra) 1., Arc2itecture Desi'n #$#T!% T!#TING 3.1 Unit Testin' 3.2 Inte'ration Testin' 3." Acce*tance Testin' 3.

4. #$#T!% I%P %!NTATION 5. CONC U#ION 6. FUTUR! !NC/ANC!%!NT# 17. BIB IOGRAP/$ 11. APP!NDIC!# APP!NDI8 A9 #A%P ! #CR!!N#

1 !NT"OD#CT!ON
1 1 About Fault Toleran$e%
DI#TRIBUT!D s(ste)s are co)*ose+ of *rocesses: locate+ on one or )ore sites t2at co))unicate 0it2 one anot2er to offer ser-ices to u**er;la(er a**lications. A )a.or +ifficult( a s(ste) +esi'ner 2as to co*e 0it2 in t2ese s(ste)s lies in t2e ca*ture of consistent 'lobal states fro) 02ic2 safe +ecisions can be ta<en in or+er to 'uarantee a safe *ro'ress of t2e u**er;la(er a**lications. To stu+( an+ in-esti'ate 02at can be +one =an+ 2o0 it 2as to be +one> in t2ese s(ste)s 02en t2e( are *rone to *rocess failures: t0o +istribute+ co)*utin' )o+els 2a-e recei-e+ si'nificant attention: na)el(: t2e s(nc2ronous )o+el an+ t2e as(nc2ronous )o+el. T2e s(nc2ronous +istribute+ co)*utin' )o+el *ro-i+es *rocesses 0it2 boun+s on *rocessin' ti)e an+ )essa'e transfer +ela(. T2ese boun+s: e&*licitl( <no0n b( t2e *rocesses: can be use+ to safel( +etect *rocess cras2es an+: conse?uentl(: allo0 t2e noncras2e+ *rocesses to *ro'ress 0it2 safe -ie0s of t2e s(ste) state =suc2 -ie0s can be obtaine+ 0it2 so)e @ti)e;la'A>. In contrast: t2e as(nc2ronous )o+el is c2aracteriBe+ b( t2e absence of ti)e boun+s =t2at is 02( t2is )o+el is so)eti)es calle+ t2e ti)e;free )o+el>. In t2ese s(ste)s: a s(ste) +esi'ner can onl( assu)e an u**er boun+ on t2e nu)ber of *rocesses t2at can cras2 =usuall( +enote+ as f> an+: conse?uentl(: +esi'n *rotocols rel(in' on t2e assu)*tion t2at at least =n C f> *rocesses are ali-e =n bein' t2e total nu)ber of *rocesses>. T2e *rotocol 2as no )eans to <no0 02et2er a 'i-en *rocess is ali-e or not. %oreo-er: if )ore t2an f *rocesses cras2: t2ere is no 'uarantee on t2e *rotocol be2a-ior =usuall(: t2e *rotocol loses its li-eness *ro*ert(>.

#(nc2ronous s(ste)s are attracti-e because t2e( allo0 s(ste) +esi'ners to sol-e )an( *roble)s. T2e *rice t2at 2as to be *ai+ is t2e a *riori <no0le+'e on ti)e boun+s. If t2e( are -iolate+: t2e u**er;la(er *rotocols )a( be unable to still 'uarantee t2eir safet( *ro*ert(. As t2e( +o not rel( on e&*licit ti)e boun+s: as(nc2ronous s(ste)s +o not 2a-e t2is +ra0bac<. Unfortunatel(: t2e( 2a-e anot2er one: na)el(: so)e basic *roble)s are i)*ossible to sol-e in as(nc2ronous s(ste)s. T2e )ost fa)ous is t2e consensus *roble) t2at 2as no +eter)inistic solution 02en e-en a sin'le *rocess can cras2 D12E. T2e consensus *roble) can be state+ as follo0s9 !ac2 *rocess *ro*oses a -alue: an+ 2as to +eci+e a -alue: unless it cras2es =ter)ination>: suc2 t2at t2ere is a sin'le +eci+e+ -alue =unifor) a'ree)ent>: an+ t2at -alue is a *ro*ose+ -alue =-ali+it(>. T2is *roble): 02ose state)ent is *articularl( si)*le: is fun+a)ental in fault;tolerant +istribute+ co)*utin' as it abstracts se-eral basic a'ree)ent *roble)s. F2ile consensus is consi+ere+ as a @t2eoreticalA *roble): s(ste) +esi'ners are usuall( intereste+ in t2e )ore *ractical Ato)ic Broa+cast *roble). T2at *roble) is bot2 a co))unication *roble) an+ an a'ree)ent *roble). Its co))unication *art s*ecifies t2at t2e *rocesses can broa+cast an+ +eli-er )essa'es in suc2 a 0a( t2at t2e *rocesses t2at +o not cras2 +eli-er at least t2e )essa'es t2e( sen+. Its a'ree)ent *art s*ecifies t2at t2ere is a sin'le +eli-er( or+er =so: t2e correct *rocesses +eli-er t2e sa)e se?uence of )essa'es: an+ a fault( *rocess +eli-ers a *refi& of t2is se?uence of )essa'es>. It 2as been s2o0n t2at consensus an+ ato)ic broa+cast are e?ui-alent *roble)s in as(nc2ronous s(ste)s *rone to *rocess cras2es D3E. Conse?uentl(: in as(nc2ronous +istribute+ s(ste)s *rone to *rocess cras2es: t2e i)*ossibilit( of sol-in' consensus e&ten+s to ato)ic broa+cast. T2is i)*ossibilit( 2as )oti-ate+ researc2ers to fin+ +istribute+ co)*utin' )o+els: 0ea<er t2an t2e s(nc2ronous )o+el but stron'er t2an t2e as(nc2ronous )o+el: in 02ic2 consensus can be sol-e+.

1 & 'enefits of Fault Toleran$e%


T2e -arious benefits of usin' Fault tolerance are liste+ belo0:

Our )o+el *ro-i+es u**er;la(er a**lications 0it2 *rocess state infor)ation accor+in' to t2e current s(ste) s(nc2ron( =or Go#>.
Failure is re+uce+ co)*are to ot2er e&istin' s(ste)s. It 0ill be a**licable to bot2 #(nc2ron( an+ As(nc2ron(. Retrans)ission is less co)*are to t2e e&istin' s(ste)s.

"

It increase t2e t2rou'2*uts in net0or< Not cost oriente+. Re+uce+ a+)inistrati-e costs. o0er error rates. Increase+ Pro+ucti-it(.

& O"(AN!)AT!ON P"OF!*E


COMPAN+ P"OF!*E
At Blue C2i* Tec2nolo'ies: Fe 'o be(on+ *ro-i+in' soft0are solutions. Fe 0or< 0it2 our clientHs tec2nolo'ies an+ business c2an'es t2at s2a*e t2eir co)*etiti-e a+-anta'es.

Foun+e+ in 2777: Blue C2i* Tec2nolo'ies =P> t+. is a soft0are an+ ser-ice *ro-i+er t2at 2el*s or'aniBations +e*lo(: )ana'e: an+ su**ort t2eir business; critical soft0are )ore effecti-el(. UtiliBin' a co)bination of *ro*rietar( soft0are: ser-ices an+ s*ecialiBe+ e&*ertise: Blue C2i* Tec2nolo'ies =P> t+. 2el*s )i+;to;lar'e enter*rises: soft0are co)*anies an+ IT ser-ice *ro-i+ers i)*ro-e consistenc(: s*ee+: an+ trans*arenc( 0it2 ser-ice +eli-er( at lo0er costs. Blue C2i* Tec2nolo'ies =P> t+. 2el*s co)*anies a-oi+ )an( of t2e +ela(s: costs an+ ris<s associate+ 0it2 t2e +istribution an+ su**ort of soft0are on +es<to*s: ser-ers an+ re)ote +e-ices. Our auto)ate+ solutions inclu+e ra*i+: touc2;free +e*lo()ents: on'oin' soft0are u*'ra+es: fi&es an+ securit( *atc2es: tec2nolo'( asset in-entor( an+ trac<in': soft0are license o*ti)iBation: a**lication self;2ealin' an+ *olic( )ana'e)ent. At Blue C2i* Tec2nolo'ies: 0e 'o be(on+ *ro-i+in' soft0are solutions. Fe 0or< 0it2 our clientsH tec2nolo'ies an+ business *rocesses t2at s2a*e t2ere co)*etiti-e a+-anta'es.

About T,e People


As a tea) 0e 2a-e t2e *ro0ess to 2a-e a clear -ision an+ realiBe it too. As a statistical e-aluation: t2e tea) 2as )ore t2an ,7:777 2ours of e&*ertise in *ro-i+in' real;ti)e solutions in t2e fiel+s of !)be++e+ #(ste)s: Control s(ste)s: %icro;Controllers: c Base+ Interfacin': Pro'ra))able o'ic Controller: I #I Desi'n An+ I)*le)entation: Net0or<in' Fit2 C: JJ: .a-a:

client #er-er Tec2nolo'ies in Ka-a:=K2!!LK2%!LK2#!L!KB>:IB M ICJJ: Oracle an+ o*eratin' s(ste) conce*ts 0it2 INU8.

Our -ision
@Drea)in' a -ision is *ossible an+ realiBin' it is our 'oalA.

Our Mission
Fe 2a-e ac2ie-e+ t2is b( creatin' an+ *erfectin' *rocesses t2at are in *ar 0it2 t2e 'lobal stan+ar+s an+ 0e +eli-er 2i'2 ?ualit(: 2i'2 -alue ser-ices: reliable an+ cost effecti-e IT *ro+ucts to clients aroun+ t2e 0orl+.

Clientele
Aray InfoTech Inquirre consultancy (U.S.A) K square consultancy pvt Ltd (U.S.A) Opal solutions Texla Solutions !ertex "usiness #achines $# InfoTech

E.isting S/stem9
T2e s(nc2ronous +istribute+ co)*utin' )o+el *ro-i+es *rocesses 0it2 boun+s on *rocessin' ti)e an+ )essa'e transfer +ela(. T2ese boun+s: e&*licitl( <no0n b( t2e *rocesses: can be use+ to safel( +etect *rocess cras2es an+: conse?uentl(: allo0 t2e noncras2e+ *rocesses to *ro'ress 0it2 safe -ie0s of t2e s(ste) state =suc2 -ie0s can be obtaine+ 0it2 so)e @ti)e;la'A>. In contrast: t2e as(nc2ronous )o+el is c2aracteriBe+ b( t2e absence of ti)e boun+s =t2at is 02( t2is )o+el is so)eti)es calle+ t2e ti)e;free )o+el>. In t2ese s(ste)s: a s(ste) +esi'ner can onl( assu)e an u**er boun+ on t2e nu)ber of *rocesses t2at can cras2 =usuall( +enote+ as f> an+: conse?uentl(: +esi'n *rotocols rel(in' on t2e assu)*tion t2at at least =n C f> *rocesses are ali-e =n bein' t2e total nu)ber of *rocesses>. T2e *rotocol 2as no )eans to <no0 02et2er a 'i-en *rocess is ali-e or not. %oreo-er: if )ore t2an f *rocesses cras2: t2ere is no 'uarantee on t2e *rotocol be2a-ior =usuall(: t2e *rotocol loses its li-eness *ro*ert(>.

Proposed S/stem%
Our *ro'ra))in' )o+el *ro-i+es t2e u**er;la(er a**lications 0it2 sufficient *rocess state infor)ation =t2e sets> t2at can be use+ in or+er to a+a*t to t2e a-ailable s(ste) s(nc2ron( or Go# =in ter)s of ti)el( an+ unti)el( c2annels>: *ro-i+in' )ore efficient solutions to fault tolerant *roble)s 02en *ossible. I)*le)entin' our 2(bri+ *ro'ra))in' )o+el re?uires so)e basic facilities suc2 as t2e *ro-ision an+ )onitorin' of Go# co))unications 0it2 bot2 boun+e+ an+ unboun+e+ +eli-er( ti)es: an+ also a )ec2anis) to a+a*t t2e s(ste) 02en ti)el( c2annels can no lon'er be 'uarantee+: +ue to failures. Our *ro'ra))in' )o+el buil+s on facilities t(*icall( encountere+ in Go# arc2itectures: suc2 as O)e'a: Go#;A: GuartB: an+ Differentiate+ #er-ices. In *articular: 0e assu)e t2at t2e un+erl(in' s(ste) is ca*able of *ro-i+in' ti)el( co))unication c2annels =ali<e ser-ices suc2 as Go# 2ar+: +eter)inistic: an+ !&*ress For0ar+>. #i)ilarl(: 0e assu)e t2e e&istence of best;effort c2annels 02ere )essa'es are trans)itte+ 0it2out 'uarantee+ boun+e+ ti)e +ela(s. Fe call t2ese c2annels unti)el(. Go# )onitorin' an+ fail;a0areness 2a-e been i)*le)ente+ b( t2e Go# Pro-i+er =Go#P>: failure an+ state +etectors )ec2anis)s: briefl( *resente+ belo0. It 0as a +esi'n +ecision to buil+ our )o+el on to* of a Go#;base+ s(ste). /o0e-er: 0e coul+ also 2a-e i)*le)ente+ our *ro'ra))in' )o+el base+ on facilities encountere+ in e&istin' 2(bri+ arc2itectures9 For instance: ti)el( c2annels coul+ be i)*le)ente+ usin' RTD c2annels b( settin' t2e *robabilities P+ =+ea+line *robabilit(> an+ Pr =reliabilit( *robabilit(> close to one: an+ unti)el( c2annels coul+ be i)*le)ente+ 0it2 a basic c2annel 0it2out an( 'uarantees D16E. T2e ti)in' failure +etection ser-ice of TCB D,E coul+ t2en co)*le)ent t2e re?uire+ functionalit(.

Modules%
I+entif( t2e status of No+e %essa'e Trans)ission C2an'e status U*+ate status

I+entif( t2e #tatus No+e9


In t2is %o+ule 0e i+entif( t2e No+e is 0eat2er li-e or not. In t2is *rocess 0e easil( i+entif( t2e status of t2e no+e an+ also easil( i+entif( t2e *at2 failure. %essa'e Trans)ission9

In t2e )o+ule 0e .ust transfer t2e )essa'e to t2e +estination or inter)e+iate

no+es.
T2e inter)e+iate no+e .ust for0ar+s t2e )essa'e to +estination. T2e recei-er recei-es t2e )essa'e an+ sen+s t2e Ac<.

C2an'e #tatus9
In t2is %o+ule 0e i+entif( t2e c2an'e+ status of no+e. T2e #tatus is N N N i-e Uncertain Do0n

U*+ate #tatus9
In t2is )o+ule 0e u*+ate t2e status of t2e no+e. T2en onl( 0e can i+entif( 02et2er t2e no+e is li-e or not.

0 P"O'*EM FO"M#*AT!ON
T,e Consensus Problem% In t2e consensus *roble): e-er( correct *rocess *i *ro*oses a -alue -i an+ all correct *rocesses 2a-e to +eci+e on t2e sa)e -alue -: t2at 2as to be one of t2e *ro*ose+ -alues. %ore *recisel(: t2e Consensus *roble) is +efine+ b( t0o safet( *ro*erties =Iali+it( an+ Unifor) A'ree)ent> an+ a Ter)ination Pro*ert( D3E: D12E9 Iali+it(9 If a *rocess +eci+es -: t2en - 0as *ro*ose+ b( so)e *rocess. Unifor) A'ree)ent9 No t0o *rocesses +eci+e +ifferentl(. Ter)ination9 !-er( correct *rocess e-entuall( +eci+es on so)e -alue.

0 1 Ob1e$tives
T2is *a*er *ro*ose+ an+ full( +e-elo*e+ an a+a*ti-e *ro'ra))in' )o+el for fault;tolerant +istribute+ co)*utin'. Our )o+el *ro-i+es u**er;la(er a**lications 0it2 *rocess state infor)ation accor+in' to t2e current s(ste) s(nc2ron( =or Go#>.

0 & 2A"D3A"E SPEC!F!CAT!ON


Pro$essor "am 2ard Dis4 Compa$t Dis4 !nput devi$e 9 An( Processor abo-e 177 %2B. 9 125%b. 9 17 Gb. 9 317 %b. 9 #tan+ar+ Oe(boar+ an+ %ouse.

Output devi$e

9 IGA an+ /i'2 Resolution %onitor.

0 5 SOFT3A"E SPEC!F!CAT!ON
Operating S/stem Te$,ni6ues Data 'ases Front End 9 Fin+o0s 2777 ser-er Fa)il(. 9 KDO 1.1 9 %icrosoft #?l #er-er % Ka-a #0in'

Bac< !n+

9 #?l #er-er

0 0 Soft7are Environment 8ava Te$,nolog/


Ka-a tec2nolo'( is bot2 a *ro'ra))in' lan'ua'e an+ a *latfor).

T,e 8ava Programming *anguage


T2e Ka-a *ro'ra))in' lan'ua'e is a 2i'2;le-el lan'ua'e t2at can be c2aracteriBe+ b( all of t2e follo0in' buBB0or+s9

#i)*le Arc2itecture neutral Ob.ect oriente+ Portable Distribute+ /i'2 *erfor)ance Inter*rete+ %ultit2rea+e+ Robust D(na)ic #ecure

Fit2 )ost *ro'ra))in' lan'ua'es: (ou eit2er co)*ile or inter*ret a *ro'ra) so t2at (ou can run it on (our co)*uter. T2e Ka-a *ro'ra))in' lan'ua'e is unusual in t2at a *ro'ra) is bot2 co)*ile+ an+ inter*rete+. Fit2 t2e co)*iler: first (ou translate a *ro'ra) into an inter)e+iate lan'ua'e calle+ $ava yte codes Pt2e *latfor);in+e*en+ent co+es inter*rete+ b( t2e inter*reter on t2e Ka-a *latfor). T2e inter*reter *arses an+ runs eac2 Ka-a b(te co+e instruction on t2e co)*uter.

Co)*ilation 2a**ens .ust onceQ inter*retation occurs eac2 ti)e t2e *ro'ra) is e&ecute+. T2e follo0in' fi'ure illustrates 2o0 t2is 0or<s.

$ou can t2in< of Ka-a b(teco+es as t2e )ac2ine co+e instructions for t2e $ava !irtual #achine =Ka-a I%>. !-er( Ka-a inter*reter: 02et2er itHs a +e-elo*)ent tool or a Feb bro0ser t2at can run a**lets: is an i)*le)entation of t2e Ka-a I%. Ka-a b(teco+es 2el* )a<e @0rite once: run an(02ereA *ossible. $ou can co)*ile (our *ro'ra) into b(teco+es on an( *latfor) t2at 2as a Ka-a co)*iler. T2e b(teco+es can t2en be run on an( i)*le)entation of t2e Ka-a I%. T2at )eans t2at as lon' as a co)*uter 2as a Ka-a I%: t2e sa)e *ro'ra) 0ritten in t2e Ka-a *ro'ra))in' lan'ua'e can run on Fin+o0s 2777: a #olaris 0or<station: or on an i%ac.

T,e 8ava Platform


A platfor% is t2e 2ar+0are or soft0are en-iron)ent in 02ic2 a *ro'ra) runs. FeH-e alrea+( )entione+ so)e of t2e )ost *o*ular *latfor)s li<e Fin+o0s 2777: inu&: #olaris: an+ %acO#. %ost *latfor)s can be +escribe+ as a co)bination of t2e o*eratin' s(ste) an+ 2ar+0are. T2e Ka-a *latfor) +iffers fro) )ost ot2er *latfor)s in t2at itHs a soft0are;onl( *latfor) t2at runs on to* of ot2er 2ar+0are;base+ *latfor)s. 6

T2e Ka-a *latfor) 2as t0o co)*onents9


T2e $ava !irtual #achine =Ka-a I%> T2e $ava Application &ro'ra%%in' Interface =Ka-a API>

$ouH-e alrea+( been intro+uce+ to t2e Ka-a I%. ItHs t2e base for t2e Ka-a *latfor) an+ is *orte+ onto -arious 2ar+0are;base+ *latfor)s. T2e Ka-a API is a lar'e collection of rea+(;)a+e soft0are co)*onents t2at *ro-i+e )an( useful ca*abilities: suc2 as 'ra*2ical user interface =GUI> 0i+'ets. T2e Ka-a API is 'rou*e+ into libraries of relate+ classes an+ interfacesQ t2ese libraries are <no0n as pac(a'es. T2e ne&t section: F2at Can Ka-a Tec2nolo'( DoR: 2i'2li'2ts 02at functionalit( so)e of t2e *ac<a'es in t2e Ka-a API *ro-i+e. T2e follo0in' fi'ure +e*icts a *ro'ra) t2atHs runnin' on t2e Ka-a *latfor). As t2e fi'ure s2o0s: t2e Ka-a API an+ t2e -irtual )ac2ine insulate t2e *ro'ra) fro) t2e 2ar+0are.

Nati-e co+e is co+e t2at after (ou co)*ile it: t2e co)*ile+ co+e runs on a s*ecific 2ar+0are *latfor). As a *latfor);in+e*en+ent en-iron)ent: t2e Ka-a *latfor) can be a bit slo0er t2an nati-e co+e. /o0e-er: s)art co)*ilers: 0ell;tune+ inter*reters: an+ .ust;in;ti)e b(teco+e co)*ilers can brin' *erfor)ance close to t2at of nati-e co+e 0it2out t2reatenin' *ortabilit(.

What Can Java Technology Do?


T2e )ost co))on t(*es of *ro'ra)s 0ritten in t2e Ka-a *ro'ra))in' lan'ua'e are applets an+ applications. If (ouH-e surfe+ t2e Feb: (ouHre *robabl( alrea+( fa)iliar 0it2 a**lets. An a**let is a *ro'ra) t2at a+2eres to certain con-entions t2at allo0 it to run 0it2in a Ka-a;enable+ bro0ser. /o0e-er: t2e Ka-a *ro'ra))in' lan'ua'e is not .ust for 0ritin' cute: entertainin' a**lets for t2e Feb. T2e 'eneral;*ur*ose: 2i'2;le-el Ka-a *ro'ra))in' lan'ua'e is also a *o0erful soft0are *latfor). Usin' t2e 'enerous API: (ou can 0rite )an( t(*es of *ro'ra)s.

17

An a**lication is a stan+alone *ro'ra) t2at runs +irectl( on t2e Ka-a *latfor). A s*ecial <in+ of a**lication <no0n as a server ser-es an+ su**orts clients on a net0or<. !&a)*les of ser-ers are Feb ser-ers: *ro&( ser-ers: )ail ser-ers: an+ *rint ser-ers. Anot2er s*ecialiBe+ *ro'ra) is a servlet. A ser-let can al)ost be t2ou'2t of as an a**let t2at runs on t2e ser-er si+e. Ka-a #er-lets are a *o*ular c2oice for buil+in' interacti-e 0eb a**lications: re*lacin' t2e use of CGI scri*ts. #er-lets are si)ilar to a**lets in t2at t2e( are runti)e e&tensions of a**lications. Instea+ of 0or<in' in bro0sers: t2ou'2: ser-lets run 0it2in Ka-a Feb ser-ers: confi'urin' or tailorin' t2e ser-er. /o0 +oes t2e API su**ort all t2ese <in+s of *ro'ra)sR It +oes so 0it2 *ac<a'es of soft0are co)*onents t2at *ro-i+e a 0i+e ran'e of functionalit(. !-er( full i)*le)entation of t2e Ka-a *latfor) 'i-es (ou t2e follo0in' features9

T,e essentials9 Ob.ects: strin's: t2rea+s: nu)bers: in*ut an+ out*ut: +ata structures: s(ste) *ro*erties: +ate an+ ti)e: an+ so on. Applets9 T2e set of con-entions use+ b( a**lets. Net7or4ing9 UR s: TCP =Trans)ission Control Protocol>: UDP =User Data 'ra) Protocol> soc<ets: an+ IP =Internet Protocol> a++resses. !nternationali9ation9 /el* for 0ritin' *ro'ra)s t2at can be localiBe+ for users 0orl+0i+e. Pro'ra)s can auto)aticall( a+a*t to s*ecific locales an+ be +is*la(e+ in t2e a**ro*riate lan'ua'e.

Se$urit/9 Bot2 lo0 le-el an+ 2i'2 le-el: inclu+in' electronic si'natures: *ublic an+ *ri-ate <e( )ana'e)ent: access control: an+ certificates.

Soft7are $omponents9 Ono0n as Ka-aBeansT%: can *lu' into e&istin' co)*onent arc2itectures. Ob1e$t seriali9ation9 Allo0s li'2t0ei'2t *ersistence an+

co))unication -ia Re)ote %et2o+ In-ocation =R%I>.

8ava Database Conne$tivit/ :8D'CTM;9 Pro-i+es unifor) access to a 0i+e ran'e of relational +atabases.

T2e Ka-a *latfor) also 2as APIs for 2D an+ "D 'ra*2ics: accessibilit(: ser-ers: collaboration: tele*2on(: s*eec2: ani)ation: an+ )ore. T2e follo0in' fi'ure +e*icts 02at is inclu+e+ in t2e Ka-a 2 #DO.

11

How Will Java Technology Change My Life?


Fe canHt *ro)ise (ou fa)e: fortune: or e-en a .ob if (ou learn t2e Ka-a *ro'ra))in' lan'ua'e. #till: it is li<el( to )a<e (our *ro'ra)s better an+ re?uires less effort t2an ot2er lan'ua'es. Fe belie-e t2at Ka-a tec2nolo'( 0ill 2el* (ou +o t2e follo0in'9

(et started 6ui$4l/9 Alt2ou'2 t2e Ka-a *ro'ra))in' lan'ua'e is a *o0erful ob.ect;oriente+ lan'ua'e: itHs eas( to learn: es*eciall( for *ro'ra))ers alrea+( fa)iliar 0it2 C or CJJ.

3rite less $ode9 Co)*arisons of *ro'ra) )etrics =class counts: )et2o+ counts: an+ so on> su''est t2at a *ro'ra) 0ritten in t2e Ka-a *ro'ra))in' lan'ua'e can be four ti)es s)aller t2an t2e sa)e *ro'ra) in CJJ.

3rite better $ode9 T2e Ka-a *ro'ra))in' lan'ua'e encoura'es 'oo+ co+in' *ractices: an+ its 'arba'e collection 2el*s (ou a-oi+ )e)or( lea<s. Its ob.ect orientation: its Ka-aBeans co)*onent arc2itecture: an+ its 0i+e;ran'in': easil( e&ten+ible API let (ou reuse ot2er *eo*leHs teste+ co+e an+ intro+uce fe0er bu's.

Develop programs more 6ui$4l/9 $our +e-elo*)ent ti)e )a( be as )uc2 as t0ice as fast -ersus 0ritin' t2e sa)e *ro'ra) in CJJ. F2(R $ou 0rite fe0er lines of co+e an+ it is a si)*ler *ro'ra))in' lan'ua'e t2an CJJ.

12

Avoid platform dependen$ies 7it, 1<<= Pure 8ava9 $ou can <ee* (our *ro'ra) *ortable b( a-oi+in' t2e use of libraries 0ritten in ot2er lan'ua'es. T2e 177S Pure Ka-aT% Pro+uct Certification Pro'ra) 2as a re*ositor( of 2istorical *rocess )anuals: 02ite *a*ers: broc2ures: an+ si)ilar )aterials online.

3rite on$e> run an/7,ere9 Because 177S Pure Ka-a *ro'ra)s are co)*ile+ into )ac2ine;in+e*en+ent b(teco+es: t2e( run consistentl( on an( Ka-a *latfor).

Distribute soft7are more easil/9 $ou can u*'ra+e a**lets easil( fro) a central ser-er. A**lets ta<e a+-anta'e of t2e feature of allo0in' ne0 classes to be loa+e+ @on t2e fl(:A 0it2out reco)*ilin' t2e entire *ro'ra).

OD'C
%icrosoft O*en Database Connecti-it( =ODBC> is a stan+ar+ *ro'ra))in' interface for a**lication +e-elo*ers an+ +atabase s(ste)s *ro-i+ers. Before ODBC beca)e a de facto stan+ar+ for Fin+o0s *ro'ra)s to interface 0it2 +atabase s(ste)s: *ro'ra))ers 2a+ to use *ro*rietar( lan'ua'es for eac2 +atabase t2e( 0ante+ to connect to. No0: ODBC 2as )a+e t2e c2oice of t2e +atabase s(ste) al)ost irrele-ant fro) a co+in' *ers*ecti-e: 02ic2 is as it s2oul+ be. A**lication +e-elo*ers 2a-e )uc2 )ore i)*ortant t2in's to 0orr( about t2an t2e s(nta& t2at is nee+e+ to *ort t2eir *ro'ra) fro) one +atabase to anot2er 02en business nee+s su++enl( c2an'e. T2rou'2 t2e ODBC A+)inistrator in Control Panel: (ou can s*ecif( t2e *articular +atabase t2at is associate+ 0it2 a +ata source t2at an ODBC a**lication *ro'ra) is 0ritten to use. T2in< of an ODBC +ata source as a +oor 0it2 a na)e on it. !ac2 +oor 0ill lea+ (ou to a *articular +atabase. For e&a)*le: t2e +ata source na)e+ #ales Fi'ures )i'2t be a #G #er-er +atabase: 02ereas t2e Accounts Pa(able +ata source coul+ refer to an Access +atabase. T2e *2(sical +atabase referre+ to b( a +ata source can resi+e an(02ere on t2e AN. T2e ODBC s(ste) files are not installe+ on (our s(ste) b( Fin+o0s 61. Rat2er: t2e( are installe+ 02en (ou setu* a se*arate +atabase a**lication: suc2 as #G #er-er Client or Iisual Basic ,.7. F2en t2e ODBC icon is installe+ in Control Panel: it uses a file calle+ ODBCIN#T.D . It is also *ossible to a+)inister (our ODBC +ata sources t2rou'2 a stan+;alone *ro'ra) calle+ ODBCAD%.!8!. T2ere is a 13;bit an+ a "2;bit -ersion of t2is *ro'ra): an+ eac2 )aintains a se*arate list of 1"

ODBC

+ata

sources.

Fro) a *ro'ra))in' *ers*ecti-e: t2e beaut( of ODBC is t2at t2e a**lication can be 0ritten to use t2e sa)e set of function calls to interface 0it2 an( +ata source: re'ar+less of t2e +atabase -en+or. T2e source co+e of t2e a**lication +oesnHt c2an'e 02et2er it tal<s to Oracle or #G #er-er. Fe onl( )ention t2ese t0o as an e&a)*le. T2ere are ODBC +ri-ers a-ailable for se-eral +oBen *o*ular +atabase s(ste)s. !-en !&cel s*rea+s2eets an+ *lain te&t files can be turne+ into +ata sources. T2e o*eratin' s(ste) uses t2e Re'istr( infor)ation 0ritten b( ODBC A+)inistrator to +eter)ine 02ic2 lo0;le-el ODBC +ri-ers are nee+e+ to tal< to t2e +ata source =suc2 as t2e interface to Oracle or #G #er-er>. T2e loa+in' of t2e ODBC +ri-ers is trans*arent to t2e ODBC a**lication *ro'ra). In a clientTser-er en-iron)ent: t2e ODBC API e-en 2an+les )an( of t2e net0or< issues for t2e a**lication *ro'ra))er. T2e a+-anta'es of t2is sc2e)e are so nu)erous t2at (ou are *robabl( t2in<in' t2ere )ust be so)e catc2. T2e onl( +isa+-anta'e of ODBC is t2at it isnHt as efficient as tal<in' +irectl( to t2e nati-e +atabase interface. ODBC 2as 2a+ )an( +etractors )a<e t2e c2ar'e t2at it is too slo0. %icrosoft 2as al0a(s clai)e+ t2at t2e critical factor in *erfor)ance is t2e ?ualit( of t2e +ri-er soft0are t2at is use+. In our 2u)ble o*inion: t2is is true. T2e a-ailabilit( of 'oo+ ODBC +ri-ers 2as i)*ro-e+ a 'reat +eal recentl(. An+ an(0a(: t2e criticis) about *erfor)ance is so)e02at analo'ous to t2ose 02o sai+ t2at co)*ilers 0oul+ ne-er )atc2 t2e s*ee+ of *ure asse)bl( lan'ua'e. %a(be not: but t2e co)*iler =or ODBC> 'i-es (ou t2e o**ortunit( to 0rite cleaner *ro'ra)s: 02ic2 )eans (ou finis2 sooner. %ean02ile: co)*uters 'et faster e-er( (ear.

8D'C
In an effort to set an in+e*en+ent +atabase stan+ar+ API for Ka-a: #un %icros(ste)s +e-elo*e+ Ka-a Database Connecti-it(: or KDBC. KDBC offers a 'eneric #G +atabase access )ec2anis) t2at *ro-i+es a consistent interface to a -ariet( of RDB%#s. T2is consistent interface is ac2ie-e+ t2rou'2 t2e use of @*lu';inA +atabase connecti-it( )o+ules: or drivers. If a +atabase -en+or 0is2es to 2a-e KDBC su**ort: 2e or s2e )ust *ro-i+e t2e +ri-er for eac2 *latfor) t2at t2e +atabase an+ Ka-a run on.

1,

To 'ain a 0i+er acce*tance of KDBC: #un base+ KDBCHs fra)e0or< on ODBC. As (ou +isco-ere+ earlier in t2is c2a*ter: ODBC 2as 0i+es*rea+ su**ort on a -ariet( of *latfor)s. Basin' KDBC on ODBC 0ill allo0 -en+ors to brin' KDBC +ri-ers to )ar<et )uc2 faster t2an +e-elo*in' a co)*letel( ne0 connecti-it( solution. KDBC 0as announce+ in %arc2 of 1663. It 0as release+ for a 67 +a( *ublic re-ie0 t2at en+e+ Kune 5: 1663. Because of user in*ut: t2e final KDBC -1.7 s*ecification 0as release+ soon after. T2e re)ain+er of t2is section 0ill co-er enou'2 infor)ation about KDBC for (ou to <no0 02at it is about an+ 2o0 to use it effecti-el(. T2is is b( no )eans a co)*lete o-er-ie0 of KDBC. T2at 0oul+ fill an entire boo<.

8D'C (oals
Fe0 soft0are *ac<a'es are +esi'ne+ 0it2out 'oals in )in+. KDBC is one t2at: because of its )an( 'oals: +ro-e t2e +e-elo*)ent of t2e API. T2ese 'oals: in con.unction 0it2 earl( re-ie0er fee+bac<: 2a-e finaliBe+ t2e KDBC class librar( into a soli+ fra)e0or< for buil+in' +atabase a**lications in Ka-a. T2e 'oals t2at 0ere set for KDBC are i)*ortant. T2e( 0ill 'i-e (ou so)e insi'2t as to 02( certain classes an+ functionalities be2a-e t2e 0a( t2e( +o. T2e ei'2t +esi'n 'oals for KDBC are as follo0s9

1. SQL Level API


T2e +esi'ners felt t2at t2eir )ain 'oal 0as to +efine a #G interface for Ka-a. Alt2ou'2 not t2e lo0est +atabase interface le-el *ossible: it is at a lo0 enou'2 le-el for 2i'2er;le-el tools an+ APIs to be create+. Con-ersel(: it is at a 2i'2 enou'2 le-el for a**lication *ro'ra))ers to use it confi+entl(. Attainin' t2is 'oal allo0s for future tool -en+ors to @'enerateA KDBC co+e an+ to 2i+e )an( of KDBCHs co)*le&ities fro) t2e en+ user.

. SQL Confo!"ance
#G s(nta& -aries as (ou )o-e fro) +atabase -en+or to +atabase -en+or. In an effort to su**ort a 0i+e -ariet( of -en+ors: KDBC 0ill allo0 an( ?uer( state)ent to be *asse+ t2rou'2 it to t2e un+erl(in' +atabase +ri-er. T2is allo0s

11

t2e connecti-it( )o+ule to 2an+le non;stan+ar+ functionalit( in a )anner t2at is suitable for its users. ". JD#C "$%t &e i"'le"ental on to' of co""on (ata&a%e

inte!face%
T2e KDBC #G API )ust @sitA on to* of ot2er co))on #G le-el APIs. T2is 'oal allo0s KDBC to use e&istin' ODBC le-el +ri-ers b( t2e use of a soft0are interface. T2is interface 0oul+ translate KDBC calls to ODBC an+ -ice -ersa.

). P!ovi(e a Java inte!face that i% con%i%tent with the !e%t of the Java %y%te"
Because of Ka-aHs acce*tance in t2e user co))unit( t2us far: t2e +esi'ners feel t2at t2e( s2oul+ not stra( fro) t2e current +esi'n of t2e core Ka-a s(ste).

*. +ee' it %i"'le
T2is 'oal *robabl( a**ears in all soft0are +esi'n 'oal listin's. KDBC is no e&ce*tion. #un felt t2at t2e +esi'n of KDBC s2oul+ be -er( si)*le: allo0in' for onl( one )et2o+ of co)*letin' a tas< *er )ec2anis). Allo0in' +u*licate functionalit( onl( ser-es to confuse t2e users of t2e API.

,. -%e %t!ong. %tatic ty'ing whe!eve! 'o%%i&le


#tron' t(*in' allo0s for )ore error c2ec<in' to be +one at co)*ile ti)eQ also: less errors a**ear at runti)e.

/. +ee' the co""on ca%e% %i"'le


Because )ore often t2an not: t2e usual #G calls use+ b( t2e *ro'ra))er are si)*le SELECTHs: INSERTHs: DELETEHs an+ UPDATEHs: t2ese ?ueries s2oul+ be si)*le to *erfor) 0it2 KDBC. /o0e-er: )ore co)*le& #G state)ents s2oul+ also be *ossible. Finall( 0e +eci+e+ to *rocee+ t2e i)*le)entation usin' Ka-a Net0or<in'. An+ for +(na)icall( u*+atin' t2e cac2e table 0e 'o for +atabase . Ka-a 2a t0o t2in's9 a *ro'ra))in' lan'ua'e an+ a *latfor). Ka-a is a 2i'2;le-el *ro'ra))in' lan'ua'e t2at is all of t2e follo0in'
Simple

%# Access

13

Architecture-neutral Object-oriented Portable Distributed High-performance Interpreted multithreaded Robust Dynamic Secure Ja a is also unusual in that each Ja a program is both compiled and interpreted! "ith a compile you translate a Ja a program into an intermediate language called Ja a byte codes the platformindependent code instruction is passed and run on the computer! #ompilation happens just once$ interpretation occurs each time the program is e%ecuted! &he figure illustrates ho' this 'or(s! )o

8ava Program

!nterpreter

Compilers

M/ Program

u can thin( of Ja a byte codes as the machine code instructions for the Ja a *irtual +achine ,Ja a *+-! . ery Ja a interpreter/ 'hether it0s a Ja a de elopment tool or a "eb bro'ser that can run Ja a applets/ is an implementation of the Ja a *+! &he Ja a *+ can also be implemented in hard'are! Ja a byte codes help ma(e 1'rite once/ run any'here2 possible! )ou can compile your Ja a program into byte codes on my platform that

14

has a Ja a compiler! &he byte codes can then be run any implementation of the Ja a *+! 3or e%ample/ the same Ja a program can run "indo's 4&/ Solaris/ and +acintosh!

Networking
TCP/IP stack
T2e TCPTIP stac< is s2orter t2an t2e O#I one9

TCP is a connection;oriente+ *rotocolQ UDP =User Data'ra) Protocol> is a connectionless *rotocol.

!P datagram?s
T2e IP la(er *ro-i+es a connectionless an+ unreliable +eli-er( s(ste). It consi+ers eac2 +ata'ra) in+e*en+entl( of t2e ot2ers. An( association bet0een +ata'ra) )ust be su**lie+ b( t2e 2i'2er la(ers. T2e IP la(er su**lies a c2ec<su) t2at inclu+es its o0n 2ea+er. T2e 2ea+er inclu+es t2e source an+ +estination a++resses. T2e IP la(er 2an+les routin' t2rou'2 an Internet. It is also res*onsible for brea<in' u* lar'e +ata'ra) into s)aller ones for trans)ission an+ reasse)blin' t2e) at t2e ot2er en+

15

UDP
UDP is also connectionless an+ unreliable. F2at it a++s to IP is a c2ec<su) for t2e contents of t2e +ata'ra) an+ *ort nu)bers. T2ese are use+ to 'i-e a clientTser-er )o+el ; see later.

TCP
TCP su**lies lo'ic to 'i-e a reliable connection;oriente+ *rotocol abo-e IP. It *ro-i+es a -irtual circuit t2at t0o *rocesses can use to co))unicate.

!nternet addresses
In or+er to use a ser-ice: (ou )ust be able to fin+ it. T2e Internet uses an a++ress sc2e)e for )ac2ines so t2at t2e( can be locate+. T2e a++ress is a "2 bit inte'er 02ic2 'i-es t2e IP a++ress. T2is enco+es a net0or< ID an+ )ore a++ressin'. T2e net0or< ID falls into -arious classes accor+in' to t2e siBe of t2e net0or< a++ress.

Net7or4 address
Class A uses 5 bits for t2e net0or< a++ress 0it2 2, bits left o-er for ot2er a++ressin'. Class B uses 13 bit net0or< a++ressin'. Class C uses 2, bit net0or< a++ressin' an+ class D uses all "2.

Subnet address
Internall(: t2e UNI8 net0or< is +i-i+e+ into sub net0or<s. Buil+in' 11 is currentl( on one sub net0or< an+ uses 17;bit a++ressin': allo0in' 172, +ifferent 2osts.

2ost address
5 bits are finall( use+ for 2ost a++resses 0it2in our subnet. T2is *laces a li)it of 213 )ac2ines t2at can be on t2e subnet.

Total address

16

T2e "2 bit a++ress is usuall( 0ritten as , inte'ers se*arate+ b( +ots.

Port addresses
A ser-ice e&ists on a 2ost: an+ is i+entifie+ b( its *ort. T2is is a 13 bit nu)ber. To sen+ a )essa'e to a ser-er: (ou sen+ it to t2e *ort for t2at ser-ice of t2e 2ost t2at it is runnin' on. T2is is not location trans*arenc(U Certain of t2ese *orts are V0ell <no0nV.

So$4ets
A soc<et is a +ata structure )aintaine+ b( t2e s(ste) to 2an+le net0or< connections. A soc<et is create+ usin' t2e call socket. It returns an inte'er t2at is li<e a file +escri*tor. In fact: un+er Fin+o0s: t2is 2an+le can be use+ 0it2 Read File an+
Write File

functions.
#include <sys ty!es"#$ #include <sys socket"#$ int socket%int &a'ily( int ty!e( int !rotocol)*

+ere ,&a'ily, -ill .e AF/INET &or IP co''unications( !rotocol -ill .e 0ero( and ty!e -ill de!end on -#et#er TCP or UDP is used" T-o !rocesses -is#in1 to co''unicate o2er a net-ork create a socket eac#" T#ese are si'ilar to t-o ends o& a !i!e 3 .ut t#e actual !i!e does not yet e4ist"

8Free C,art
KFreeC2art is a free 177S Ka-a c2art librar( t2at )a<es it eas( for +e-elo*ers to +is*la( *rofessional ?ualit( c2arts in t2eir a**lications. KFreeC2artWs e&tensi-e feature set inclu+es9

a consistent an+ 0ell;+ocu)ente+ API: su**ortin' a 0i+e ran'e of c2art t(*esQ

27

a fle&ible +esi'n t2at is eas( to e&ten+: an+ tar'ets bot2 ser-er;si+e an+ client; si+e a**licationsQ su**ort for )an( out*ut t(*es: inclu+in' #0in' co)*onents: i)a'e files =inclu+in' PNG an+ KP!G>: an+ -ector 'ra*2ics file for)ats =inclu+in' PDF: !P# an+ #IG>Q

KFreeC2art is Vo*en sourceV or: )ore s*ecificall(: free soft0are. It is +istribute+ un+er t2e ter)s of t2e GNU esser General Public icence = GP >: 02ic2 *er)its use in *ro*rietar( a**lications.

1. Ma' 0i%$ali1ation%
C2arts s2o0in' -alues t2at relate to 'eo'ra*2ical areas. #o)e e&a)*les inclu+e9 =a> *o*ulation +ensit( in eac2 state of t2e Unite+ #tates: =b> inco)e *er ca*ita for eac2 countr( in !uro*e: =c> life e&*ectanc( in eac2 countr( of t2e 0orl+. T2e tas<s in t2is *ro.ect inclu+e9

sourcin' freel( re+istributable -ector outlines for t2e countries of t2e 0orl+: statesT*ro-inces in *articular countries =U#A in *articular: but also ot2er areas>Q

creatin' an a**ro*riate +ataset interface =*lus +efault i)*le)entation>: a ren+ere+: an+ inte'ratin' t2is 0it2 t2e e&istin' 8$Plot class in KFreeC2artQ Testin': +ocu)entin': testin' so)e )ore: +ocu)entin' so)e )ore.

. Ti"e Se!ie% Cha!t Inte!activity


I)*le)ent a ne0 =to KFreeC2art> feature for interacti-e ti)e series c2arts ;;; to +is*la( a se*arate control t2at s2o0s a s)all -ersion of A +is*la( in t2e )ain c2art. t2e ti)e series +ata: 0it2 a sli+in' V-ie0V rectan'le t2at allo0s (ou to select t2e subset of t2e ti)e series +ata to

2. Da%h&oa!(%
T2ere is currentl( a lot of interest in +as2boar+ +is*la(s. Create a fle&ible +as2boar+ )ec2anis) t2at su**orts a subset of KFreeC2art c2art t(*es =+ials: *ies: t2er)o)eters: bars: an+ linesTti)e series> t2at can be +eli-ere+ easil( -ia bot2 Ka-a Feb #tart an+ an a**let. 21

). P!o'e!ty 3(ito!%
T2e *ro*ert( e+itor )ec2anis) in KFreeC2art onl( 2an+les a s)all subset of t2e *ro*erties t2at can be set for c2arts. !&ten+ =or rei)*le)ent> t2is )ec2anis) to *ro-i+e 'reater en+;user control o-er t2e a**earance of t2e c2arts.

Data Flo7 Diagram


No+e Infor)ation

#en+er
C2ec< t2e status of No+e

i-e

Uncertain

Do0n

U*+ate #en+ For0ar+

For0ar+ Recei-e

Failure

22

#ource

#elect t2e Destination no+e

Acti-e no+e

C2ec< t2e #tatus

Return t2e #tatus

fi' 9#tatus of t2e no+e Fi' %essa'e Trans)ission


#ourc e

#elect t2e Destination no+e

C2ec< t2e status of +es If +o0n #en+ t2e )essa'e uncertian #en+ t2e )s'

#tore in te)* Destination 2"

If i-e #to* #ource

#elect t2e Destination no+e

Acti-e no+e

C2ec< t2e #tatus

U*+ate t2e #tatus

Fi' C2an'e t2e #tatus

Find Fin+ #tatus of no+e => Recei-e ac< =>

#pdate

2,

Recei-e #tatus = > U*+ate Table = > For0ar+ #tatus = >

Node Fin+ #tatus => %essa'e Transfer = > C2an'e => U*+ate = >

Message Recei-e %essa'e = > U*+ate Pac<ets = > #en+ Ac< => For0ar+ %essa'e = >

C2an'e i-e => Uncertain => Do0n =>

21

Fin+ status of no+e

#en+ %essa'e

C2an'e status

U*+ate status

23

Use case +ia'ra)

24

No+e1

#tatus

No+e2

No+e"

C2ec< #ts

i-e )eans sen+ t2e )s'

i-e )eans sen+ t2e )s'

#en+ Ac<

#en+ Ac< Uncertain )eans .ust recei-e t2e )s' Uncertain )eans .ust recei-e t2e )s'

Do0n )eans failure Do0n )eans failure

se6uen$e diagram

S+STEM DES!(N
25

@ 1 Design Overvie7
Desi'n in-ol-es i+entification of classes: t2eir relations2i*s as 0ell as t2eir collaboration. In ob.ector( :classes 0ere +i-i+e+ into !ntit( classes :interface classes an+ t2e control classes. T2e Co)*uter Ai+e+ #oft0are !n'ineerin' tools t2at are a-ailable co))erciall( +o not *ro-i+e an( assistance in t2is transition. !-en researc2 CA#! tools ta<e a+-anta'e of )eta )o+elin' are 2el*ful onl( after t2e construction of class +ia'ra) is co)*lete+. In t2e Fusion )et2o+ :it use+ so)e ob.ect;oriente+ a**roac2es li<e Ob.ect %o+elin' Tec2ni?ue=O%T>:ClassCRes*onsibilit(CCollaborator=CRC> an+ Ob.ector(:use+ t2e ter) A'ents to re*resent so)e of t2e 2ar+0are an+ soft0are s(ste)s .In Fusion )et2o+: t2ere 0as no re?uire)ent *2ase :02ere in a user 0ill su**l( t2e initial re?uire)ent +ocu)ent. An( soft0are *ro.ect is 0or<e+ out b( bot2 anal(st an+ +esi'ner. T2e anal(st creates t2e Use case +ia'ra). T2e +esi'ner creates t2e Class +ia'ra). But t2e +esi'ner can +o t2is onl( after t2e anal(st 2as create+ t2e Use case +ia'ra). Once t2e +esi'n is o-er it is nee+ to +eci+e 02ic2 soft0are is suitable for t2e a**lication

A S+STEM TEST!N(
T2e *ur*ose of testin' is to +isco-er errors. Testin' is t2e *rocess of tr(in' to +isco-er e-er( concei-able fault or 0ea<ness in a 0or< *ro+uct. It *ro-i+es a 0a( to c2ec< t2e functionalit( of co)*onents: sub asse)blies: asse)blies an+Tor a finis2e+ *ro+uct It is t2e *rocess of e&ercisin' soft0are 0it2 t2e intent of ensurin' t2at t2e #oft0are s(ste) )eets its re?uire)ents an+ user e&*ectations an+ +oes not fail in an unacce*table )anner. T2ere are -arious t(*es of test. !ac2 test t(*e a++resses a s*ecific testin' re?uire)ent.

T+PES OF TESTS #nit testing


Unit testin' in-ol-es t2e +esi'n of test cases t2at -ali+ate t2at t2e internal *ro'ra) lo'ic is functionin' *ro*erl(: an+ t2at *ro'ra) in*ut *ro+uce -ali+ out*uts. All +ecision branc2es an+ internal co+e flo0 s2oul+ be -ali+ate+. It is t2e testin' of in+i-i+ual soft0are units of t2e a**lication .it is +one after t2e co)*letion of an in+i-i+ual unit before inte'ration. T2is is a structural testin': t2at relies on <no0le+'e of its construction an+ is in-asi-e. Unit tests *erfor) basic tests at co)*onent le-el an+ test a s*ecific business *rocess: a**lication: an+Tor s(ste) confi'uration. Unit tests ensure t2at eac2 uni?ue *at2 of a business *rocess *erfor)s accuratel( to t2e +ocu)ente+ s*ecifications an+ contains clearl( +efine+ in*uts an+ e&*ecte+ results.

26

!ntegration testing
Inte'ration tests are +esi'ne+ to test inte'rate+ soft0are co)*onents to +eter)ine if t2e( actuall( run as one *ro'ra). Testin' is e-ent +ri-en an+ is )ore concerne+ 0it2 t2e basic outco)e of screens or fiel+s. Inte'ration tests +e)onstrate t2at alt2ou'2 t2e co)*onents 0ere in+i-i+uall( satisfaction: as s2o0n b( successfull( unit testin': t2e co)bination of co)*onents is correct an+ consistent. Inte'ration testin' is s*ecificall( ai)e+ at t2e *roble)s t2at arise fro) t2e co)bination of co)*onents. e&*osin'

Fun$tional test
Functional tests *ro-i+e a s(ste)atic +e)onstrations t2at functions teste+ are a-ailable as s*ecifie+ b( t2e business an+ tec2nical re?uire)ents: s(ste) +ocu)entation : an+ user )anuals. Functional testin' is centere+ on t2e follo0in' ite)s9 Iali+ In*ut In-ali+ In*ut Functions Out*ut 9 i+entifie+ classes of -ali+ in*ut )ust be acce*te+. 9 i+entifie+ classes of in-ali+ in*ut )ust be re.ecte+. 9 i+entifie+ functions )ust be e&ercise+. 9 i+entifie+ classes of a**lication out*uts )ust be e&ercise+. Or'aniBation an+ *re*aration of functional tests is focuse+ on re?uire)ents: <e( functions: or s*ecial test cases. In a++ition: s(ste)atic co-era'e *ertainin' to i+entif( Business *rocess flo0sQ +ata fiel+s: *re+efine+ *rocesses: an+ successi-e *rocesses )ust be consi+ere+ for testin'. Before functional testin' is co)*lete: a++itional tests are i+entifie+ an+ t2e effecti-e -alue of current tests is +eter)ine+.

#(ste)sTProce+ures 9 interfacin' s(ste)s or *roce+ures )ust be in-o<e+.

S/stem Test
#(ste) testin' ensures t2at t2e entire inte'rate+ soft0are s(ste) )eets re?uire)ents. It tests a confi'uration to ensure <no0n an+ *re+ictable results. An e&a)*le of s(ste) testin' is t2e confi'uration oriente+ s(ste) inte'ration test. #(ste) testin' is base+ on *rocess +escri*tions an+ flo0s: e)*2asiBin' *re;+ri-en *rocess lin<s an+ inte'ration *oints.

3,ite 'o. Testing


F2ite Bo& Testin' is a testin' in 02ic2 in 02ic2 t2e soft0are tester 2as <no0le+'e of t2e inner 0or<in's: structure an+ lan'ua'e of t2e soft0are: or at least its *ur*ose. It is *ur*ose. It is use+ to test areas t2at cannot be reac2e+ fro) a blac< bo& le-el .

"7

'la$4 'o. Testing


Blac< Bo& Testin' is testin' t2e soft0are 0it2out an( <no0le+'e of t2e inner 0or<in's: structure or lan'ua'e of t2e )o+ule bein' teste+ . Blac< bo& tests: as )ost ot2er <in+s of tests: )ust be 0ritten fro) a +efiniti-e source +ocu)ent: suc2 as s*ecification or re?uire)ents +ocu)ent: suc2 as s*ecification or re?uire)ents +ocu)ent. It is a testin' in 02ic2 t2e soft0are un+er test is treate+: as a blac< bo& .(ou cannot @seeA into it. T2e test *ro-i+es in*uts an+ res*on+s to out*uts 0it2out consi+erin' 2o0 t2e soft0are 0or<s.

A 1 #nit Testing%
Unit testin' is usuall( con+ucte+ as *art of a co)bine+ co+e an+ unit test *2ase of t2e soft0are lifec(cle: alt2ou'2 it is not unco))on for co+in' an+ unit testin' to be con+ucte+ as t0o +istinct *2ases.

Te%t %t!ategy an( a''!oach


Fiel+ testin' 0ill be *erfor)e+ )anuall( an+ functional tests 0ill be 0ritten in +etail.

Test ob1e$tives
All fiel+ entries )ust 0or< *ro*erl(. Pa'es )ust be acti-ate+ fro) t2e i+entifie+ lin<. T2e entr( screen: )essa'es an+ res*onses )ust not be +ela(e+.

Features to be tested
Ierif( t2at t2e entries are of t2e correct for)at No +u*licate entries s2oul+ be allo0e+ All lin<s s2oul+ ta<e t2e user to t2e correct *a'e.

A & !ntegration Testing


#oft0are inte'ration testin' is t2e incre)ental inte'ration testin' of t0o or )ore inte'rate+ soft0are co)*onents on a sin'le *latfor) to *ro+uce failures cause+ b( interface +efects. T2e tas< of t2e inte'ration test is to c2ec< t2at co)*onents or soft0are a**lications: e.'. co)*onents in a soft0are s(ste) or N one ste* u* N soft0are a**lications at t2e co)*an( le-el N interact 0it2out error.

Test "esults%
All t2e test cases )entione+ abo-e *asse+ successfull(. No +efects encountere+.

A 5 A$$eptan$e Testing

"1

User Acce*tance Testin' is a critical *2ase of an( *ro.ect an+ re?uires si'nificant *artici*ation b( t2e en+ user. It also ensures t2at t2e s(ste) )eets t2e functional re?uire)ents.

Test "esults%
All t2e test cases )entione+ abo-e *asse+ successfull(. No +efects encountere+.

B !MP*EMENTAT!ON
I)*le)entation is t2e sta'e of t2e *ro.ect 02en t2e t2eoretical +esi'n is turne+ out into a 0or<in' s(ste). T2us it can be consi+ere+ to be t2e )ost critical sta'e in ac2ie-in' a successful ne0 s(ste) an+ in 'i-in' t2e user: confi+ence t2at t2e ne0 s(ste) 0ill 0or< an+ be effecti-e. T2e i)*le)entation sta'e in-ol-es careful *lannin': in-esti'ation of t2e e&istin' s(ste) an+ itHs constraints on i)*le)entation: +esi'nin' of )et2o+s to ac2ie-e c2an'eo-er an+ e-aluation of c2an'eo-er )et2o+s. I)*le)entation is t2e *rocess of con-ertin' a ne0 s(ste) +esi'n into o*eration. It is t2e *2ase t2at focuses on user trainin': site *re*aration an+ file con-ersion for installin' a can+i+ate s(ste). T2e i)*ortant factor t2at s2oul+ be consi+ere+ 2ere is t2at t2e con-ersion s2oul+ not +isru*t t2e functionin' of t2e or'aniBation. T2e i)*le)entation can be *rece+e+ t2rou'2 #oc<et in .a-a but it 0ill be consi+ere+ as one to all co))unication .For *roacti-e broa+castin' 0e nee+ +(na)ic lin<in'. #o .a-a 0ill be )ore suitable for *latfor) in+e*en+ence an+ net0or<in' conce*ts. For )aintainin' route infor)ation 0e 'o for #G ;ser-er as +atabase bac< en+.

C CONC*#S!ON
T2is *a*er *ro*ose+ an+ full( +e-elo*e+ an a+a*ti-e *ro'ra))in' )o+el for fault;tolerant +istribute+ co)*utin'. Our )o+el *ro-i+es u**er;la(er a**lications 0it2 *rocess state infor)ation accor+in' to t2e current s(ste) s(nc2ron( =or Go#>. T2e un+erl(in' s(ste) )o+el is 2(bri+: co)*rise+ of a s(nc2ronous *art an+ an as(nc2ronous *art. /o0e-er: suc2 a co)*osition can -ar( o-er ti)e in suc2 a 0a( t2at t2e s(ste) )a( beco)e totall( s(nc2ronous or totall( as(nc2ronous.

"2

T2e *ro'ra))in' )o+el is 'i-en b( t2ree sets =*rocesses *ercei-e eac2 ot2erHs states b( accessin' t2e contents of t2eir local nonintersectin' setsPuncertain: li-e: an+ +o0n> an+ t2e rules R7;R3 t2at re'ulate )o+ifications on t2e sets. %oreo-er: 0e s2o0e+ 2o0 t2ose rules an+ t2e sets can be i)*le)ente+ in real s(ste)s. To illustrate t2e a+a*ti-e ness of our )o+el: 0e +e-elo*e+ a consensus al'orit2) t2at )a<es *ro'ress +es*ite +istinct -ie0s of t2e corres*on+in' local sets: an+ can tolerate )ore faults: t2e )ore *rocesses are in t2e li-e set. T2e *resente+ consensus al'orit2) a+a*ts to t2e current Go# a-ailable =-ia t2e sets> an+ uses t2e )a.orit( assu)*tion onl( 02en nee+e+.

D Future En,an$ement 1< '!'*!O("AP2+


Goo+ Teac2ers are 0ort2 )ore t2an t2ousan+ boo<s: 0e 2a-e t2e) in Our De*art)ent

References Made From :


1. Professional Java Network Programming 2. Java Complete Reference D1E C. Aurrecoec2ea: A.T. Ca)*bell: an+ . /au0: @A #ur-e( of Go# Arc2itectures:A AC% %ulti)e+ia #(ste)s K.: s*ecial issue on Go# arc2itecture: -ol. 3: no. ": **. 1"5; 111: %a( 1665. D2E #. Bla<e: D. Blac<: %. Carlson: !. Da-ies: Z. Fan': an+ F. Feiss: @An Arc2itecture for Differentiate+ #er-ices:A RFC 2,41: Dec.1665. D"E A. Ca)*bell: G. Coulson: an+ D. /utc2ison: @A Gualit( of #er-ice Arc2itecture:A AC% Co)*uter Co)). Re-.: -ol. 2,: no. 2: **. 3;24:A*r. 166,. D,E A. Casi)iro an+ P. IerXYssi)o: @Usin' t2e Ti)el( Co)*utin' Base for De*en+able Go# A+a*tation:A Proc. 27t2 #()*. Reliable Distribute+ #(ste)s =#RD#>: **. 275;214: Oct. 2771. D1E T.D. C2an+ra: I. /a+Bilacos: an+ #. Toue': @T2e Fea<est Failure Detector for #ol-in' Consensus:A K. AC%: -ol. ,": no. ,: **. 351;422: Kul( 1663.

Sites Referred:
http://java.sun.com http://www.sourcefor g e.com

""

http://www.jfree.org/ http://www.networkcomputing.com/

Sample S$reen%
#creen 19

",

"1

"3

"4

Sample Code%
TZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZT TZ TZ i)*ort .a-a.a0t.ZQ i)*ort .a-a.a0t.e-ent.ZQ i)*ort .a-a&.s0in'.ZQ i)*ort .a-a&.s0in'.e-ent.ZQ i)*ort .a-a.net.ZQ i)*ort .a-a.util.ZQ i)*ort .a-a.io.ZQ i)*ort .a-a.s?l.ZQ i)*ort .a-a.a0t.Tool<itQ i)*ort .a-a.util.Ti)erQ i)*ort .a-a.util.Ti)erTas<Q TZZ FaultCClient1 ZT ZT

TZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZT

"5

Z #u))ar( +escri*tion for FaultCClient1 Z ZT *ublic class FaultCClient e&ten+s KFra)e i)*le)ents Ite) istener [ TT Iariables +eclaration TT*ri-ate KTabbe+Pane .Tabbe+Pane1Q *ri-ate KPanel contentPaneQ TT;;;;; *ri-ate KTe&tFiel+ .Te&tFiel+1Q *ri-ate K ist . ist1Q *ri-ate K#crollPane .#crollPane2Q *ri-ate KTe&tArea .Te&tArea2Q *ri-ate K#crollPane .#crollPane"Q TT*ri-ate KPanel .Panel1Q TT;;;;; *ri-ate KTe&tArea .Te&tArea1Q *ri-ate K#crollPane .#crollPane1Q *ri-ate KPanel .Panel2Q *ri-ate KRa+ioButton .Ra+ioButton1Q *ri-ate KRa+ioButton .Ra+ioButton2Q *ri-ate KRa+ioButton .Ra+ioButton"Q *ri-ate KTe&tFiel+ .Te&tFiel+2Q *ri-ate KButton .Button1Q *ri-ate KButton .Button2Q *ri-ate KButton .Button"Q *ri-ate ButtonGrou* btnGrou*1Q *ri-ate K abel . abel1Q *ri-ate K abel . abel2Q *ri-ate K abel . abel"Q *ri-ate K abel . abel,Q *ri-ate K abel . abel1Q *ri-ate K abel . abel3Q *ri-ate K abel . abel4Q

"6

Tool<it tool<itQ Ti)er ti)erQ boolean sssQ int nu)Farnin'Bee*s\" Q FileDialo' f+Q int e)*Q *ri-ate #trin' #er-er#(ste)Na)e\Vbct;14VQ #trin' user#tatus:2ostQ Iector uncertain\ne0 Iector=>Q #tate)ent st1Q TT;;;;; TT !n+ of -ariables +eclaration

*ublic FaultCClient=> [ su*er=>Q initialiBeCo)*onent=>Q TT TT TODO9 A++ an( constructor co+e after initialiBeCo)*onent call TT t2is.setIisible=true>Q if=.Ra+ioButton1.is#electe+= > > [ #trin' sr1 \ =.Ra+ioButton1.'etTe&t=>>Q #(ste).out.*rintln=VT2e #electe+ button isVJsr1 >Q u*+ateDb=sr1>Q ] TTlo'in=>Q

,7

recie-e%essa'e=>Q

TT TT TT TT TT TT TT TT

tr( [ ss \ ne0 #er-er#oc<et=6"63>Q ] catc2 =!&ce*tion ee> [ ee.*rint#tac<Trace=>Q ] TZ.Te&tArea1.setTe&t=VDestination #tarte+ ....V>Q tool<it \ Tool<it.'etDefaultTool<it=>Q ti)er \ ne0 Ti)er=>Q ti)er.sc2e+uleAtFi&e+Rate=ne0 Re)in+Tas<=>: 7: 1 Z 1777>QZT

] *ublic -oi+ ite)#tateC2an'e+=Ite)!-ent e> [ ] *ublic -oi+ lo'in=> [ tr( [ #(ste).out.*rintln=VLnLnLn;;;;;;;;;;^ Function..._;;;;;;;;;LnLnLnV>Q Class.forNa)e=Vsun..+bc.o+bc.K+bcO+bcDri-erV>Q Insi+e t2e o'in

,1

Connection con1\Dri-er%ana'er.'etConnection=V.+bc9o+bc9faultV:VsaV:VV>Q #tate)ent st1\con1.create#tate)ent=>Q #trin' a**\V#! !CT Z FRO% userlistVQ Result#et rs\st1.e&ecuteGuer(=a**>Q InetA++ress inet\InetA++ress.'et ocal/ost=>Q #trin' sna)e\inet.'et/ostNa)e=>QTTf.toU**erCase=>Q 02ile=rs.ne&t=>> [ if=rs.'et#trin'=1>.e?uals=sna)e>> [ KO*tionPane.s2o0%essa'eDialo'=Fault1.t2is:V Alrea+( #ource is runnin' ... V: VInfor)ation 9 Clic< O< TT T2rea+.slee*=1777>Q TT ] ] #(ste).e&it=7>Q Button To !&it...V:KO*tionPane.INFOR%ATIONC%!##AG!>Q

#trin' ?uer( \ Vinsert into userlist -alues=WVJsna)eJVW:Wli-eW>VQ st1.e&ecuteU*+ate=?uer(>Q ] catc2 =!&ce*tion eee> [ #(ste).out.*rintln=eee>Q ] ]

,2

TTTT /ere t2e ti)er tas< function ZT TT TT [ TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT TT ] else [ TT tool<it.bee*=>Q #(ste).out.*rintln=VTi)eWs u*UV>Q sss\falseQ nu)Farnin'Bee*s \ 2Q useru*+ate=>Q #(ste).out.*rintln=VU*+atin' t2e source DetailsUVJnu) Farnin' Bee*s>Q useru*+ate=>Q recie-e%essa'e=>Q nu)Farnin'Bee*s;;Q ] TTIf itWs not too late: bee*. TT tool<it.bee*=>Q returnQ sss\trueQ 02ile =sss> [ if =nu)Farnin'Bee*s ^ 7> [ lon' ti)e \ #(ste).currentTi)e%illis=>Q if =ti)e ; sc2e+ule+!&ecutionTi)e=> ^ 1> [ *ublic -oi+ run=> [ 02ile =true> [ class Re)in+Tas< e&ten+s Ti)erTas<

,"

TT TT TT TT TT TT TT TT TT TT ] TT ] *ublic -oi+ useru*+ate=> [

recie-e%essa'e=>Q brea<Q TTti)er.cancel=>Q TTNot necessar( because 0e call #(ste).e&it TT#(ste).e&it=7>Q TT#to*s t2e AFT t2rea+ =an+ e-er(t2in' else> ] ]TT if close+ ] TT run=> close+

Iector ft\ne0 Iector=>Q tr( [ TT#(ste).out.*rintln=V Insi+e t2e user u*+ate .....V>Q Connection con1\nullQ Class.forNa)e=Vsun..+bc.o+bc.K+bcO+bcDri-erV>Q con1\Dri-er%ana'er.'etConnection=V.+bc9o+bc9faultV:VsaV:VV>Q #tate)ent st1\con1.create#tate)ent=>Q #trin' cou\V#! !CT count=Z> FRO% userlistVQ Result#et rs\st1.e&ecuteGuer(=cou>Q int count\7Q 02ile=rs.ne&t=>> [ count\rs.'etInt=1>Q ] TT#(ste).out.*rintln=VLnLnLn count 9 VJcount>Q #trin' a**\V#! !CT Z FRO% userlistVQ rs\st1.e&ecuteGuer(=a**>Q

,,

02ile=rs.ne&t=>> [ TT#(ste).out.*rintln=V Insi+e t2e TAB !.....V>Q #trin' na)e\rs.'et#trin'=1>Q ft.a++=na)e>Q TT#(ste).out.*rintln=ft>Q ]

TTT2rea+.slee*=17777>Q

] catc2 =!&ce*tion eee> [ #(ste).out.*rintln=V Coul+ not 'et T2e table -alues....VJeee>Q ] . ist1.set istData=ft>Q TT ] *ri-ate -oi+ initialiBeCo)*onent=> [ f+\ne0 FileDialo'=t2is:V #elect t2e FileV:FileDialo'. OAD>Q f+.setFile=VZ.t&tV>Q TT.Tabbe+Pane1 \ ne0 KTabbe+Pane=>Q contentPane \ =KPanel>t2is.'etContentPane=>Q TT;;;;; .Te&tFiel+1 \ ne0 KTe&tFiel+=>Q . ist1 \ ne0 K ist=>Q .#crollPane2 \ ne0 K#crollPane=>Q

,1

.Te&tArea2 \ ne0 KTe&tArea=>Q .#crollPane" \ ne0 K#crollPane=>Q TT.Panel1 \ ne0 KPanel=>Q TT;;;;; .Te&tArea1 \ ne0 KTe&tArea=>Q .#crollPane1 \ ne0 K#crollPane=>Q .Ra+ioButton1 \ ne0 KRa+ioButton=>Q .Ra+ioButton2 \ ne0 KRa+ioButton=>Q .Ra+ioButton" \ ne0 KRa+ioButton=>Q .Te&tFiel+2 \ ne0 KTe&tFiel+=>Q .Button1 \ ne0 KButton=>Q .Button2 \ ne0 KButton=>Q .Button" \ ne0 KButton=>Q btnGrou*1 \ ne0 ButtonGrou*=>Q . abel1 \ ne0 K abel=>Q . abel2 \ ne0 K abel=>Q . abel" \ ne0 K abel=>Q . abel, \ ne0 K abel=>Q . abel1 \ ne0 K abel=>Q . abel3 \ ne0 K abel=>Q . abel4 \ ne0 K abel=ne0 I)a'eIcon=VOCGRR..*'V>>Q .Panel2 \ ne0 KPanel=>Q setDefaultCloseO*eration=!8ITCONCC O#!>Q TT;;;;;TT .Tabbe+Pane1 TZ.Tabbe+Pane1.a++Tab=V #en+ V: .Panel1>Q

TT.Tabbe+Pane1.a++Tab=V Recie-e V: .Panel2>Q .Tabbe+Pane1.a++C2an'e istener=ne0 C2an'e istener=> [ *ublic -oi+ stateC2an'e+=C2an'e!-ent e> [ .Tabbe+Pane1CstateC2an'e+=e>Q ] ]>QZT

,3

TT TT contentPane TT contentPane.set a(out=null>Q TTa++Co)*onent=content Pane. Tabbe+Pane1: 1":11:1,5:,17>QTT1":11:1,5:"61Q TT TT .Te&tFiel+1 TT . abel1.setTe&t=V#electe+ Destination9V>Q . abel2.setTe&t=V!nter t2e Te&t9V>Q . abel".setTe&t=V=or>V>Q . abel,.setTe&t=V#electe+ File9V>Q . abel1.setTe&t=VDestinationsV>Q . abel3.setTe&t=V#tatus9V>Q .Te&tFiel+1.setTe&t=VV>Q

.Te&tFiel+1.a++Action istener=ne0 Action istener=> [ *ublic -oi+ actionPerfor)e+=Action!-ent e> [ .Te&tFiel+1CactionPerfor)e+=e>Q ] ]>Q TT TT . ist1 TT . ist1.a++ ist#election istener=ne0 ist#election istener=> [ *ublic -oi+ -alueC2an'e+= ist#election!-ent e> [ . ist1C-alueC2an'e+=e>Q ]

,4

]>Q TT TT .#crollPane2 TT .#crollPane2.setIie0*ortIie0=. ist1>Q TT TT .Te&tArea2 TT .Te&tArea2.setTe&t=VV>Q TT TT .#crollPane" TT .#crollPane".setIie0*ortIie0=.Te&tArea2>Q .Ra+ioButton1.setTe&t=V i-eV>Q .Ra+ioButton1.set#electe+=true>Q .Ra+ioButton1.a++Ite) istener=ne0 Ite) istener=> [ *ublic -oi+ ite)#tateC2an'e+=Ite)!-ent e> [ .Ra+ioButton1Cite)#tateC2an'e+=e>Q ] ]>Q TT TT .Ra+ioButton2 TT .Ra+ioButton2.setTe&t=V UncertainV>Q .Ra+ioButton2.a++Ite) istener=ne0 Ite) istener=> [ *ublic -oi+ ite)#tateC2an'e+=Ite)!-ent e> [ .Ra+ioButton2Cite)#tateC2an'e+=e>Q ]

,5

]>Q TT TT .Ra+ioButton" TT .Ra+ioButton".setTe&t=V Do0nV>Q .Ra+ioButton".a++Ite) istener=ne0 Ite) istener=> [ *ublic -oi+ ite)#tateC2an'e+=Ite)!-ent e> [ tr( [

.Ra+ioButton"Cite)#tateC2an'e+=e>Q #oc<et soc<Q #er-er#oc<et ssQ #oc<et s2:s1Q Ob.ectIn*ut#trea) oisQ Ob.ectOut*ut#trea) oos\nullQ TZsoc< \ne0 #oc<et=#er-er#(ste)Na)e:6"64>Q ois Ob.ectIn*ut#trea)=soc<.'etIn*ut#trea)=>>Q oos =soc<.'etOut*ut#trea)=>>Q oos.0riteOb.ect=V2aiV>Q ZT ] catc2 =!&ce*tion rt> [ rt.*rint#tac<Trace=>Q ] \ ne0 Ob.ectOut*ut#trea) \ ne0

,6

] ]>Q TT TT .Te&tFiel+2 TT .Te&tFiel+2.a++Action istener=ne0 Action istener=> [ *ublic -oi+ actionPerfor)e+=Action!-ent e> [ TT.Te&tFiel+2CactionPerfor)e+=e>Q ] ]>Q TT TT .Button1 TT .Button1.setTe&t=V Bro0seV>Q .Button1.a++Action istener=ne0 Action istener=> [ *ublic -oi+ actionPerfor)e+=Action!-ent e> [ f+.setIisible=true>Q #trin' filena)e \ f+.'etDirector(=>Jf+.'etFile=>Q if=filena)e.e?uals=VnullnullnullV>> [ .Te&tFiel+2.setTe&t=VV>Q ] else if=filena)e.e?uals=VnullnullV>> [ .Te&tFiel+2.setTe&t=VV>Q ] else if=filena)e.e?uals=VnullV>> [ .Te&tFiel+2.setTe&t=VV>Q

17

] else [ .Te&tFiel+2.setTe&t=filena)e>Q ] #(ste).out.*rintln=V file 9 VJfilena)e>Q ] ]>Q TT TT .Button2 TT .Button2.setTe&t=V #en+V>Q .Button2.a++Action istener=ne0 Action istener=> [ *ublic -oi+ actionPerfor)e+=Action!-ent e> [ tr( [ Class.forNa)e=Vsun..+bc.o+bc.K+bcO+bcDri-erV>Q Connection con1\Dri-er%ana'er.'etConnection=V.+bc9o+bc9faultV:VsaV:VV>Q st1\con1.create#tate)ent=>Q InetA++ress inet\InetA++ress.'et ocal/ost=>Q 2ost\inet.'et/ostNa)e=>Q #trin' a**\V#! !CT state FRO% userlist 02ere userna)e li<e WSVJ2ostJVSW VQ Result#et rs\st1.e&ecuteGuer(=a**>Q 02ile=rs.ne&t=>> [ user#tatus \ rs.'et#trin'=1>Q ] user#tatus\user#tatus.tri)=>Q

11

#(ste).out.*rintln=V;;;;^ #tatus 9VJa**>Q #(ste).out.*rintln=V;;;;^ #tatus 9VJuser#tatus>Q ] catc2 =!&ce*tion e&ce*> [ #(ste).out.*rintln=e&ce*>Q ]

#(ste) #(ste)

TT.Button2CactionPerfor)e+=e>Q int u(\.Te&tFiel+2.'etTe&t=>.len't2=>Q #trin' cc+ \ VDestination is Do0n state.Please tr( after so)e ti)eVQ if=u(\\7> [ if=user#tatus.e?uals=V i-eV>> [ sen+%essa'e=>Q ] else if=user#tatus.e?uals=VUncertainV>> [ #trin' +est \ .Te&tFiel+1.'etTe&t=>.tri)=>Q #(ste).out.*rintln=VT2e +estination isV J +est>Q #trin' s12 \ .Te&tArea2.'etTe&t=>Q #(ste).out.*rintln=VT2e Te&t %essa'e isV J s12>Q TTInetA++ress inet\InetA++ress.'et ocal/ost=>Q TT#trin' 2ost\inet.'et/ostNa)e=>Q #trin' )essa'e \ 2ostJV`VJ+estJV`VJs12Q uncertain.a++=)essa'e>Q

12

] else if =user#tatus.e?uals=VDo0nV>> [ KO*tionPane.s2o0%essa'eDialo'=FaultCClient.t2is:cc+: V%essa'e ...V:KO*tionPane.INFOR%ATIONC%!##AG!>Q ] #(ste).out.*rintln=V Uncertain Iector Ialues 9 VJuncertain>Q #(ste).out.*rintln=VInsi+e T2e Directl( %s' #en+..Not Bro0se #election..V>Q ] else [ .Te&tArea2.setTe&t=VV>Q #trin' filen\.Te&tFiel+2.'etTe&t=>Q tr( [ Buffere+Rea+er in\ne0 Buffere+Rea+er=ne0 FileRea+er=filen>>Q #trin' s:s1\ne0 #trin'=>Q if=.Te&tArea2.'etTe&t=>.len't2=>\\7> [ e)*\1Q ] 02ile==s\in.rea+ ine=>>U\null> [ if=e)*\\7> [ .Te&tArea2.setTe&t=.Te&tArea2.'etTe&t=>JVLnVJs>Q TTe)*\1Q ] else

1"

[ .Te&tArea2.setTe&t=s>Q e)*\7Q ] ] if=user#tatus.e?uals=V i-eV>> [ sen+%essa'e=>Q ] else if=user#tatus.e?uals=VUncertainV>> [ #trin' +est \ .Te&tFiel+1.'etTe&t=>.tri)=>Q #(ste).out.*rintln=VT2e +estination isV J +est>Q #trin' s12 \ .Te&tArea2.'etTe&t=>Q #(ste).out.*rintln=VT2e Te&t %essa'e isV J s12>Q

TTInetA++ress inet\InetA++ress.'et ocal/ost=>Q TT#trin' 2ost\inet.'et/ostNa)e=>Q #trin' )essa'e \ 2ostJV`VJ+estJV`VJs12Q uncertain.a++=)essa'e>Q ] else if=user#tatus.e?uals=VDo0nV>> KO*tionPane.s2o0%essa'eDialo'=FaultCClient.t2is:cc+: V%essa'e ...V:KO*tionPane.INFOR%ATIONC%!##AG!>Q ] TT.Te&tFiel+1.setTe&t=VV>Q ]

1,

catc2 =!&ce*tion er> [ #(ste).out.*rintln=er>Q ] TT#(ste).out.*rintln=VNoooooooooooooooooooo ooo..V>Q ]

] ]>Q TT TT .Button" TT .Button".setTe&t=V o'outV>Q .Button".a++Action istener=ne0 Action istener=> [ *ublic -oi+ actionPerfor)e+=Action!-ent e> [ TT.Button"CactionPerfor)e+=e>Q ] ]>Q TT TT .Panel1 TT TT TT .Panel1 TT TT.Panel1.set a(out=null>Q TT.Panel1.setBor+er=Bor+erFactor(.create!tc2e+Bor+er=>>Q

11

a++Co)*onent=contentPane: .Te&tFiel+1: 14":1"7:1"2:25>Q a++Co)*onent=contentPane: .#crollPane2: "37:1,7:177:123>Q a++Co)*onent=contentPane: .#crollPane": 111:167:142:34>Q a++Co)*onent=contentPane: .Ra+ioButton1: 115:"17:13:2,>Q a++Co)*onent=contentPane: .Ra+ioButton2: 217:"17:5,:2,>Q a++Co)*onent=contentPane: .Ra+ioButton": 265:"17:31:2,>Q a++Co)*onent=contentPane: .Te&tFiel+2: 11,:"77:142:21>Q a++Co)*onent=contentPane: .Button1: "1":"77:5":25>Q a++Co)*onent=contentPane: .Button2: 115:"61:5":25>Q a++Co)*onent=contentPane: .Button": 21,:"61:5":25>Q a++Co)*onent=contentPane: . abel1: 21:1"7:122:25>Q a++Co)*onent=contentPane: . abel2: 31:276:5,:"2>Q a++Co)*onent=contentPane: . abel": 211:235:42:27>Q a++Co)*onent=contentPane: . abel,: 34:"77:5,:27>Q a++Co)*onent=contentPane: . abel1: "36:117:5,:27>Q a++Co)*onent=contentPane: . abel3: 54:"17:5,:27>Q a++Co)*onent=contentPane: . abel4: 7:7:,67:177>Q TT TT .Panel2 TT .Panel2.set a(out=null>Q .Panel2.setBor+er=Bor+erFactor(.create!tc2e+Bor+er=>>Q TT TT btnGrou*1 TT btnGrou*1.a++=.Ra+ioButton1>Q btnGrou*1.a++=.Ra+ioButton2>Q btnGrou*1.a++=.Ra+ioButton">Q TT TT TT .Te&tArea1 TT .Te&tArea1.setTe&t=VLnV>Q TT

13

TT .#crollPane1 TT .#crollPane1.setIie0*ortIie0=.Te&tArea1>Q TT TT .Panel2 TT .Panel2.set a(out=null>Q .Panel2.setBor+er=Bor+erFactor(.create!tc2e+Bor+er=>>Q a++Co)*onent=.Panel2: .#crollPane1: ;1:7:1,5:"3">Q %ouse istener )ouse istener \ ne0 %ouseA+a*ter=> [ *ublic -oi+ )ouseClic<e+=%ouse!-ent )ouse!-ent> [ K ist . ist1 \ =K ist> )ouse!-ent.'et#ource=>Q if =)ouse!-ent.'etClic<Count=> \\ 2> [ int in+e& \ . ist1.locationToIn+e&=)ouse!-ent.'etPoint=>>Q if =in+e& ^\ 7> [ Ob.ect o \ . ist1.'et%o+el=>.'et!le)entAt=in+e&>Q TT#(ste).out.*rintl n=V^^V J ==o\\null>R VnullV 9 o.to#trin'=>> J V is selecte+.V>Q TT#trin' tate&t\.Te&tArea1.'etTe&t=>Q .Te&tFiel+1.setTe&t=o.to#trin'=>>Q TT-ie0 -1\ne0 -ie0=o.to#trin'=>>Q TT#(ste).o ut.*rintln=VDouble;clic<e+ on9 V J o.to#trin'=>>Q ] ] ] ]Q . ist1.a++%ouse istener=)ouse istener>Q TT TT FaultCClient1

14

TT t2is.setTitle=VFaultCClient1 ; e&ten+s KFra)eV>Q t2is.set ocation=ne0 Point=7: 7>>Q t2is.set#iBe=ne0 Di)ension=,51: ,51>>QTT 157:173 ]

*ri-ate -oi+ .Ra+ioButton1Cite)#tateC2an'e+=Ite)!-ent e> [ if=.Ra+ioButton1.is#electe+=>> [ #trin' sr1 \ =.Ra+ioButton1.'etTe&t=>>Q #(ste).out.*rintln=VT2e #electe+ button isVJsr1 >Q u*+ateDb=sr1>Q ] ]

*ri-ate -oi+ .Ra+ioButton2Cite)#tateC2an'e+=Ite)!-ent e> [ if=.Ra+ioButton2.is#electe+=>> [ #trin' sr1 \ =.Ra+ioButton2.'etTe&t=>>Q #(ste).out.*rintln=VT2e #electe+ button isVJsr1 >Q u*+ateDb=sr1>Q ] ] *ri-ate -oi+ .Ra+ioButton"Cite)#tateC2an'e+=Ite)!-ent e> [ if=.Ra+ioButton".is#electe+=>> [

15

#trin' sr1 \ =.Ra+ioButton".'etTe&t=>>Q #(ste).out.*rintln=VT2e #electe+ button isVJsr1 >Q u*+ateDb=sr1>Q ] ] TZ*ublic -oi+ ite)#tateC2an'e+=Ite)!-ent ie> [ if=.r2.is#electe+= > > [ #(ste).out.*rintln=VUncertainV>Q #trin' sr1 \ =.r2.'etTe&t=>>Q TTu*+ateDb=sr1>Q ] else if=.r".is#electe+= >> [ #(ste).out.*rintln=VDo0nV>Q #trin' sr1 \ =.r".'etTe&t=>>Q TTu*+ateDb=sr1>Q ] else if= .r1.is#electe+= > > [ #(ste).out.*rintln=V i-eV >Q #trin' sr1 \ =.r1.'etTe&t=>>Q

TTu*+ateDb=sr1>Q ]

16

]ZT TZZ A++ Co)*onent Fit2out a a(out %ana'er =Absolute Positionin'> ZT *ri-ate -oi+ a++Co)*onent=Container container:Co)*onent c:int &:int (:int 0i+t2:int 2ei'2t> [ c.setBoun+s=&:(:0i+t2:2ei'2t>Q container.a++=c>Q ] TT TT TODO9 A++ an( a**ro*riate co+e in t2e follo0in' !-ent /an+lin' %et2o+s TT *ri-ate -oi+ .Tabbe+Pane1CstateC2an'e+=C2an'e!-ent e> [ #(ste).out.*rintln=VLn.Tabbe+Pane1CstateC2an'e+=C2an'e!-ent calle+.V>Q TT TODO9 A++ an( 2an+lin' co+e 2ere ] *ri-ate -oi+ .Te&tFiel+1CactionPerfor)e+=Action!-ent e> [ #(ste).out.*rintln=VLn.Te&tFiel+1CactionPerfor)e+=Action!-ent calle+.V>Q TT TODO9 A++ an( 2an+lin' co+e 2ere ] *ri-ate -oi+ . ist1C-alueC2an'e+= ist#election!-ent e> [ #(ste).out.*rintln=VLn. ist1C-alueC2an'e+= ist#election!-ent calle+.V>Q e> e> e>

37

if=Ue.'etIalueIsA+.ustin'=>> [ Ob.ect o \ . ist1.'et#electe+Ialue=>Q #(ste).out.*rintln=V^^V J ==o\\null>R VnullV 9 o.to#trin'=>> J V is selecte+.V>Q TT bein' selecte+ ] ] TT TT TODO9 A++ an( )et2o+ co+e to )eet (our nee+s in t2e follo0in' area TT .Te&tFiel+1.setTe&t=o.to#trin'=>>Q TT TODO9 A++ an( 2an+lin' co+e 2ere for t2e *articular ob.ect

*ublic -oi+ u*+ateDb=#trin' sr1> [ #trin' sr \ sr1Q #(ste).out.*rintln=VT2e #electe+ Ra+io button isVJsr>Q tr( [ InetA++ress inet\InetA++ress.'et ocal/ost=>Q #trin' sna)e\inet.'et/ostNa)e=>Q #(ste).out.*rintln=V Insi+e t2e user u*+ate .....V>Q Connection con1\nullQ Class.forNa)e=Vsun..+bc.o+bc.K+bcO+bcDri-erV>Q con1\Dri-er%ana'er.'etConnection=V.+bc9o+bc9faultV:VsaV:VV>Q #tate)ent st1\con1.create#tate)ent=>Q #trin' ?uer( \ Vu*+ate userlist set state \ WVJsrJVW 02ere userna)e li<e WSVJsna)eJVSW VQ

31

st1.e&ecuteU*+ate=?uer(>Q

] catc2=!&ce*tion e> [ e.*rint#tac<Trace=>Q ] ] TT*ri-ate -oi+ .Button2CactionPerfor)e+=Action!-ent e> TT TT TT TT TT TT ] sen+%essa'e=>Q [

*ublic -oi+ sen+%essa'e=> [ #oc<et soc<Q #er-er#oc<et ssQ #oc<et s2:s1Q Ob.ectIn*ut#trea) oisQ Ob.ectOut*ut#trea) oos\nullQ #trin' )s' \ VVQ #trin' cc+ \ VT2e )essa'e is recie-e+VQ #(ste).out.*rintln=V;;;;;;;;;;;;;;;;;;;;Insi+e function;;;;;;;;;;;;;;;;V>Q tr( [ t2e sen+%essa'e

32

#(ste).out.*rintln=V;;^ Unceratin siBe 9 VJuncertain.siBe=>>Q if=uncertain.siBe=>^7> [ for=int count\7Qcount_uncertain.siBe=>QcountJJ> [ #trin' -al1\=#trin'>uncertain.ele)entAt=count>Q #(ste).out.*rintln=V -alue VJcount JV 9 VJ-al1>Q tr( [ soc< \ne0 #oc<et=#er-er#(ste)Na)e:6"61>Q ois Ob.ectIn*ut#trea)=soc<.'etIn*ut#trea)=>>Q oos =soc<.'etOut*ut#trea)=>>Q oos.0riteOb.ect=-al1>Q )s' \ =#trin'>ois.rea+Ob.ect=>Q #(ste).out.*rintln=VT/! R!CI!I!DVJ)s'>Q if=)s'.e?uals=VRecie-e+V>> [ KO*tionPane.s2o0%essa'eDialo'=FaultCClient.t2is:cc+: V%essa'e ...V:KO*tionPane.INFOR%ATIONC%!##AG!>Q ] ] catc2 =!&ce*tion e&> [ e&.*rint#tac<Trace=>Q ] ] %!##AG! I# \ ne0 Ob.ectOut*ut#trea) \ ne0

3"

uncertain.re)o-eAll!le)ents=>Q ] ] catc2 =!&ce*tion e&c> [ ] TTelse TT[ #trin' +est \ .Te&tFiel+1.'etTe&t=>.tri)=>Q #(ste).out.*rintln=VT2e +estination isV J +est>Q #trin' s \ .Te&tArea2.'etTe&t=>Q #(ste).out.*rintln=VT2e Te&t %essa'e isV J s>Q tr( [ InetA++ress inet\InetA++ress.'et ocal/ost=>Q #trin' 2ost\inet.'et/ostNa)e=>Q #trin' )essa'e \ 2ostJV`VJ+estJV`VJsQ soc< #oc<et=#er-er#(ste)Na)e:6"61>Q ois Ob.ectIn*ut#trea)=soc<.'etIn*ut#trea)=>>Q oos =soc<.'etOut*ut#trea)=>>Q oos.0riteOb.ect=)essa'e>Q TT#trin' =#trin'>ois.rea+Ob.ect=>Q )s' \ =#trin'>ois.rea+Ob.ect=>Q #(ste).out.*rintln=VT/! %!##AG! I# R!CI!I!DVJ)s'>Q if=)s'.e?uals=VRecie-e+V>> [ )s' \ \ ne0 Ob.ectOut*ut#trea) \ ne0 \ne0

3,

KO*tionPane.s2o0%essa'eDialo'=FaultCClient.t2is:cc+: V%essa'e ...V:KO*tionPane.INFOR%ATIONC%!##AG!>Q ] ] catc2 =!&ce*tion e> [ e.*rint#tac<Trace=>Q ] TT]

*ublic -oi+ recie-e%essa'e=> [

tr( [ TTss \ ne0 #er-er#oc<et=6"63>Q #(ste).out.*rintln=VDestination starte+...V>Q 02ile=true> [ useru*+ate=>Q T2rea+.slee*=1777>Q ]

31

] catc2 =!&ce*tion e> [ e.*rint#tac<Trace=>Q ]

TT\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\TT TT\ \TT

Testin'

33

TT\ T2e follo0in' )ain )et2o+ is .ust for testin' t2is class (ou built.\TT TT\ After testin':(ou )a( si)*l( +elete it. \\\\\\\\\\TT *ublic static -oi+ )ain=#trin'DE ar's> [ TT TT TT TT TT UI%ana'er.set oo<An+Feel=Vco).sun..a-a.s0in'.*laf.0in+o0s.Fin+o0s oo<An+F eelV>Q TT TT TT TT TT TT ] TT\ !n+ of Testin' \ ] ne0 FaultCClient=>Q ] catc2 =!&ce*tion e&> [ #(ste).out.*rintln=VFaile+ loa+in' MF9 V>Q #(ste).out.*rintln=e&>Q KFra)e.setDefault oo<An+FeelDecorate+=true>Q KDialo'.setDefault oo<An+FeelDecorate+=true>Q tr( [ \TT TT\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

34

35

You might also like