4 mins tutor / Installing

Download

Download distribution from Sourceforge. Unpack.
> tar xfvz pat-M1-XX.tgz

Software requirements

To run the example you need:

Run Ant

Run ant from command line or your favourite IDE:
> ant
You'll see output like this:

apollo-13:59:56$~/tmp/pat> ant
Buildfile: build.xml

help:
[echo]
[echo] You may run several ant targets:
[echo]
[echo] > ant skeleton-app
[echo] >
[echo] > ant tests
[echo] > ant tests2
[echo] >
[echo] > ant run-demo-withSnapshot
[echo] > ant run-demo-withoutSnapshot
[echo] > ant run-performance-demo
[echo]

BUILD SUCCESSFUL
Total time: 0 seconds

We'll work with skeleton-app target..

Change directory to your new base directory for first application:


> cd src/skeleton/
> dir
> Main.java Transfer.java World.java

View those three files. One of them is Java application: Main. The other two are PAT classes. One of them is root class and the other is business object.

Root

The requirement of PAT is to have a root class, that will have indirect references to all other business objects. It is not so scary as it sounds :)

In our first app we have one business object: Transfer. As we see the root class: World - it simply consists of list of Transfer objects.

Transactions

The only transaction in our example is transfer() method of World class. It simply adds empty object to a list, every time it's executed.

Application

Main class simply creates root object and executes transaction on it.

Running

Just run on command line or through your favourite IDE:
> ant skeleton-app

Run it several times, so you'll see it really works. The amount of transfers is increasing every time the application is run.
Database files (Prevayler's files) are held in P-databases/skeleton-app/ directory by default.

Editing

Feel free to change those classes. For more examples see another demo app.

Problems?

If there are any, try to look in Common problems. If it fails, go and ask.

Revision: $Id: 4min_tutorial.gtml 3710 2005-05-29 01:19:01Z nthx $
Generated with GTML