OpenCCM - Ant User's Guide

Table of Contents

  1. Ant description
  2. OpenCCM available targets
  3. Build process structure
    1. File structure
    2. Build process structure
  4. OpenCCM available tasks
    1. List of tasks
    2. Cleaning CORBA files
    3. Checking Java files
    4. Generating Java empty interfaces
    5. Generating JAR archives from a package
    6. Merging multiple archives into a single one
    7. Compiling an OMG IDL2 file
    8. Generating an XML parser from a DTD file
    9. Compiling an XML parser
    10. Using the launcher from Ant
    11. Starting the OpenCCM Interface Repository
    12. Feeding an OMG IDL 3.0 file into the OpenCCM Interface Repository
    13. Generating equivalent OMG IDL 2.4 mapping from the OpenCCM Interface Repository
    14. Generating the Java OpenCCM skeletons from the OpenCCM Interface Repository
    15. Generating all the Java implementation templates from the OpenCCM Interface Repository
    16. Compiling an OMG CIDL file and generating associated files
    17. Generates all Java OpenCCM templates associated to a CIDL file for the CIF
    18. Compiles an OMG PSDL file and generates associated Java mapping
    19. Stopping the OpenCCM Interface Repository
  5. How to integrate a piece of code?
    1. Integrating source code into an existing package
    2. Integrating source code into a new package
    3. Defining a new module

Ant description

Apache Ant is a Java-based build tool. In theory, it is kind of like make, without make's wrinkles.

Makefiles are inherently evil as well. Anybody who has worked on them for any time has run into the dreaded tab problem. "Is my command not executing because I have a space in front of my tab?!!". Tools like Jam took care of this to a great degree, but still have yet another format to use and remember.

Ant is different. Instead of a model where it is extended with shell-based commands, Ant is extended using Java classes. Instead of writing shell commands, the configuration files are XML-based, calling out a target tree where various tasks get executed. Each task is run by an object that implements a particular Task interface.

Granted, this removes some of the expressive power that is inherent in being able to construct a shell command such as `find . -name foo -exec rm {}`, but it gives you the ability to be cross-platform - to work anywhere and everywhere. And hey, if you really need to execute a shell command, Ant has an <exec> task that allows different commands to be executed based on the OS it is executing on.

OpenCCM available targets

Currently, OpenCCM supports the following main targets:

Target Description
build Build the OpenCCM platform in the <build.dir> directory.
clean Clean all the OpenCCM platform.
clean0 Clean backup files.
clean1 Reset the demonstrations.
clean2 Clean compiled JARs.
clean3 Clean compiled libraries.
clean4 Clean compiled classes.
clean5 Clean generated classes.
compile Compile the OpenCCM platform.
doxygen Generate Doxygen documentation (IDL & Java) in the <build.doc.dir> directory.
idl Compile IDL/DTD files.
install Install the OpenCCM platform into the <install.dir> directory.
javadoc Generate Javadoc documentation in the <build.doc.dir> directory.
parserdoc Generate the JJDocumentation for OMG IDL/PSDL/CIDL parser.
release Create a release archive of the OpenCCM platform.
uninstall Uninstall the OpenCCM platform from the <install.dir> directory.
unrelease Delete the previously generated release.
website Generate the OpenCCM website in the <web.dist.dir> directory.

Build process structure

File structure

The build process is composed of the files which are stored in the <OpenCCM directory>/src/ant directory. The process is splitted into as modules as files described below:

File Name Description
build.xml Main file of the compilation process.
common.xml Common tasks which are not related to a particular module.
corba.xml Tasks related to the CORBA 2.x compilation.
demo.xml Tasks related to the generation of OpenCCM demonstrations.
deployment.xml Tasks related to the compilation of Deployment/Packaging tools & OpenCCM deployment infrastructure.
documentation.xml Tasks related to the generation of OpenCCM documentation (Javadoc, Doxygen, Website).
envi.bin.xml Tasks related to the execution of the OpenCCM Production Chain tools (e.g. ir3_start, ir3_stop, ir3_feed, etc).
externals.xml Tasks related to the copy of external libraries (Jidlscript, Xerces, Ant, ...).
generator.xml Sub-tasks related to the compilation of OpenCCM generators (IDL3, IDL2, CIF, PSDL, ...).
hfinder.xml Tasks related to the compilation of the HomeFinder component.
install.xml Tasks related to the installation & release of OpenCCM distribution.
platform.xml Tasks related to the compilation chain of OpenCCM (Generator, Compiler, Parser, ...).
plugins.xml Tasks related to the compilation of OpenCCM plugins (transaction, log, ...).
runtime.xml Tasks related to the compilation of OpenCCM runtime (Components, Container, ...).
script.xml Tasks related to the generation of OpenCCM execution scripts.
services.xml Tasks related to the compilation of OpenCCM services (persistence, ...).
task.xml Tasks related to the definition of OpenCCM compilation tasks.
umlrepos.xml Tasks related to the generation and compilation of UML utilities.
utils.xml Tasks related to the compilation of OpenCCM utilities.

Each XML file is associated to a property file which contains the definition of properties required for the OpenCCM build process. The build.user file contains the template for build.properties file which would be completed by OpenCCM users.

Build process structure

The build process has been divided into modules and callbacks. Modules group packages related to the same domain. Callbacks are specific entry points which are defined and called by the main build.xml file during the compilation process. The existing callbacks are:

Callback Description
<module>_init Configure the build process of the module.
<module>_check Check if specific files (DTD, IDL, ...) need to be generated again during the <module>_generate callback.
<module>_generate Generate specific files (DTD, IDL, ...) of the module before the compilation process.
<module>_compile_api Compile the interfaces (API) of the module.
<module>_compile_lib Compile the libraries of the module.
<module>_build Merge all JAR files produced during the compilation of the module into a single JAR file.

The definition of callbacks is quite stable, so please don't define other terms and use these callbacks in priority.

OpenCCM available tasks

List of tasks

check_windows_os Determinates is the current operating system is a Windows operating system. If it is the case, this task sets the isWindowsOs property.
check_unix_os Determinates is the current operating system is a Unix operating system. If it is the case, this task sets the isUnixOs property.
cpp Determines if a user defined C preprocessor is used during the compilation process and set the appropriate cpp-path property.
task_clean_corba_unused Deletes Helper, Holder, Stubs, POA and POATie generated Java files keeping only OMG CORBA 2.4 interfaces.
task_java_available Determines if a Java file is available or not. If this file is available, the file-generated property is set.
task_java_gen Generates an empty interface template of a specified file.
task_package Compiles and creates elementary archive of a set of packages.
task_package_merge Merges a set of archives into a single archive.
task_idl2java Compiles an IDL file and generates the related Java source files (interfaces, stubs and skeletons).
task_dtd2java Compiles a DTD file and generates the associated XML parser.
task_dtd_compile Compiles the parser generated from the task_dtd2java task.
task_launcher Starts a new launcher process.
task_IR3_start Starts the OpenCCM Interface Repository.
task_IR3_feed Feeds the OpenCCM Interface Repository with an OMG IDL 3.0 file.
task_IR3_IDL2 Generates equivalent OMG IDL 2.4 mapping from the OpenCCM Interface Repository.
task_IR3_java Generates the Java OpenCCM skeletons from the OpenCCM Interface Repository.
task_IR3_jimpl Generates all the Java implementation templates from the OpenCCM Interface Repository.
task_CIDL_CIF Compiles an OMG CIDL file and generates associated files.
task_CIF_jimpl Generates all Java OpenCCM templates associated to a CIDL file for the CIF.
task_PSDL_JAVA Compiles an OMG PSDL file and generates associated Java mapping.
task_XMI2IR Feeds the OpenCCM Interface Repository with an XMI 1.1 UML 1.4 document.
task_IR3_stop Stops the OpenCCM Interface Repository.
task_mof_start Starts the MOF Repository.
task_mof_stop Stops the MOF Repository.

Cleaning CORBA files

The task_clean_corba_unused task supports the following arguments:

ArgumentDescriptionRequired
directoryThe root directory containing the files to clean.Yes

Checking Java files

The task_java_available task supports the following arguments:

ArgumentDescriptionRequired
build.gen.dirThe root directory for looking for the file.No
dirPath to the file to find.Yes
nameName of the file to check.Yes

Generating Java empty interfaces

The task_java_gen task supports the following arguments:

ArgumentDescriptionRequired
build.gen.dirThe root directory for looking for the file.No
dirPath to the file to create.Yes
packagePackage of the generated file.Yes
nameName of the file to create.Yes

Generating JAR archives from a package

The task_package task supports the following arguments:

ArgumentDescriptionRequired
sourceList of root directories containing the files to compile (separated by :).Yes
packageList of packages to compile (separated by ,).Yes
deleteList of files to delete before creating the archive (separated by ,).No
archiveName of the archive to create with the compiled files.Yes

Merging multiple archives into a single one

The task_package_merge task supports the following arguments:

ArgumentDescriptionRequired
archiveThe name of the final archive.Yes
externalsList of archives of the externals directory to merge.No
librariesList of archives of the lib directory to merge.Yes

Compiling an OMG IDL2 file

The task_idl2java task supports the following arguments:

ArgumentDescriptionRequired
fileThe name of the OMG IDL file to compile.Yes
autopkgflagSpecific flag for using auto-package option during compilation process.No
destdirDirectory where generated files will be stored.No
flagsORB OMG IDL compiler specific flags.No

Generating an XML parser from a DTD file

The task_dtd2java task supports the following arguments:

ArgumentDescriptionRequired
constraints.fileThe name of the DTD file to compile.Yes
root.elementThe root element of the DTD to consider.Yes
xml.dtd.javapackageThe mapping of the root element to the associated package.Yes
xml.dtd.interfacespackageThe package name for the generated interfaces.Yes

Compiling an XML parser

The task_dtd_compile task supports the following arguments:

ArgumentDescriptionRequired
root.elementThe root element of the DTD to consider.Yes
xml_dtd.descriptors_source.dirThe root package to compile.Yes

Using the launcher from Ant

The task_launcher task supports the following arguments:

ArgumentDescriptionRequired
argumentsCommand-line arguments for the launcher and the application.Yes
xmlThe XML file with configuration for the application to launch.Yes

Starting the OpenCCM Interface Repository

The task_IR3_start task supports the following arguments:

ArgumentDescriptionRequired
extra.argumentsAny extra arguments.No

Feeding an OMG IDL 3.0 file into the OpenCCM Interface Repository

The task_IR3_feed task supports the following arguments:

ArgumentDescriptionRequired
idl3The OMG IDL 3.0 file to feed into the Interface Repository.Yes
extra.argumentsAny extra arguments.No

Generating equivalent OMG IDL 2.4 mapping from the OpenCCM Interface Repository

The task_IR3_IDL2 task supports the following arguments:

ArgumentDescriptionRequired
scopeThe OpenCCM Interface Repository object which should be mapped to OMG IDL 2.4.Yes
idl2The name of the OMG IDL 2.4 output file.No
extra.argumentsAny extra arguments, e.g. -i system_file -ipath user_file.No

Generating the Java OpenCCM skeletons from the OpenCCM Interface Repository

The task_IR3_java task supports the following arguments:

ArgumentDescriptionRequired
scopeThe OpenCCM Interface Repository object which should be mapped to Java OpenCCM skeletons.Yes
directoryThe directory where the skeletons should be generated.Yes
extra.argumentsAny extra arguments.No

Generating all the Java implementation templates from the OpenCCM Interface Repository

The task_IR3_jimpl task supports the following arguments:

ArgumentDescriptionRequired
scopeThe OpenCCM Interface Repository object which should be mapped to Java implementation templates.Yes
extra.argumentsAny extra arguments.No

Compiling an OMG CIDL file and generating associated files

The task_CIDL_CIF task supports the following arguments:

ArgumentDescriptionRequired
cidlThe name of the OMG CIDL file to compile.Yes
includeAdd a #include "file" statement where file must be the complete file path.No
directoryGenerate Java implementations into directory.No
cifSet the output file name.No
extra.argumentsAny extra arguments.No

Generates all Java OpenCCM templates associated to a CIDL file for the CIF

The task_CIF_jimpl task supports the following arguments:

ArgumentDescriptionRequired
cidlThe name of the OMG CIDL file to compile.Yes
directoryGenerate Java implementations templates into directory.No
extra.argumentsAny extra arguments.No

Compiles an OMG PSDL file and generates associated Java mapping

The task_PSDL_JAVA task supports the following arguments:

ArgumentDescriptionRequired
psdlThe name of the OMG PSDL file to compile.Yes
directoryGenerate Java implementations mapping into directory.No
extra.argumentsAny extra arguments.No

Feeding an XMI 1.1 UML 1.4 document into the OpenCCM Interface Repository

The task_XMI2IR task supports the following arguments:

ArgumentDescriptionRequired
xmiThe XMI 1.1 UML 1.4 document to feed into the Interface Repository.Yes
extra.argumentsAny extra arguments.No

Stopping the OpenCCM Interface Repository

The task_IR3_stop task supports the following arguments:

ArgumentDescriptionRequired
extra.argumentsAny extra arguments.No

Starting the MOF Repository

The task_mof_start task supports the following arguments:

ArgumentDescriptionRequired
extra.argumentsAny extra arguments.No

Stopping the MOF Repository

The task_mof_stop task supports the following arguments:

ArgumentDescriptionRequired
extra.argumentsAny extra arguments.No

How to integrate a new piece of code?

Integrating source code into an existing package

If you want to compile a piece of source code which is related to an existing package of OpenCCM, you just have to put your class(es) into the appropriate directory.

No modification of the build process is required in order to take into account your contribution.

Integrating source code into a new package

If you want to compile a new package, you have to follow these steps:

  1. Create the directory tree associated to the new package.
  2. Put your contribution in the directory.
  3. Find the module where the package could take place.
  4. Edit the related property file:
    • Edit the name of the package.
    • Edit the name of the archive.
  5. Edit the related XML file:
    • Add new entries in the callbacks (init, compile_api, compile_lib, build).
    • Create the task associated to the new entries.

Defining a new module

You have to extend the build process:

  1. Find a module name
  2. Create the <module_name>.properties file
  3. Create the <module_name>.xml file
  4. Edit the <module_name>.xml file:
    • Create the required callbacks (init, compile_api, compile_lib and build).
    • Load the associated property file.
  5. Edit the build.xml file:
    • Include the new module declaration in the header of the file.
    • Import the content of the XML file.
    • Add the new targets you define through callbacks in the compilation chain.
  6. Follow the steps defined in the previous section to compile your packages.
Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster | Last modified at 2005-07-07 02:04 PM