}
});
}
private void addTransactionManagerNodelets() {
parser.addNodelet("/sqlMapConfig/transactionManager/property", new Nodelet() {
public void process(Node node) throws Exception {
Properties attributes = NodeletUtils.parseAttributes(node, state.getGlobalProps());
String name = attributes.getProperty("name");
String value = NodeletUtils.parsePropertyTokens(attributes.getProperty("value"), state.getGlobalProps());
state.getTxProps().setProperty(name, value);
}
});
parser.addNodelet("/sqlMapConfig/transactionManager/end()", new Nodelet() {
public void process(Node node) throws Exception {
Properties attributes = NodeletUtils.parseAttributes(node, state.getGlobalProps());
String type = attributes.getProperty("type");
boolean commitRequired = "true".equals(attributes.getProperty("commitRequired"));
state.getConfig().getErrorContext().setActivity("configuring the transaction manager");
type = state.getConfig().getTypeHandlerFactory().resolveAlias(type);
TransactionManager txManager;
try {
state.getConfig().getErrorContext().setMoreInfo("Check the transaction manager type or class.");
TransactionConfig config = (TransactionConfig) Resources.instantiate(type);
config.setDataSource(state.getDataSource());
state.getConfig().getErrorContext()
.setMoreInfo("Check the transactio nmanager properties or configuration.");
config.setProperties(state.getTxProps());
config.setForceCommit(commitRequired);
config.setDataSource(state.getDataSource());
state.getConfig().getErrorContext().setMoreInfo(null);
txManager = new TransactionManager(config);
} catch (Exception e) {
if (e instanceof SqlMapException) {
throw (SqlMapException) e;
} else {
throw new SqlMapException(
"Error initializing TransactionManager. Could not instantiate TransactionConfig. Cause: "
+ e, e);
}
}
state.getConfig().setTransactionManager(txManager);
}
});
parser.addNodelet("/sqlMapConfig/transactionManager/dataSource/property", new Nodelet() {
public void process(Node node) throws Exception {
Properties attributes = NodeletUtils.parseAttributes(node, state.getGlobalProps());
String name = attributes.getProperty("name");
String value = NodeletUtils.parsePropertyTokens(attributes.getProperty("value"), state.getGlobalProps());
state.getDsProps().setProperty(name, value);
}
});
parser.addNodelet("/sqlMapConfig/transactionManager/dataSource/end()", new Nodelet() {
public void process(Node node) throws Exception {
state.getConfig().getErrorContext().setActivity("configuring the data source");
Properties attributes = NodeletUtils.parseAttributes(node, state.getGlobalProps());