SourceForge.net Logo > AJCT Project > Home > Usage > Configuration targets
   Introduction
   System Properties
   (File) Properties




AJCT – AnotherJava Configuration Tool – Configuration Targets

Introduction

Idealy, all components of your java application use AJCT. If you are reusing third party components, this will not be the case. AJCT provides a mechanism to indirectly achieve this: configuration targets (or 'writers'). A configuration target exports (part of) the configuration in another format.

Currently, the following targets are supported without custom extensions:

Only XML sources support configuration targets (via the 'export' element).







System properties configuration target (type=system)

The System properties configuration target exports a section of the configuration to the system properties.


Parameter

Description

section

The AJCT section to export to the system properties.

If the XML configuration source would contain the following lines:

    <section name="exportToSystem">
        <entry key="org.otherapp.debug" value="true"/>
        <entry key="org.otherapp.user" value="myusername"/>
        <entry key="org.otherapp.passwd" value="[previousSection]{aKey}"/>
    </section>
    <!-- Export the above section to the system properties -->
    <export type="system" section="exportToSystem"/>

then the following call System.getProperty("org.otherapp.debug") will return 'true'.







Java properties file configuration target (type=properties)

The java properties file configuration target exports a section of the configuration as a java properties file on the local file system.


Parameter

Description

section

The AJCT section to export to the properties file.

filename

The name of the file to be written.

If the XML configuration source would contain a the following lines:

    <section name="otherappConfiguration">
        <entry key="org.otherapp.debug" value="true"/>
        <entry key="org.otherapp.user" value="myusername"/>
        <entry key="org.otherapp.passwd" value="[previousSection]{aKey}"/>
    </section>
    <!-- Export the above section to the system properties -->
    <export type="system" section="otherappConfiguration" filename="[location]{otherApp}/export.properties"/>

then the file 'export.properties' might contain the following lines:

org.otherapp.debug=true
org.otherapp.user=myusername
org.otherapp.passwd=somePasswd



This file was last modified