All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.wcfart.tbutils.res.package.html Maven / Gradle / Ivy




Access to key/value pairs and application home directory.

{@link net.sf.wcfart.tbutils.res.Resources} is the facade to access Resources. {@link net.sf.wcfart.tbutils.res.ResourcesFactory} contains a description how to configure the Resources.

{@link net.sf.wcfart.tbutils.res.ResourcesFactory} looks for a resource bundle named resfactory in the classpath (root package). The resfactory may contain the following entries:

Initialization

tbeller.home Path of a directory in the filesystem where the application may want to store data or read property files. The default is ~/.tonbeller

Example: tbeller.home=c:\temp

Example: tbeller.home=${java.io.tmpdir}

tbeller.usejndi defaults to true. If set to false, properties will not looked up via JNDI. Example: tbeller.usejndi=false
tbeller.bundles Names of ResourceBundle's that will be looked up in the class path

Example: tbeller.bundles=net.sf.wcfart.jpivot.jpivot com.acme.messages

tbeller.resources Paths of property files, that will be looked up in the file system. If the path is relative, its releative to tbeller.home (see above), otherwise its taken absolute.

Example tbeller.resources=local.properties is identical to tbeller.resources=${tbeller.home}/local.properties

Example tbeller.resources=local.properties /etc/conf/conf.properties

These four variables are looked up

  1. in JNDI java:/comp/env context (depends on tbeller.usejndi)
  2. user.properties in root classpath
  3. resfactory.properties in root classpath
  4. System.getProperty()
in that order.

Runtime

After initialization using the four variables above, Properties are searched in the following order
  1. System Properties
  2. The tbeller.properties property files in the given order
  3. The tbeller.bundles Resource Bundles in the given order
The first match "wins".

Property references

Properties may be referenced from other properties. Example:
root.dir=/usr/local/myapp
dir1=${root.dir}/dir1
dir2=${java.io.tmpdir}/dir2
may expand to
root.dir=/usr/local/myapp
dir1=/usr/local/myapp/dir1
dir2=/tmp/dir2




© 2015 - 2025 Weber Informatics LLC | Privacy Policy