Java System Architectures David Davenport Bilkent University Ankara – Turkey Email: [email protected]
Dec 21, 2015
Basic Forms of Java Programs
• Console Applications( MSDOS-like )– text only!
• GUI Applications( Windows-like )– text & graphics– menus, buttons, mouse,
keyboard
• Applets– GUI programs restricted
for use in web-browsers
Other Forms of Java Programs
• Web Server Applications– html client– data only ~ XML, JSON…
• Mobile Applications– Android only Java– html5, Javascript, CSS
using libraries, e.g. JQuery Mobile, phonegap, …
– Java for everything?
• Cards, TV, …– misc!
Java Applications
JavaProgram
network
Java applications (console & GUI) have full accessto local machine
resources, including local files, databases
& network connections.
JavaApplet
WebBrowser
Java Applets
networkWeb
server
ServerJava
Program
Java Applets are embedded in html web pages, downloaded from web servers and run by web browsers. For security reasons, they
can communicate only with the machine from which they originated and cannot access local files or databases (although these restrictions can be lifted if the user agrees to trust them!)
Networked Java Applications
JavaProgram
network
JavaProgram
JavaProgram
JavaProgram
Java programs can communicate with each other either directly or via a server program, allowing them to freely exchange
information.
Some database systems offer direct
network access.
Networked Java Applets
Webserver
JavaApplet
JavaApplet
JavaApplet
ServerJava
Program
Since Java Applets cannot
normally communicate
with each other directly, they
must do so via a server
application program.
Similarly, if they need to store
information, they can only do so on
a server machine.
Java Servlets
WebBrowser
WebBrowser
WebBrowser
JavaServlets
Webserver
Java Servlets extend web server functionality allowing it to
dynamically generate web pages using information stored in
databases or files.
Communications use HTML…
Java Web Services
WebBrowser
Java Program
JavaWeb
Services
Webserver
Web services extend web server functionality allowing it to
dynamically respond to service requests using information from
databases, files or even other web services!
Clients may be web browsers, but are more likely to be other application
programs.
Communications use
XML/JSON
MobileApp
Data Formats…
Name Telno David 1248 Gunes 1814 Derya 5678
<table><tr>
<td>David</td><td>1248</td>
</tr><tr>
<td>Gunes</td><td>1814</td>
</tr><tr>
<td>Derya</td><td>5678</td>
</tr></table>
<teldir><person>
<name>David
</name><telno>
1248</telno>
</person><person>
<name>Gunes
</name><telno>
1814</telno>
</person><person>
<name>Derya
</name><telno>
5678</telno>
</person></teldir>
{"teldir":[{"name":"David", "telno":"1248"}, {"name":"Gunes", "telno":"1814"}, {"name":"Derya", "telno":"5678" ]}
name,telnoDavid,1248Gunes,1814Derya,5678
Mobile Applications
Hardwarescreen orientation (portrait, lanscape)screen size (phone, tablet)screen resolution (DPI)optional sensors (GPS, accelerometer, …)
Development environments/languagesto each his own?
Java for Android, Objective-C for iOs, …cross platform?
embedded webbrowser~ html5, Javascript, CSS + libraries…
Java for all? ~ Codename One
Operating SystemsAndroid, iOS, Windows, Blackberry, …
Changing
rapidly
Persistent StorageAlternatives
Files ~ sequential/random-access, diy/Serialization, …Database ~ JDBC, SQL, …Cloud? ~ …other? ~ local storage on phones, webbrowser, etc.
Tables, e.g. TelDirName Telno David 1248 Derya 5678 Gunes 1814
SQL w3schools select * from TelDirselect Name from TelDirselect Telno from TelDir where Name = 'Derya‘
insert into TelDir ( Name, Telno) values ( ‘Ayse’, 9999)
update TelDir set TelNo = 0000 where Name = ‘Ayse’
delete from TelDir where TelNo = 5678
+ commands to manipulate tables, etc.
Database
JDBC allows your Java program to connect to any database and talk SQL to it. examples
examples…
see w3schools…
Considerations
• User Interaction– Text only
– Text & graphics • Static (html?)• Interactive (GUI?)
– Mouse/touch/voice/…
• Single/multi-user– Stand-alone
– Network• Web-browser (applet)• Application
• Client software distribution & installation– Floppy disks/CD’s/
usb memory sticks/ download?
– WebStart– Applets– Server-based
• Data storage & retrieval– Files– Database (local/network)– Cloud storage