| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[Back to Index] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This document discusses how to configure Tynamo™ for aJile systems. The server configuration is specified with system properties. Other configuration data, including that for Servlets and MIME types, are stored in Java resources. The sections below detail the steps necessary to properly configure all components of the server. There is a sample JemBuilder project, called Tynamo.ajp, included in the distribution that can serve as a starting point for your own builds.
0. Build Environment PathsBe sure to set up the correct paths in your build environment. Sometimes, absolute paths are used for configuration, and these must be changed for every environment on which your project will be built. For JemBuilder, configure:
The relative path segments for these paths in the sample project should be correct, therefore you only need to change the part that contains the root of your project. For example, /myprojects/tynamo/bin/tws_core.jar should still contain the bin/tws_core.jar part, while the first part must be changed to the root of your Tynamo project. Note that the paths for the above two JemBuilder locations (and only those two locations) are constructed using path and file separators appropriate to a specific OS. For example, Windows users must use a backslash (\) as the file separator character, and a semicolon (;) as the path separater. UNIX-like users generally use a forward slash (/) as the file separator character, and a colon (:) as the path separator. For example, this classpath for UNIX-based systems:
should look like this on Windows systems:
The Classpath and ResourcesSome configuration parameters, such as the servlet mappings and the MIME types, and also any HTML pages and images, are stored in the build as resources. To have JemBuilder include these resources, their parent location must be one of the classpath entries. For example, the Tynamo distribution includes all resources inside a directory named res. Thus, one of the classpath entries must be <path_to_tynamo_distribution>/res. To illustrate further, take the servlet configuration file, whose contents are stored in a resource named "/config/servlets.props". Since the file is stored as res/config/servlets.props, and since <path_to>/res is in the classpath, the resource will be found. The section on resources has a further discussion on this topic. [Top] 1. System PropertiesThe HTTP server and Servlet container are configured using system properties. Tables 1, 2, & 3 describe each recognized property. Table 4 describes some additional properties recognized by aJile systems. Finally, Table 5 details some properties that are recommended to get the 1-Wire library to work. Server Configuration
Servlet Container ConfigurationLogging ConfigurationaJile-Specific ConfigurationThe aJile platform has the ability to configure additional server-related features such as DNS resolution and socket timeouts. Table 3 describes these properties. Note that the DNS properties are required if the mailhost is not in the four octet form, and you wish to mail the logs. Recommended 1-Wire ConfigurationThe 1-Wire API for J2ME Readme says to make sure the following properties are set for proper execution of the library. [Top] 2. Including
|
Class | Description |
---|---|
com.ajile.net.DNSClient |
Generally some sort of name resolution is desired. For example, it is needed if the mailhost is not specified in the four octet form. |
com.qindesign.servlet.DefaultServlet |
This is required if you have not supplied your own default Servlet. |
com.sun.cldc.io.j2me.datagram.Protocol |
This is required for name resolution and also for SNTP requests. Note that this may already be included by default. |
com.sun.cldc.io.j2me.serversocket.Protocol |
This is required for creating a server socket that listens for
incoming requests. Note that this may already be included by default. |
com.sun.cldc.io.j2me.socket.Protocol |
This is required for making a conection inside the "mailto"
protocol. Note that this may already be included by default. |
com.sun.cldc.io.j2me.mailto.Protocol |
The mail client code needs this. The HTTP logging code and possibly some servlets will use the "mailto" protocol. |
The 1-Wire library needs some classes to be added, according to the 1-Wire J2ME Readme.
Class | Description |
---|---|
com.dalsemi.onewire.adapter.USerialAdapter |
Class that communicates with the 1-Wire master. Often this will talk to a DS2480. |
com.dalsemi.onewire.container.OneWireContainer |
The base class for all 1-Wire device containers. |
There will generally be two sets of classes that will need to be added to the
Class.forName
list. These are Servlet classes, and 1-Wire
container classes. There is a third set of classes: those which your own
Servlets call using this mechanism, either directly or via the use of
additional connection protocols.
Any servlets with a valid mapping need to be added to the list. For example, these are necessary for including the example servlets in your build:
com.qindesign.servlet.example.AuthExampleServlet
—
Authentication example.com.qindesign.servlet.example.DeviceInfoServlet
—
Device information example.com.qindesign.servlet.example.RequestInfoServlet
—
Your request information.com.qindesign.servlet.example.OneWireServlet
—
1-Wire explorer.com.qindesign.servlet.example.FamilyCode20Include
—
Used by OneWireServlet
for accessing an A/D converter device.com.qindesign.servlet.example.PotentiometerInclude
—
Used by OneWireServlet
for accessing a potentiometer device.com.qindesign.servlet.example.SwitchInclude
—
Used by OneWireServlet
for accessing a switch device.com.qindesign.servlet.example.TemperatureInclude
—
Used by OneWireServlet
for accessing a temperature device.Any 1-Wire containers that need to be recognized should be included. For example, these are used by some of the above servlets:
com.dalsemi.onewire.container.OneWireContainer10
—
Temperature container.com.dalsemi.onewire.container.OneWireContainer12
—
Switch container.com.dalsemi.onewire.container.OneWireContainer20
—
A/D converter container.com.dalsemi.onewire.container.OneWireContainer2C
—
Potentiometer container.
Lastly, any additional protocol classes used by a call to Connector.open
should be added as well.
[Top]
The server looks for a resource named "/config/servlets.props" to find the servlet configuration. The distribution stores this as the file res/config/servlets.props. Please consult the Servlet Configuration document for a detailed description this file.
A more detailed discussion about adding resources to your build is in another section on the classpath and resources, but briefly:
To include this resource in your build, create a file named servlets.props inside a directory named config. Add the parent of config to your build classpath, and add the resource "config/servlets.props" to the Resources panel in JemBuilder. Note that there is no leading '/' character.
[Top]
A resource named "/config/mimeTypes.props" is accessed to read the MIME Type configuration. Please consult the MIME Types Configuration document for a description of this file.
A more detailed discussion about adding resources to your build is in another section on the classpath and resources, but briefly:
To include this resource in your build, create a file named mimeTypes.props inside a directory named config. Add the parent of config to your build classpath, and add the resource "config/mimeTypes.props" to the Resources panel in JemBuilder. Note that there is no leading '/' character.
[Top]
The default default-Servlet provided with this distribution is able to access any Request-URI with a matching resource. This means that you can include any files and binary content you need by attaching them as resources. The following guide for including these in your build is based on JemBuilder from aJile.
The procedure of including a resource in your build is best described by an example. Say you want the file /images/tree.gif to be accessible to a browser.
There are several noteworthy things to point out. First, there should not be a leading '/' character in any of the resources in your resources list. Each resource is accessed as if it already had a '/'. Second, all HTTP-accessible resources should begin with "http-root/". The reason for this is that the server divides the resources into two namespaces: "config" and "http-root". All resources beginning with "config/" are potentially configuration information, and all resources beginning with "http-root/" are candidates for being accessed by an HTTP request.
Lastly, forward slashes, and not backslashes, are always used, as this is how Java accesses resources.
A few files were provided to help get you started with your own content. These are found in the res/http-root directory. The set includes an index.html, the default welcome file.
[Top]