I always forget how to do this so I’m writing it down.
First, Narayana fundamentally accesses its properties from instances of environment beans, which are simple Java objects. Here are all of the non-testing ones (the last five are the most relevant for most JTA situations):
narayana/XTS/WS-C/dev/src/org/jboss/jbossts/xts/environment/RecoveryEnvironmentBean.java narayana/XTS/WS-C/dev/src/org/jboss/jbossts/xts/environment/XTSEnvironmentBean.java narayana/XTS/WS-C/dev/src/org/jboss/jbossts/xts/environment/WSCEnvironmentBean.java narayana/XTS/WS-C/dev/src/org/jboss/jbossts/xts/environment/WSCFEnvironmentBean.java narayana/XTS/WS-C/dev/src/org/jboss/jbossts/xts/environment/WSTEnvironmentBean.java narayana/ArjunaJTS/jts/classes/com/arjuna/ats/jts/common/JTSEnvironmentBean.java narayana/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBean.java narayana/ArjunaJTA/jta/classes/com/arjuna/ats/jta/common/JTAEnvironmentBean.java narayana/ArjunaJTA/jdbc/classes/com/arjuna/ats/jdbc/common/JDBCEnvironmentBean.java narayana/ArjunaCore/txoj/classes/com/arjuna/ats/txoj/common/TxojEnvironmentBean.java narayana/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/hornetq/HornetqJournalEnvironmentBean.java narayana/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/RecoveryEnvironmentBean.java narayana/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/ObjectStoreEnvironmentBean.java narayana/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java narayana/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/MetaObjectStoreEnvironmentBean.java narayana/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoordinatorEnvironmentBean.java
To instantiate them, it grabs a source of property information, one of the environment bean classes, and something called a
BeanPopulator is sort of like a crippled version of
java.beans.Introspector. It instantiates a given environment bean class, and then calls relevant setter methods on the resulting instance with values sourced from whatever the source of property information is.
The source of property information has several restrictions.
First, it has to be in
java.util.Properties XML format. Elements are named
entry and have
key attributes; their content is that key’s value.
Second, if you do nothing else it will be named
jbossts-properties.xml. Weirdly, this most-default-of-all-possible-defaults is set during the build.
Third, if you want to rename it then you have to set a system property named
Fourth, there is a lookup algorithm. First it treats this thing as an absolute path. If it doesn’t exist, it treats it as a path relative to the current directory. If it doesn’t exist, it treats it as a path relative to
user.home (!) and
java.home (!). If it doesn’t exist in any of those places, then it treats it as a classpath resource before giving up.
Fifth, there is no merging.
As you can see if you’re going to bother specifying this thing you should probably specify it as an absolute file path. Hey, Narayana is old.
When you’re all done with this (or maybe you punt and decide to just let the defaults ride), you can selectively override certain properties by specifying them as System properties.
The environment beans each have a prefix defined via annotations and not in any other documentation that I can find so to understand how to configure them you have to look at the Narayana source code (!). For example,
@PropertyPrefix annotation sets its prefix to
com.arjuna.ats.jta. So an
entry with a
key attribute of
com.arjuna.ats.jta.transactionManagerClassName will be used as the value of an invocation of the
Lastly, almost all you ever really want to do is set the default timeout for the transaction manager. To do this, set a system property named
com.arjuna.ats.arjuna.coordinator.defaultTimeout to a numeric value denoting the timeout value in seconds.