dataMartModelAccessModality = new AbstractModelAccessModality();
// validate & set configuration
if(configuration instanceof FileDataSourceConfiguration) {
FileDataSourceConfiguration subConf = (FileDataSourceConfiguration)configuration;
CompositeDataSourceConfiguration c = new CompositeDataSourceConfiguration(subConf.getModelName());
c.addSubConfiguration(subConf);
Iterator<String> it = subConf.loadDataSourceProperties().keySet().iterator();
while(it.hasNext()) {
String propertyName = it.next();
c.loadDataSourceProperties().put(propertyName, subConf.loadDataSourceProperties().get(propertyName));
}
this.configuration = c;
} else if(configuration instanceof CompositeDataSourceConfiguration) {
CompositeDataSourceConfiguration c = (CompositeDataSourceConfiguration)configuration;
if(c.getSubConfigurations() == null || c.getSubConfigurations().size() < 1) {
throw new SpagoBIRuntimeException("Impossible to create HibernateDataSource. Datasource sub-configurations not defined");
}
for(int i = 0; i < c.getSubConfigurations().size(); i++) {
if( !(c.getSubConfigurations().get(i) instanceof FileDataSourceConfiguration) ) {
throw new SpagoBIRuntimeException("Impossible to create HibernateDataSource. Unable to manage sub-configuration of type [" + c.getSubConfigurations().get(i).getClass().getName() + "]");
}
}
this.configuration = configuration;
} else {
throw new SpagoBIRuntimeException("Impossible to create HibernateDataSource. Unable to manage configuration of type [" + configuration.getClass().getName() + "]");