Guide to Decoupling Your Project

It may be the case that you wish to leave the Tynamo™ distribution alone, and keep all your source and configuration files in a separate place. This is possible to do, and does not take much effort to accomplish.

The intended audience of this guide is those who have become moderately familiar with the Tynamo™ setup process.

Summary

In short, only the files to be sent to your device, your sources, and the two *.properties files need to be in your own project directory. When you set the basedir Ant property, you will have completely separated your project from the Tynamo™ distribution.


Steps

  1. First, create your own project directory. For example, create /Projects/coolserver. The disussion that follows will use this example.
  2. Next, create the following subdirectories:
    • src — This will contain your source files.
    • device — This will contain all the files you wish to be transferred to your device.
  3. Lastly, copy build.properties and deploy.properties to the project directory.

[If you will be modifying the build.xml script then copy this file as well. In this case, make sure to change the deploy.root property inside the script to the location of the Tynamo™ distribution. To do this, replace the line that contains

<dirname property="distro.root" file="${ant.file}"/>

with a line that looks like

<property name="distro.root" value="/tynamo-cdc-1.0"/>

Be sure, also, to replace "/tynamo-cdc-1.0" with the actual location of the distribution.]


Project Location — How to Use Ant

The build.xml file, by default, executes from the distribution location. To override this, set the basedir property when starting Ant.

For example, say your project directory is located in /Projects/coolserver and your Tynamo™ distribution is located in /tynamo-cdc-1.0. The two ways of setting this as your base project directory are as follows:

  1. Change to /Projects/coolserver and execute:
    ant -Dbasedir=. -f /tynamo-cdc-1.0/build.xml
    OR:
  2. ant -Dbasedir=/Projects/coolserver -f /tynamo-cdc-1.0/build.xml

The second option is more explicit, and probably safer to use in the presence of many different projects and project files.

Note: Starting Ant this way is unnecessary if you have chosen to copy the build.xml file to your project directory.


Project Files

All your project files are arranged in the same way as the Tynamo™ distribution, just located in a different directory.

Source Files

Place all your source files into the src/ directory you have just created (or another location of your choosing), and set up the build.properties file to use this as the source files location. For example:

src.paths=src
src.files=com/mycompany/servlet/**/*.java

Device Files

All the files to be transferred to your device should reside in the device/ directory. You can set up the contents by using the example in the distribution:

  • device/bin/ contains the webserver binary and configuration files,
  • device/http-root/ contains all your HTML, images, and web-accessible content, and
  • device/logs/ is left empty, and will contain your server and transfer log files. Note that the webserver.props file controls where the logs are placed, so this can be changed or deleted.
  • device/lib/ contains the servlet library (servlet-2_2.jar), if needed. The EJC platform, for instance, already includes the servlet classes.

Build and Deployment Configuration

The build.properties and deploy.properties files are set up as usual. Please consult the documentation for further details. The relevant documents include Building a Custom Web Server and Deploying Tynamo™-CDC with Ant.