*/
private boolean configureMapper(Map props) throws Throwable {
boolean useConnectionFactory;
String mapperName = getProperty(props, MAPPER_NAME, "rdb.automatic", true);
Component component = getSubComponent(speedo, PRIMITIVE_MAPPER_PATH);
String strval = null;
//Choose the mapper in according to the connection factory (JCA or JDBC)
String cfName = getProperty(props, JDO_OPTION_CONNECTION_FACTORY_NAME, null, true);
useConnectionFactory = cfName != null && cfName.length() > 0;
Object o = Fractal.getAttributeController(component);
MapperAttributes ma = (MapperAttributes) o;
if (useConnectionFactory) {
Object cf = null;
//There is a connection factory
try {
InitialContext ic = new InitialContext();
cf = ic.lookup(cfName);
} catch (NamingException e) {
throw new SpeedoException(
"Problem to get the connection factory in JNDI ("
+ cfName + ")", e);
}
if (cf == null) {
throw new SpeedoException(
"No connection factory registered in JNDI with the name "
+ cfName);
} else if (cf instanceof ConnectionSpecJDBC) {
// Use the JDBC Mapper ==> nothing to do
} else if (cf instanceof javax.sql.DataSource) {
// Use the JDBC Mapper ==> nothing to do
} else if (cf instanceof javax.resource.cci.ConnectionFactory) {
throw new SpeedoException("JCA datasource no yet supported");
} else {
throw new SpeedoException("The connection factory registered "
+ "in JNDI is not supported by Speedo " + cfName + " => "
+ cf);
}
boolean ignoring = removeProps(props, new String[]{
JDO_OPTION_CONNECTION_DRIVER_NAME_OLD,
JDO_OPTION_CONNECTION_DRIVER_NAME_OLD2,
JDO_OPTION_CONNECTION_DRIVER_NAME,
JDO_OPTION_CONNECTION_URL,
JDO_OPTION_CONNECTION_USER_NAME,
JDO_OPTION_CONNECTION_PASSWORD});
if (ignoring) {
logger.log(BasicLevel.WARN,
LocaleHelper.getSpeedoRB().getString("ignjdbcinfo"));
}
ignoring = removeProps(props, new String[]{
CONNECTION_POOL_MIN,
CONNECTION_POOL_MAX,
CONNECTION_POOL_TTL,
CONNECTION_POOL_TIMEOUT});
if (ignoring) {
logger.log(BasicLevel.WARN,
LocaleHelper.getSpeedoRB().getString("ignconninfo"));
}
//Assign the connection factory to the mapper
logger.log(BasicLevel.INFO, LocaleHelper.getSpeedoRB().getString("connfact")
+ LocaleHelper.getSpeedoRB().getString("jndinm") + cfName
+ LocaleHelper.getSpeedoRB().getString("factfound") + cf
+ LocaleHelper.getSpeedoRB().getString("mappernm") + mapperName);
PMapper mapper = (PMapper) component.getFcInterface("mapper");
mapper.setMapperName(mapperName);
mapper.setConnectionFactory(cf);
} else {
JDBCMapperAttributes jdbcma = (JDBCMapperAttributes) ma;