Classy Data

Portable Java Development

Once the Classy Data project is built with the "java-build" profile, you are ready to commence generally portable Java development. Four of the seven project modules are included and described in the following table:

ModuleDescription
classyjavaPortable lightweight Java Persistence API for persisting objects to SQL databases
classyutilsSmall utilities library relating to Java beans, logging and multi-tasking
many2many-exampleDemonstrates many-to-many relationship
hello-two-dbs-exampleDemonstrates dynamic upgrade of 2 databases

Usage details will be presented in the Many to Many Sample so a working demonstration is available for reference.

Java IDE

The best way to examine the code and run the examples is with the use of a Java IDE. Classy Tools contains project files for Eclipse IDE, as this is the tool chosen for development. However, any Java IDE is suitable, and one with a Maven plugin is especially adaptable. Instructions for importing the project into Eclipse follow, but will be similar for any IDE with a Maven plugin. These are some of the considerations for achieving a successful import:

  1. Dependencies. These are downloaded and stored in the local repository by Maven. An IDE needs to access this repository.
  2. Resources. The default Maven folder configuration has been applied, but it is possible to make changes. Note that for the examples to work, resources such as perisistence.xml need to be on the classpath.
  3. Annotation Processing. Dagger dependency injection uses the Java pre-compilier to minimize runtime costs. Configuration details are IDE-specific and may also depend on which version of Java is selected.
  4. Classpaths. Each module has test classes and resources which require differenct classpaths to main classes. Look for Maven dependencies with "test" scope.

Eclipse

Here are instructions on how to import Classy Data into Eclipse:

  • From the top menu select File, Import...
  • Maven
  • Click "Existing Maven projects" and then click Next.
  • Set "Root Directory" to the Classy Data home location.
  • 8 projects will be selected automatically. Unselect the last 3 as illustrated below
  • Click Finish.

classy_data import

Annotation Processing

Annotation processing required for Dagger dependency injection. You may wish Maven to configure annotation processing so Eclipse and Maven keep in sync over time. You will need to install the m2e-apt plugin available from the Market Place. Once this plugin is installed, you need to change the default Maven Annotation Processing configuration. For more information, see this article which shows how to install m2e-apt plugin. It also shows how to configure annotation processing manually.

Next Steps

You can now examine the code, run unit tests and the samples. Start with Many to Many Sample,

  • Run as JUnit test, the JUnitTestSuite in classyjava test package au.com.cybersearch2.classyapp.
  • Run as Java Application the ManyToManyMain in many2many-example main package au.com.cybersearch2.example