return txMgr;
}
private DaoImpl parseDao(Element element, StandardDaoManager daoManager, DaoContext daoContext) {
DaoImpl daoImpl = new DaoImpl();
if (element.getNodeType() == Node.ELEMENT_NODE) {
if (DAO_ELEMENT.equals(element.getNodeName())) {
Properties attributes = parseAttributes(element);
try {
String iface = attributes.getProperty("interface");
String impl = attributes.getProperty("implementation");
daoImpl.setDaoManager(daoManager);
daoImpl.setDaoContext(daoContext);
daoImpl.setDaoInterface(Resources.classForName(iface));
daoImpl.setDaoImplementation(Resources.classForName(impl));
Class daoClass = daoImpl.getDaoImplementation();
Dao dao = null;
try {
Constructor constructor = daoClass.getConstructor(new Class[]{DaoManager.class});
dao = (Dao) constructor.newInstance(new Object[]{daoManager});
} catch (Exception e) {
dao = (Dao) daoClass.newInstance();
}
daoImpl.setDaoInstance(dao);
daoImpl.initProxy();
} catch (Exception e) {
throw new DaoException("Error configuring DAO. Cause: " + e, e);
}
}
}