No Slide Title

Download Report

Transcript No Slide Title

1.
DBLP
database
DBLP
Web Site
& Search Pages
User Query
Info n
2.
3.
User
Knowledge
Info1 Info2
DBLP
database
Multiple
Authors
List Page
(Unique
Author
Data Page)
Multiple Authors
List Page
Hyperlinks to
individual data pages
Main Author
Home Page
Table Data
DBLP
database
Multiple
Authors
List Page
(Unique
Author
Data Page)
Unique Author
Data Page
Overview of the Java SQL Wrapper Class
A
1. User inputs
SQL String
SQL Parser
Sigmod
Author & Title
Search
Web pages
B
<HTML>…
(Single
Title)
<HTML>…
<TD>data…
(Single
Title)
<HTML>…
data</TD>
<TD>data…
(Single
Title)
<HTML>…
...</HTML>
data</TD
…<HTML>…
… >Title)
<TD>data…
(Single
...</HTML>
data</TD
… … >Title)
<TD>data…
(Single
...</HTML>
data</TD
……>
<TD>data…
...</HTML>
data</TD … … >
...</HTML>
2. Send SQL Method Builds a database for the query in Oracle
HTML
Author &
Title
Parsers
C
(Store Articles Method)
3. Query sent
to Oracle
D
(QueryDB Method)
Oracle
A
The SQL Query is parsed, and requests for Author and Title views are sent to the
respective web pages.
The web pages return streams of HTML which are then parsed to extract the
data.
SQL Parser
(SQL from user)
<SUBMIT>
<SUMIT> Name
Name==Alice
Alice
This_String_Skipped
<SUBMIT> Title = Ways to..
This_String_Skipped
This_String_Skipped
Alice
Sigmod
Author
Search
page
Ways to..
Sigmod
Title
Search
page
(HTML to Parsers)
B.1
(Zoom)
Parse
Author
Sigmod
Author
Search
page
Single Author
or
List Page
Sigmod
Title
Search
page
<HTML>…
(Single Title)
<TD>data…
data</TD>
...</HTML>
Parse
List
Parse
Title
(to Oracle DB)
The HTML returned from querying
Search Author depends on whether the
requested name is unique in the database.
If it is unique, an HTML page with data
about that author is returned. Otherwise a
list of hyperlinks to matching author names
is returned.
(Keyword queries
from SQL Parser)
Parse List determines what kind of page
has been returned then if it is a list page,
extracts each of the author URLs and
returns a vector of input streams to each of
those authors pages.
Single Author Data page
B.2
<HTML>…
(Single Author)
<TD>data…
data</TD>
...</HTML>
Sigmod
Author
Search
page
<HTML>…
(Single Author)
<TD>data…
data</TD>
...</HTML>
Parse
List
OR
Vector
of
Authors
Multiple Author List page
Author1
<HTML>…
<LI> Author1</LI>
<LI>Author2</LI>
...</HTML>
Sigmod
Title
Search
page
<HTML>…
(Single Title)
<TD>data…
data</TD>
...</HTML>
Author2
Parse
List
Parse
Author
<HTML>…
(Single Author1)
<TD>data…
data</TD>
...</HTML>
<HTML>…
(Single Author2)
<TD>data…
data</TD>
...</HTML>
Parse
Author
Author3
<HTML>…
(Single Author3)
<TD>data…
data</TD>
...</HTML>
Parse
Title
C
Store Articles Method
Results Vector:
Tags & Values
Parse
Author
Author:
Alice Kent
Author:
Joe Stevens
Author:
Kim Lee
Results Vector:
Tags & Values
Parse
Title
Title:
Databases
Public:
ICDE 1999
Page:
287
Prepared Piped SQL Statements
“Insert into author
values
(automatic id, ?, ?)”
“Insert into article
values
(automatic id, ?, ?, ?)”
“Insert into rel
values
(select author_id..)”
(Query Oracle for
Author & Article IDs)
Oracle
D
QueryDB Method
SQLWrapper Class
Client Browser
AuthID
Name
87219 Alice..
53882 Joe Sl..
Java Applet
Original SQL String
QueryDB Method
RMI
...connection.prepareStatement (SQL);
...rs = stmt.executeQuery ();
//*iterates through records in rs to
build a String [ ][ ]
containing the resulting data*//
Oracle
Overview of the Java SQL Wrapper Class
A
1. User inputs
SQL String
SQL Parser
Sigmod
Author & Title
Search
Web pages
B
<HTML>…
(Single
Title)
<HTML>…
<TD>data…
(Single
Title)
<HTML>…
data</TD>
<TD>data…
(Single
Title)
<HTML>…
...</HTML>
data</TD
…<HTML>…
… >Title)
<TD>data…
(Single
...</HTML>
data</TD
… … >Title)
<TD>data…
(Single
...</HTML>
data</TD
……>
<TD>data…
...</HTML>
data</TD … … >
...</HTML>
2. Send SQL Method Builds a database for the query in Oracle
HTML
Author &
Title
Parsers
C
(Store Articles Method)
3. Query sent
to Oracle
D
(QueryDB Method)
Oracle
Project Architecture Overview
WrapperExp.html
HTTP
Personal Web Server
(Scarlet.wpi.edu)
<HTML>….
DBDescript.html
…
<HTML>….
...
Index.html
...</HTML>
…
<HTML>….
...
...</HTML>
…
...
...</HTML>
ParseAuthor.jjt
ParseList.java
Client Browser
RMI
SQLWrapper.java
Java Server
..sendSQL()
..queryDB()
Java Applet
Oracle
Intuitive RMI
Naming.lookup
(what restaurants)
Dining Guide
(Registry)
Reg.rebind(“CatchyName”, myRestaurant)
(Implements)
The Head Chef
(Server
Application)
Servants & Waiters
(Rmic Stubs & Skeletons)
RMI Nitty-Gritties
(or: Write--Compile--Run)
Must:
-Be Public
-Extend java.rmi.Remote
-Throw java.rmi.RemoteException
Html & Java Source Files(4):
*Remote Interface
*Remote Object Server
*Client Applet
*HTML page to load Applet
-Be Serializable
-Implement 1(+) Remote Interfaces
-Extend java.rmi.UnicastRemoteObject
(or export object explicitly)
-Create & install a Security Manager
-Create & Register 1(+) Remote Object
RMI Nitty-Gritties
(or: Write--Compile--Run)
From Command Line:
Compiles Source Code
to Create Executable
Class Files
Javac myRestaurant.java
Rmic myRestaurant
Generates Stubs
& Skeletons
RMI Nitty-Gritties
(or: Write--Compile--Run)
From Command Line:
Starts Registry on port#
or 1099 by default
Start RmiRegistry [port#]
Java myRestaurant
Load Applet in Browser
Runs Java Server
application
Cookies
QueryServer.java
QueryApplet.java
import netscape.javascript.*;
init(){
CookieCode.……….
….…..CookieCode
…}
JSObject
method calls
Index.html
<HTML>…
<HEAD> javaScript
Function setCookie
Function getCookie
Function delCookie
Function returnTime
</HEAD>
…
<Applet code=QueryApplet.class
... MAYSCRIPT>
</Applet>
...</HTML>
RMI
saveToList(string cookie..)
…
deleteFunction (string cookie..)
...
getSavedList (string cookie..)
...
Local
File I/O
ClientQueries
(Folder)
Cookie1.txt
Cookie2.txt
Cookie3.txt
Cookie Code
Cookie String (Applet Global Variable)
= local_host_name (from static method)
+ TimeStamp (from JavaScript returnTime )
String cookie;
try {cookie = InetAddress.getLocalHost().toString();}
catch(UnknownHostException uhe){cookie = "Unknown Host";}
if ( cookie.indexOf("/") != -1 )
cookie = cookie.substring(0, cookie.indexOf('/'));
JSObject win = JSObject.getWindow(this);
JSObject doc = (JSObject) win.getMember("document");
Object [] Arg = {"client"};
String ClientCookie = (String) win.call("getCookie", Arg);
if (ClientCookie.equals("undefined")) {
String time = (String) win.call("returnTime", null);
int begin = time.indexOf(',') + 1;
int end = time.indexOf('U')-1;
time = time.substring(begin, end);
time = time.replace(' ', '_');
time = time.replace(':', '_');
time = cookie + time;
Object [] Args = {"client", time , new Integer(30)};
win.call("setCookie", Args);
cookie = (String) win.call("getCookie", Arg); }
else {cookie = ClientCookie;
Swing Tables
ListSelection
Listener
JComponent
TableModel
Listener
TableColumn
ModelListener
Table
ColumnModel
JTable
DefaultTable
ColumnModel
Abstract
TableModel
ListSelection
Model
DefaultList
SelectionModel
TableModel
CustomModel
Default
TableModel
The End