Java System Architectures

Download Report

Transcript Java System Architectures

Java
System
Architectures
David Davenport
Bilkent University
Ankara – Turkey
Email: [email protected]
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
network
Java
Program
Java applications
(console & GUI)
have full access
to local machine
resources, including
local files, databases &
network connections.
Java Applets
Web
server
network
Web
Browser
Server
Java
Program
Java
Applet
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
Java
Program
network
Java
Program
Java
Program
Java
Program
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
Java
Applet
Web
server
Java
Applet
Server
Java
Program
Java
Applet
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
Java Servlets extend web server
functionality allowing it to dynamically
generate web pages using information
stored in databases or files.
Web
Browser
Web
Browser
Java
Servlets
Web
server
Web
Browser
Communications
use HTML…
Java Web Services
Web services extend web server
functionality allowing it to dynamically
respond to service requests using
information from databases, files or
even other web services!
Java
Web
Services
Web
Browser
Mobile
App
Clients may be web
browsers, but are
more likely to be other
application programs.
Web
server
Java
Program
Communications
use XML/JSON
Data Formats…
Name
David
Gunes
Derya
<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>
Telno
1248
1814
5678
name,telno
David,1248
Gunes,1814
Derya,5678
{"teldir":[{"name":"David", "telno":"1248"},
{"name":"Gunes", "telno":"1814"},
{"name":"Derya", "telno":"5678"
]}
<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>
Mobile Applications
Operating Systems
Android, iOS, Windows, Blackberry, …
Hardware
screen orientation (portrait, lanscape)
screen size (phone, tablet)
screen resolution (DPI)
optional sensors (GPS, accelerometer, …)
Changing
rapidly
Development environments/languages
to each his own?
Java for Android, Objective-C for iOs, …
cross platform?
embedded webbrowser
~ html5, Javascript, CSS + libraries…
Java for all?
~ Codename One
Alternatives
Files
Database
Cloud?
other?
Persistent Storage
~ sequential/random-access, diy/Serialization, …
~ JDBC, SQL, …
~…
~ local storage on phones, webbrowser, etc.
Database
Tables, e.g. TelDir
Name
Telno
David
1248
Derya
5678
Gunes 1814
JDBC allows your Java
program to connect to
any database and talk
SQL to it. examples
examples…
w3schools…
SQL see
w3schools
select * from TelDir
select Name from TelDir
select 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.
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