setTitle(Messages.getString("LegacyMdxDataSourceEditor.Title"));
}
protected AbstractNamedMDXDataFactory createDataFactory()
{
final LegacyBandedMDXDataFactory returnDataFactory;
final JdbcConnectionDefinition connectionDefinition =
(JdbcConnectionDefinition) getDialogModel().getConnections().getSelectedItem();
if (connectionDefinition instanceof JndiConnectionDefinition)
{
final JndiConnectionDefinition jcd = (JndiConnectionDefinition) connectionDefinition;
final JndiConnectionProvider provider = new JndiConnectionProvider();
provider.setConnectionPath(jcd.getJndiName());
provider.setUsername(jcd.getUsername());
provider.setPassword(jcd.getPassword());
returnDataFactory = new LegacyBandedMDXDataFactory(provider);
}
else if (connectionDefinition instanceof DriverConnectionDefinition)
{
final DriverConnectionDefinition dcd = (DriverConnectionDefinition) connectionDefinition;
final DriverConnectionProvider provider = new DriverConnectionProvider();
provider.setDriver(dcd.getDriverClass());
provider.setUrl(dcd.getConnectionString());
final Properties properties = dcd.getProperties();
final Enumeration keys = properties.keys();
while (keys.hasMoreElements())
{
final String key = (String) keys.nextElement();
provider.setProperty(key, properties.getProperty(key));
}
returnDataFactory = new LegacyBandedMDXDataFactory(provider);
}
else
{
return null;
}
final KeyedComboBoxModel queries = getDialogModel().getQueries();
for (int i = 0; i < queries.getSize(); i++)
{
returnDataFactory.setQuery((String) queries.getElementAt(i), (String) queries.getKeyAt(i));
}
return returnDataFactory;
}