logger.info("Warning: <node> '"
+ nodeName
+ "' has no 'schema-update-strategy'.");
}
DataNode node = createDataNode(nodeName);
node.setDataSourceFactory(factory);
node.setDataSourceLocation(dataSource);
node.setSchemaUpdateStrategyName(schemaUpdateStrategy);
SchemaUpdateStrategy confSchema = config.getSchemaUpdateStrategy();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
SchemaUpdateStrategy localSchema;
try {
localSchema = (confSchema != null)
? confSchema
: (SchemaUpdateStrategy) Class.forName(
schemaUpdateStrategy,
true,
classLoader).newInstance();
node.setSchemaUpdateStrategy(localSchema);
}
catch (InstantiationException e) {
logger.info("Error: ", e);
}
catch (IllegalAccessException e) {
logger.info("Error: ", e);
}
catch (ClassNotFoundException e) {
logger.info("Error: ", e);
}
// load DataSource
try {
// use DomainHelper factory if it exists, if not - use factory specified
// in configuration data
DataSourceFactory confFactory = config.getDataSourceFactory(factory);
DataSourceFactory localFactory = (confFactory != null)
? confFactory
: (DataSourceFactory) Class.forName(factory).newInstance();
logger.info("using factory: " + localFactory.getClass().getName());
localFactory.initializeWithParentConfiguration(config);
DataSource ds = localFactory.getDataSource(dataSource);
if (ds != null) {
logger.info("loaded datasource.");
node.setDataSource(ds);
}
else {
logger.info("Warning: null datasource.");
getStatus().getFailedDataSources().put(nodeName, dataSource);
}