RNI uses data resources stored in the file system in standard locations relative to the Basis root directory ($BT_ROOT
). Accordingly, you must follow a few basic rules when you are assembling an application that includes RNI functionality.
-
Prior to accessing the RNI API, you must set the Basis root directory.
-
RNI maintains singleton Environment objects for maintaining read-only shared data. Depending on the operations you perform, you may need to explicitly instantiate an Environment object before you perform these operations and close the Environment object when you are done.
Setting the Basis Root Directory
The API provides two ways of performing this action:
-
Use com.basistech.util.Pathnames.setBTRootDirectory (String BT_ROOT
).
-
Set the bt.root
system property. You can do this from the command line when you launch the Java virtual machine:
java -Dbt.root=$BT_ROOT
...
where $BT_ROOT
is the path to the Basis root directory.
Manipulating the Environment
Before you use Rosette Name Translator (RNT), you must instantiate a com.basistech.rnt.RNTEnvironment
object. For example:
RNTEnvironment rntEnv = new RNTEnvironment();
The RNTEnvironment
uses data files stored in the file system according to the standard RLP release hierarchy. Accordingly, you must set the Basis root directory prior to instantiating RNTEnvironment
.
If your RLP license is not $BT_ROOT/rlp/rlp/licenses/rlp-license.xml
, RNIConfiguration
and RNTEnvironment
include a setLicenseXML()
method that you can use to provide the license as a String.
When you have finished performing translations, you should close the RNTEnvironment
object to free resources. For example:
rntEnv.close();
When you use Rosette Name Indexer, RNI-RNT instantiates an RNTEnvironment
object as required. If RNI-RNT instantiates an RNTEnvironment
object, it also closes it at the appropriate time.