Josef Vosyka's Java Examples

This is very old page, many links do not work, will update it, asap.

The following samples should serve as presentation of some Java constructs. It is meant to be a guide "how to use" particular technique and kind of proof of "this is reality" (not just joking) !

There are on-line Core Java and examples documentation (javadoc), OMT class diagrams of some of sample classes and related topic links on the top of every section dedicated for "fast start".

The categories are:


Generic

Counter
An instance of class Counter provides generic featutes of simple counter such as incrementing and decrementing integer value. This class serves as a base class for another more sophisticated samples.

Try it with just JDK 1.0 enabled browser.

Dependences: none

Source code:


JDBC

Related Links


Database Explorer

In this sample we do exploration of an database using JDBC. It demonstrates key features such as connecting to a database, examination of database or table metadata and viewing of a query results. All this can be run by static main method or by using servlet based Web service.

Try it with just JDK 1.0 enabled browser.

Dependences: none

Source code


Staff Finger

Many of JDBC techniques are presented in this example. It implements database of labourers locations. One can use this database for registering its new location, review other's locations and find somebody's location at particular time. All this funcionality is accessed by servlet based Web service.

Try it with just JDK 1.0 enabled browser.

Dependences: JDBC/Database Explorer

Source code


Network

Socket Echo
In this sample one can see socket implementation of Client - Server architecture. Simple socket server is used for copying all its input back to client.

Try it with just JDK 1.0 enabled browser.

Dependences: none

Source code


JSDK

Related Links


Remote Object Register

When working with RMI one has a need to have its remote objects run on a server so others can use them. It is uncomfortable to have an application run all the time just because of a remote object registration. A solution can be use Java servlets to make Web service for remote object registration. Voala - here it is ! The only condition one has to accomplish is that all necessary class files have to resist in the server CLASSPATH.

Try it with just JDK 1.0 enabled browser.

Dependences: none

Source code


Server Object Server

There is many times a need to run an object as a server service. Using this java server service may one bind its own object on a Web server under a given name and have it run as a service. The only conditions one has to accomplish are: (a) object has to implement Bindable interface and (b) all necessary class files have to resist in the server CLASSPATH.
Samples using this service could be: RMI/Remote Counter, CORBA/Remote Counter, Net/Socket Echo

Try it with just JDK 1.0 enabled browser.

Dependences: none

Source code


CORBA - IDL

Samples in this category demonstrates usage of Java implementation of IDL. Used version of IDL compiler is Alfa 2.2. Note that there are known problems when using Netscape 3.1.

Related Links


Remote Counter

This sample extends generic/Counter with Java IDL features to be a remote object so its state and behavior can be accessed via a network.

Try it with just JDK 1.0 enabled browser.

Dependences: generic/Counter

Source code:


Remotely Observable

The behavioral design pattern is known from its Java implementation as Observable - Observer couple from java.util package. The need of having an remotely observable object may arise when one is doing distributed computing. This extension of Java standard Observable is based on Java implementation of IDL version alfa 2.2. Note that this is a preliminary release without implementation of type Any. Because of this absence the notify method has no parameters (parameter type vary from case to case).

Dependences: none

Source code


Observed Remote Counter

This sample is based both on Corba/Remote Counter and Corba/Remotely Observable. It extends Corba/Remote Counter to be accessible via network and uses Corba/Remotely Observable behaviour to be observable by remote observers.

Try it with just JDK 1.0 enabled browser.

Dependences: generic/Counter; Corba/Remote Counter; Corba/Remotely Observable

Source code:


RMI

Samples in this category demonstrates usage of Java implementation of RMI - Remote Method Invocation.

Related Links


Remote Counter

This sample extends generic/Counter with Java RMI features to be a remote object so its state and behavior can be accessed via a network.

Try it with JDK 1.1 enabled browser.

Dependences: generic/Counter

Source code:


Remotely Observable

The behavioral design pattern is known from its Java implementation as Observable - Observer couple from java.util package. The need of having an remotely observable object may arise when one is doing distributed computing. This extension of Java standard Observable is based on Java RMI.

Dependences: none

Source code


Observed Remote Counter

This sample is based both on RMI/Remote Counter and RMI/Remotely Observable. It extends RMI/Remote Counter to be accessible via network and uses RMI/Remotely Observable behaviour to be observable by remote observers.

Try it with JDK 1.1 enabled browser.

Dependences: generic/Counter; RMI/Remote Counter; RMI/Remotely Observable

Source code:


(c) 1997 by Josef Vosyka. Any questions or comments send to josef.vosyka@vsb.cz.