Hlavní menu

Nástroje

UvodDoKomponent / KomponentTutorial

View (print) - Edit page | Recent changes - Page history

Updated 17 December 2009, 15:05 by PremekBrada

Úvodní informace

TBD přeslohovat - ne "jsem se seznámil" apod ale "tady najdete"...

Na této wiki bych chtěl na jednoduchých příkladech představit jednotlivé Javové Frameworky, s kterými jsem se seznámil. K práci jsem používal prostředí Eclipse (později pro spring a osgi i SpringSource Tool Suite který je založen na Eclipsu a dá se najít i jako Eclipsový plugin) a v každém frameworku jsem si vyzkoušel dva jednoduché příklady. Tyto příklady jsou převzaty z projektu CoSi, který je prezentován v angličtině, proto přikládám i zadání v angličtině.

Tato wiki je pro vás obzvlášť vhodná, pokud si chcete vyzkoušet různé Javové komponentové frameworky.

Vyzkoušené frameworky

Spring - čistý Spring

Osgi - čisté Osgi

SpringDM - (Spring Dynamic Modules, nebo taky Spring - Osgi), jde o přidání možností Springu do Osgi frameworku

Declarative Services

Používané příklady

Message printer

First a really simple application:

  • "server" component which exports a IMsgGen service with one method String getMsg()
  • "client" component which imports this service and prints message on standard output

Parking lot

Next a more complex thingy. The scenario is as follows: above motorway there is a board announcing how many places are free at our parking lot. Cars, buses and trucks enter and leave the lot via gate, being allowed entry only if there is space for the given type of vehicle on the parking lot - car takes 1 space, bus 2 spaces, truck 4 spaces. Parking lot announces the remaining capacity for the board to display.

The component model has these components, shown also on diagram below:

  • "gate" which generates arrivals/departures (random), calling parking lot's svc to register these arrivals/departures
  • "parking lot" which announces via events how many places are free, setting the count according to the service methods called
  • "board" above the motorway which tells how many places are free
  • "pannel" which controls the whole system
  • "configuration" library component providing also configuration parameters ("frequency" for gate, "capacity" for parking lot)