Persistent Applications Toolkit

Choose font sizeNormal TextBigger TextHuge Text

Running

Quick help:


1) ant compile
2) java -classpath pat-*.jar;prevayler1-4-pat-*.jar
         -Djboss.aop.path=etc/aop/
         -Drepository.dir=P-databases/app/
         app.MainApp

  1. Design
  2. Compilation process
  3. Classes needed
  4. Variables

General rules

Design

Distribution ships with two example applications. One found in org.nthx.pat.demo package in src/main/ directory and another, very simple one - skeleton app - found in src/skeleton-app/ directory.

Based on two of them you should be able to design your object world and write a simple application.

Compilation process

PAT is an aspect. More on aspects you'll find in Aspect Oriented Programming areas. What is important for running PAT is that the compilation process is little bit more than simple <javac>.

After compilation of Java sources one needs to compile just compiled classes with another compiler - AopC. It comes with JBossAOP distribution (shipped) with PAT).
There are many ways of compiling sources: using Ant task, invoking it from command line. I support only Ant tasks for now. More on this may be found in http://www.jboss.org/products/aop/

Basically, remember to do two steps:

  • compile your Java sources with Java compiler
  • compile binary `*.class' files with JBossAOP compiler

Two Ant's tasks exist for compiling `*.class' files: <annotationc> and <aopc>. One may see examples of usage in build.xml file.

Classes needed

For compilation process you need all the *.jar files found in lib/ and dist/ directory.

PAT classes can be generated with:

ant dist
They are placed under dist directory. Just copy two files to your classpath's place:

cp dist/pat-*.jar <your-dir>/lib
cp dist/prevayler1-for_pat-*.jar <your-dir>/lib

Variables

No matter how you will run your java apps, there are two system variables you must pass to the PAT.

  • jboss.aop.path (default value: ./etc/aop/)
  • repository.dir (default value: ./P-databases/demo/)

jboss.aop.path

This variable must be always passed to JVM as a system property.
Value of this variable must point to a directory in which `*-aop.xml' files exist. Those are JBossAOP configuration files. PAT needs them to work.

Look at build.xml file, to see how to pass this variable using Ant.

When one uses IDE then - depending on your IDE - you also have to pass this variable. When running a TestCase in IntelliJ IDEA for example, one has an option to pass additional variables to a test case. Put:

-Djboss.aop.path=directory_with_aop_files/
If a directory is a relative path ("etc/") for example, then remember to properly set "working directory" to the JVM.

PAT distribution (as you can see in build.xml) uses `${basedir}/{etc.dir}' value in Ant script.

repository.dir

This variable points to a directory in which PAT and Prevayler holds its data files.

Every different application (which differs in class' schema) has to use different directory for storing/reading those files.

Distribution customizes the variable in Ant's build.properties file.

Default PAT's value is: P-databases. Then 4 directories go:

  • for tests: tests,
  • one for a user's application based on provided skeleton: skeleton-app
  • for demonstration application found in `org.nthx.pat.demo' package: demo.
  • Finally, one for performance app: performance.

The directory structure of a database looks like this:


./P-databases/+
              |-tests/
              |-skeleton-app/
              |-performance/
              |-demo/

Problems?

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

SourceForge.net Logo

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