The objective of this section is to introduce how to compile
components to run on Openwings, using the HelloWorld components
as examples. Make sure you've reviewed the HelloWorld synchronous
and asynchronous examples and code. It's OK if you don't understand
connectors yet. This is discussed in the next section, Connector
Generation, and in the Developing Components trail.
For the demo programs, we have provided a cross platform compilation
tool called Ant.
Ant is a make-like utility that uses Java and XML build files
to perform platform independent builds. These build files perform
compilation tasks and other build tasks all in the interests of
developing and deploying components. Ant primarily uses a build
file called build.xml. For the HelloWorld examples, this build.xml
file can be found in:
<OW_HOME>/<componentName>/src/com/gd/openwings/demo/helloworld/<folder
name>
where <OW_HOME> is the location
in which you've installed Openwings on your system, and where
the <folder name> is:
- provider for HelloWorldProvider
- service_sync for HelloWorldServiceSynchronous
- service_async for HelloWorldServiceAsynchronous
- user for HelloWorldUser
- publisher for HelloWorldPublisher
- subscriber for HelloWorldSubscriber
Generally, ant commands are of the form "ant <target>".
To compile your Hello World component, change directory to <OpenwingsHome>/<componentName>,
and then simply type the word "ant" at a prompt in the
component directory to execute the default target. This will:
- compile the component code - create an executable object
- generate the policies - produce information about runtime environment
- generate any connectors - produce means of code mobility
- create javadocs - generate component documentation
- create an installable component jar - create an installable image
The goal in Openwings is to have a single jar file that can be
used to install your component. Ant's default target generates
this installable component jar file. When the installable component
jar file is built, the following files will be placed in directories
inside the jar file as indicated below. You can see these files
yourself by extracting an installable jar file using the jar program
included with the Java SDK.
|
File
|
Where in the .jar file it
is placed
|
|
Policy files
|
policies/
|
|
Connectors
|
lib/
|
|
Javadocs
|
docs/
|
|
Installable component jar file
|
current directory of build.xml
|
|
Object code (class files)
|
lib/ (inside another .jar file)
|
This is simply an introduction to show how easy it can be to
compile a component. To learn more about Ant, go to the Compilation
section of the Developing
Components tutorial trail.
Next: Connector
Generation