{
if (xQueryDataFile == null)
{
throw new ParseException("Required property 'xQueryDataFile' is missing");
}
final XPathDataFactory dataFactory = new XPathDataFactory();
dataFactory.setXqueryDataFile(xQueryDataFile);
for (int i = 0; i < queries.size(); i++)
{
final QueryReadHandler handler = (QueryReadHandler) queries.get(i);
dataFactory.setQuery(handler.getQueryName(), handler.getQuery());
}
final String queryNameProperty = result.getProperty("queryString");
if (queryNameProperty != null)
{
dataFactory.setQuery("default", queryNameProperty);
}
this.dataFactory = dataFactory;
}
else if ("JNDI".equals(connectionType))
{
if (selectedJNDIDataSourceReadHandler == null)
{
throw new ParseException("Required element 'selectedJNDIDataSourceReadHandler' is missing");
}
if (useMondrianCubeDefinition)
{
if (mondrianCubeDefinition == null)
{
throw new ParseException("Required property 'mondrianCubeDefinitionFile' is missing");
}
final LegacyBandedMDXDataFactory dataFactory = new LegacyBandedMDXDataFactory();
dataFactory.setCubeFileProvider(new DefaultCubeFileProvider(mondrianCubeDefinition));
dataFactory.setJdbcUser(selectedJNDIDataSourceReadHandler.getUsername());
dataFactory.setJdbcPassword(selectedJNDIDataSourceReadHandler.getPassword());
dataFactory.setDesignTimeName(selectedJNDIDataSourceReadHandler.getJndiName());
final DriverDataSourceProvider driverDataSourceProvider = new DriverDataSourceProvider();
driverDataSourceProvider.setDriver(selectedJNDIDataSourceReadHandler.getDriverClass());
driverDataSourceProvider.setUrl(selectedJNDIDataSourceReadHandler.getConnectionString());
dataFactory.setDataSourceProvider(driverDataSourceProvider);
for (int i = 0; i < queries.size(); i++)
{
final QueryReadHandler handler = (QueryReadHandler) queries.get(i);
dataFactory.setQuery(handler.getQueryName(), handler.getQuery());
}
final String queryNameProperty = result.getProperty("queryString");
if (queryNameProperty != null)
{
dataFactory.setQuery("default", queryNameProperty);
}
this.dataFactory = dataFactory;
}
else
{
final DriverConnectionProvider drc = new DriverConnectionProvider();
drc.setUrl(selectedJNDIDataSourceReadHandler.getConnectionString());
drc.setDriver(selectedJNDIDataSourceReadHandler.getDriverClass());
drc.setProperty("user", selectedJNDIDataSourceReadHandler.getUsername());
drc.setProperty("password", selectedJNDIDataSourceReadHandler.getPassword());
drc.setProperty("::pentaho-reporting::name", selectedJNDIDataSourceReadHandler.getJndiName());
final SQLReportDataFactory dataFactory = new SQLReportDataFactory(drc);
for (int i = 0; i < queries.size(); i++)
{
final QueryReadHandler handler = (QueryReadHandler) queries.get(i);
dataFactory.setQuery(handler.getQueryName(), handler.getQuery());
}
final String queryNameProperty = result.getProperty("queryString");
if (queryNameProperty != null)
{
dataFactory.setQuery("default", queryNameProperty);
}
this.dataFactory = dataFactory;
}
}
else