| Ecole Polytechnique Fédérale de Lausanne Faculté informatique et communication Institut des systèmes informatiques et multimédias Laboratoire de téléinformatique |
|
|
|
| Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 |
Documentation and Basic Modules GUI events TCP/IP, RMI Security, Authentication XML and javacc Databases Web applications Enterprise Java Beans Java Multi-threading Process development |
See also
Web development with Eclipse Synchronous objects |
TestHash.java (source separate
window)
(a class that can be used as a key)
Chars.java (source
separate window)
(the character set in different forms:
iso-8859-1, UTF-16 . . .)
UseMatcher.java (source separate window)
(this program shows an example of the use of pattern
matching)
Properties.java (source separate window)
(this program displays the properties defined in an
application)
Some useful scripts for Windows (also a basis for various operations):
delTilde.bat (separate window) This script deletes the *~ files in the current directory and all its subdirectories.
listjar.bat (separate window) This script looks for a given class in the jar-files located in the current directory or in all its subdirectories. This script calls itself, thus its structure is rather complex (there are labels to skip the first lines when it is reentered).
listjar directory ClassName
findChain.bat (separate window) This script looks for a string in the indicated files: findChain *.xml searchedString in the current folder and in all its sudirectories.
GUIListener.java (source separate window)
(provides an example of listeners for each
GUI elements present in the book)
GUIGridBag.java (source separate window)
(example of the use of the grid bag layout)
MyAppletClass.java (source separate window)
(example of an applet started when the
browser loads the HTML-file given below
In order to see the content of the
page display its source in the browser)
MyAppletClass.html (source separate window)
mainOrApplet.java (source separate window)
(this applet can be started either as a
java program or when the browser loads the HTML-file below)
mainOrApplet.html (source separate window)
More examples in Chapter 10
This remote object stores the stub extracted from its body into a file and this client extracts the stub from the file and calls it. Their common interface
Symmetric.java (source
separate window) (source separate window) (source separate window)
(Symmetric communications: a copy of this program can be
started in one window and another one in another window to establish a
symmetric communication)
Same program with method export (source separate
window) (source
separate window)
Same program based on WebLang (not the latest version of WebLang !)
(source separate window)
Compiler le fichier ci-dessus au moyen de WebLang, puis
effectuer les modifications suivantes:
for (;;) {
Thread.sleep(1000);
if (obj.stub!=null)
obj.stub.print("Bonjour");
}
public Periph stub = null;
remote.transferStub((Periph)UnicastRemoteObject.toStub(new RemotePeriph()));
GetProps.java (source separate window)
(this program has been taken from the SUN tutorial.
It displays a few properties)
Start this program with and without a security manager
java -Djava.security.manager GetProps
Start program Properties available in Chapter 1 with
and without a security manager
java -Djava.security.manager Properties
PermissionCheck.java (source separate window) (description)
(This program starts a security manager if none was
specified in the command line and then checks the availability of some permissions)
Handling Permissions (description)
(These programs show how to login, how to assign permissions,
and how to execute a program with these permissions, either when they are
granted to any user of the program (both normal and in the privileged mode)
or when they are granted to a subject logged in the system).
Password encryption (source separate
window)
(This program contains methods to encrypt a password
in the form required to store it in a username-password list).
Password Based Encryption (source separate window)
(This program contains methods to derive a key from
a password and to encrypt a message with that key. The program also contains
the decryption).
- JAAS complement to the main javadoc (such as com.sun.security.auth)
- Tutorial: Security in Java 2 SDK 1.2
- Presentation: Java Authentication and Authorization Service (JAAS) 1.0
(Login configuration, subject, principal, credential, sample program, list of permissions)
- Description of the security architecture (login, cryptography, security manager, tools)
MySAXAutomaton (description)
(this program has an automaton that keeps track of
the context)
MySAXStates (description)
(same as above, but with the state design pattern)
ParseXML (description)
(hand made parser)
DomParser (description)
(DOM parser)
XMLParserSKIP.jj (source separate window)
(javacc file generating a parser that skips the spaces.
It handles the token contexts, see description)
XMLParserSPACES.jj (source separate window)
(javacc file generating a program that takes care of
the spaces)
XMLParserCDATA.jj (source separate window)
(javacc file generating a program that can read CDATA
blocks)
XMLParserTree.jjt (source separate window)
(jjtree file that generates a javacc file that in turn
generates a compiler that produces a tree)
EPFL_Command.java (source separate window)
(auxiliary file for the program above)
first.sql (source separate window)
Create table products and displays the format
registered by the database.
fulltext.sql (source
separate window)
Creates a table with various texts and a full text
index over these fields. A command
then retrieves the fields from the full text index
( Remember, only symbols with more than
3 characters and that are not too common are indexed
).
describe.sql (source
separate window)
Creates a table with auto-increment and not null and
show them on
selects.sql (source
separate window)
Creates three tables and shows different kinds of selections
involving two tables.
where.sql (source
separate window)
Examples of WHERE clauses.
group.sql (source
separate window)
Shows different types of ordering (GROUP or
ORDER command).
constraints.sql (source separate window)
Creates a table with constrained relationships between
the tables. The file contains
examples of retrievals and deletions.
delUpdate.sql (source
separate window)
Examples of UPDATE and DELETE commands.
functions.sql (source
separate window)
Use of the AVG, SUM, MIN, MAX functions.
transactions.sql (source separate window)
Lists of commands to try transactions and see blocking
commands and deadlocks.
relation11.sql (source
separate window)
relation1N.sql (source
separate window)
relationNM.sql (source
separate window)
Lists of commands to demonstrate the use of relationships
(delete the tables with the commands located in the
same file as the creation statements!).
grades.sql (source
separate window)
Example of a small database handling students notes
exclusively with SQL.
DBConnect.java (source
separate window)
Example of a small Java that executes the SQL command
given on the command line.
Grades.java (source
separate window) Display.java (source separate window)
Example of a (Synchronous) Java program handling students
grades in a database (in blobs located in the student table). The database
is not created by the program, but must be created before launching the program.
The SQL commands to create the database are available as comments in the
Java program. In the window opened by the program, the student ids, the
exam ids and the grades must be entered as integers.
ManualServer.sjava (source1, source2)
(This program can be used in the place of an HTTP server
and addressed from a standard browser. It will display the data received
usually by the server. In order to start the program, type "java -jar
MServer.jar 8080".
Then replace the address of the computer appearing in the actions of the 2 FORM commands in Form.html given above by the address of the computer on which MServer runs and possibly adapt the address 8080. Load the new Form.html in a browser, click elements, or select an (ASCII) file, and look what appears in MServer (all outputs are appended). In order to respond to the browser, type some lines of text in the input field of MServer, terminated with CR, then enter "." in the field.
Button.html (source
separate window)
(A trivial Javascript program)
Javascript.html (source separate window)
(Form with a series of input elements handled with
Javascript)
PositionImage.html (source separate window)
(When the user clicks on the image, an alert shows
the coordinates of the point clicked)
animation.html (source separate window)
animationImage.html (source)
(Shows how to create animated images in a browser)
httprequest_test.html (source separate
window)
(shows how Javascript can read data from a server:
object XMLHttpRequest)
KickStop.java (source separate window)
(a simple memoryless semaphore)
UnlimitedNotify.java (source separate window)
(channel using a simple notifyAll)
TestUnlimitedChannel.java (source separate
window)
(uses a trigger and a linked list to start
only one process)
(the trigger must be handled by the user
program)
TestUnlimitedChStatic.java (source separate
window)
(uses the same trigger as above, but it
its address is passed
in the static area attached to the
threads)
Rendezvous.java (source separate window)
(all threads are in the meeting place but
one. When the running
thread enters the meeting place another
one is released)
LimitedNotify.java (source separate window)
(simple implementation)
LimitedNotifyMeasure.java (source separate
window)
(same as above, but prints the time nedded
for the transfers)
P1.java (source
separate window)
(Use of object ThreadLocal)
LimitedTriggerCh.java (source separate
window)
(limited channel based on a trigger object
passed in the thread static reference)
LimitedTriggerStaticChMsr.java (source
separate window)
(same as above, but with mesureament statements)
PipeBetweenThreads.java (source separate
window)
(a piped stream as a channel between two
threads)
GUITest.html (source
separate window)
(a source diretory that can be introduced
into an Eclipse project)
LimitedSynchronousObject.sjava (source
separate window)
(channels built with synchronous active
objects; contains
a version with a thread in the channel
and one without thread)
SemaphoreTest.sjava (source separate window)
(a increment-decrement semaphore)
LockTest.sjava (source separate window)
(lock that can be used to assure that only
one thread is in a critical
area at any one time)
ReaderWriter.sjava (source separate window)
(reader-writer problem)
ReaderWriterQueue.sjava (source separate
window)
(reader-writer problem; the order of the
arrival is kept in a queue
which allows the scheduler to let readers
wait for a while to let
a previous writer pass)
Sliding window protocol (go-back-N) (source separate window)
(the files used to construct a environment
to test the sliding
wildow protocol)
GUISingleListener.java (source separate
window)
(connection of a GUI to the program body
by means of a single listener, that notifies the events)
GUISync.java (source separate window)
(connection of a GUI to the program body
by means of triggers)
SimplifiedStatePattern.java (source separate
window)
(Implements an automaton with the help
of a simplified version of the state pattern)
DialogEvent.java (source separate window)
(implements the username/password example
simply with listeners)
Username.java (source separate window)
(implements the username/password example
with the help of the state pattern)
SimpleUsername.java (source separate
window)
(implements the username/password example
with the help of the simplified state pattern)
Dialog.sjava (source separate window)
(implements the username/password example
with the help of synchronous active objects;
it uses the same support as below
source)
DialogMainThread.java (source separate
window)
(implements the username/password example
with the help of a trigger between the GUI and the program)
FSM.java (source
separate window)
(The finite state machine of Figure 10.2
"State chart diagrams" implemented with listeners)
SyncFSM.jar (source separate window)
(The same machine implemented with synchonous
active objects
see GUITest above to see how to
compile it)
Game stone/paper/scissors - the well-know game implemented with:
- topic, RMI+deadlock, RMI+invokeLater
(source)
- a trigger (source)
- synchronous objects (source)
CourseManagement (CourseEJBs.jar
CourseManagement.jar)
(An example of distributed application using Javascript,
Struts and EJBs, made before WebLang was available)