InputStream source = DataSetFactory.class.getResourceAsStream("/datasetTypes.properties");
Properties p = new Properties();
try {
p.load(source);
} catch (IOException e) {
throw new SpagoBIRuntimeException("Cannot load configuration from datasetTypes.properties file", e);
}
String dsType = dataSetConfig.getType();
logger.debug("Dataset type: " + dsType);
String className = p.getProperty(dsType);
logger.debug("Dataset class: " + className);
if (className == null) {
throw new SpagoBIRuntimeException("No dataset class found for dataset type [" + dsType + "]");
}
Constructor c = null;
Object object = null;;
try {
c = Class.forName(className).getConstructor(SpagoBiDataSet.class);
object = c.newInstance(dataSetConfig);
dataSet = (IDataSet) object;
} catch (Exception e) {
throw new SpagoBIRuntimeException("Error while instantiating dataset type [" + dsType
+ "], class [" + className + "]", e);
}
// if ( ScriptDataSet.DS_TYPE.equals( dataSetConfig.getType() ) ) {