}
public abstract String getMondrianSchemaFilename() throws AggDesignerException;
public boolean doValidation(final String cubeName) {
final XulDialog dialog = (XulDialog) document.getElementById("validationProgressDialog");
Assert.notNull(dialog, "could not find element with id '" + "validationProgressDialog" + "'");
final List<ValidationMessage> validationMessages = new Vector<ValidationMessage>();
new Thread() {
@Override
public void run() {
try {
while (dialog.isHidden()) {
sleep(500);
}
DatabaseMeta dbMeta = connectionModel.getDatabaseMeta();
final String mondrianConnectionUrl = MessageFormat.format(
"Provider={0};Jdbc={1};JdbcUser={2};JdbcPassword={3};Catalog={4};JdbcDrivers={5}", "Mondrian", dbMeta.getURL(), dbMeta
.getUsername(), dbMeta.getPassword(), "file:" + getMondrianSchemaFilename(),
dbMeta.getDriverClass());
Map<Parameter, Object> parameterValues = new HashMap<Parameter, Object>();
parameterValues.put(mondrianSchemaLoader.getParameters().get(0), mondrianConnectionUrl);
parameterValues.put(mondrianSchemaLoader.getParameters().get(1), cubeName);
StringBuilder validatorClassString = new StringBuilder();
for (String validatorClass : validatorList) {
if (validatorClassString.length() > 0) {
validatorClassString.append(","); //$NON-NLS-1$
}
validatorClassString.append(validatorClass);
}
parameterValues.put(mondrianSchemaLoader.getParameters().get(2), validatorClassString.toString());
List<ValidationMessage> messages = mondrianSchemaLoader.validateSchema(parameterValues);
XulDialog dialog = (XulDialog) document.getElementById("validationProgressDialog");
Assert.notNull(dialog, "could not find element with id '" + "validationProgressDialog" + "'");
validationMessages.addAll(messages);
dialog.hide();
} catch (Exception e) {
if (logger.isErrorEnabled()) {
logger.error("an exception occurred", e);
}
dialog.hide();
}
}
}.start();
dialog.show();
// dialog.hide() in validationDone unblocks the above hide
final XulDialog validationDialog1 = (XulDialog) document.getElementById("validationDialog1");
final XulTextbox textbox = (XulTextbox) document.getElementById("validationMessages");
textbox.setValue(ValidationHelper.messagesToString(validationMessages));
validationDialog1.show();
// reset
boolean hasErrors = ValidationHelper.hasErrors(validationMessages);
return hasErrors;
}