Omar Properties Guide - Table of Contents

This document describes how properties work for the project.

Why 3 property files?

Because we have 3 main branches in the project source code: common, server and client.

Since some classes in common also need properties AND they dont know if they are being used by server-side or by client-side, specific properties needed to be defined.

Common, server and client properties

So, each of the 3 branches uses a different set of properties through a xxxProperty class:

  • org.freebxml.omar.common.CommonProperties for common
  • org.freebxml.omar.server.common.RegistryProperties for server
  • org.freebxml.omar.client.xml.registry.util.ProviderProperties for client

These classes implement singleton pattern and properties are loaded on first access. Furthermore, they extend org.freebxml.omar.common.AbstractProperties, which holds common methods for property loading purposes.

NOTE: Both server and client property classes currently INCLUDE properties defined for common. See property loading sequence.

RegistryBrowser properties

RegistryBrowser (thick client) is also configurable, but that is not covered here. See //TODO: link.

Property loading sequence

Currently each of the property classes follows this sequence:

  1. Load properties from classpath using fully qualified name for resource.
    • org/freebxml/omar/common/omar-common.properties for common
    • org/freebxml/omar/server/omar.properties for server
    • org/freebxml/omar/client/jaxr-ebxml.properties for client
    These are the default properties and should jarified with the classes. These properties should by up-to-date with cvs/distribution and should not be changed by the user.
  2. Load from classpath root:
    • omar-common.properties for common
    • omar.properties for server
    • jaxr-ebxml.properties for client
    NOTE: This is a good place to change the properties (or at least define omar.home, see next steps) if youre planning to have multiple registry installations in the same machine, under the same user.
  3. Load only omar.home property from System.properties, if defined, so that it can be used by next step. This is an alternative to modifying property files to define omar.home.
  4. Conditional load from file system, only executed when load from classpath root fails. Uses last defined property omar.home from the steps above for file system directory path.
    • ${omar.home}/omar-common.properties for common
    • ${omar.home}/omar.properties for server
    • ${omar.home}/jaxr-ebxml.properties for client
  5. Load from System.properties. Append from system level properties (defined, for instance, using ?DpropName=propValue command-line switch) where property name starts with
    • omar. for common
    • omar. for server
    • omar. or jaxr-ebxml for client

IMPORTANT NOTE: Both server and client property classes fully execute loading sequence for common and use those properties as starting point.

See also: Variable support in property files.

Source for default values

Default properties are loaded from classpath using fully qualified name for resource.

  • org/freebxml/omar/common/omar-common.properties for common
  • org/freebxml/omar/server/omar.properties for server
  • org/freebxml/omar/client/jaxr-ebxml.properties for client

Variable support in property files

After the loading steps, variable substitution is performed. Allowed variables:

  • ${user.home}
  • ${omar.home}
  • ${jaxr-ebxml.home}

Where to change a property value (user)

Prefer changing properties in the classpath root or in omar.home directory.

Property File Locations

Location in CVS Tree

Property files are located under omar/conf directory in CVS.

Location in Distribution / Build Tree

The ant script will copy property files to 3 locations under Build Tree:

  • to omar/build/conf, preserving last modified.
  • to omar/build/lib/classes/xxx, overwriting with version from CVS Tree. See defaults.
  • to omar/build/lib/classes, using same version as for omar/build/conf

Omar Home - Runtime root directory

There is one directory that centralizes all the omar-related data and configuration files. It defaults to /omar but can be easily changed throug classpath omar-common.properties or through System properties to enable multiple deployment/development environment in the same machine, for the same user.

Changing the loading order (dev)

WARNING: This is strongly discouraged and it is here for documentation purpose only!

Property loading sequence can be changed by modifying the constructor and the loadProperties() method in each of the classes.

Debugging the properties

The property classes should use a log defined for org.freebxml.omar.Properties.

If you want to debug the property classes of the project, change the log configuration. Changing the log level to debug will output complete information about loading sequence, while changing it to debug will also output all the loaded properties.

When using log4j, make sure that log4j.properties is in classpath and it contains lines like this:

#Log for OMAR properties

logger.org.freebxml.omar.Properties = debug, Console

This assumes you have configured and appender named Console. if not, add this lines to your log4j.properties:

# An appender named 'Console' that outputs to stdout.

log4j.appender.Console=org.apache.log4j.ConsoleAppender

log4j.appender.Console.layout=org.apache.log4j.PatternLayout

log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %p %c[%t] - %m%n

Links