final JdbcConnectionDefinition definition = (JdbcConnectionDefinition) model.getElementAt(i);
if (definition instanceof DriverConnectionDefinition == false)
{
continue;
}
final DriverConnectionDefinition dcd = (DriverConnectionDefinition) definition;
if (ObjectUtilities.equal(dcd.getUsername(), dcp.getProperty("JdbcUser")) &&
ObjectUtilities.equal(dcd.getPassword(), dcp.getProperty("JdbcPassword")) &&
ObjectUtilities.equal(dcd.getConnectionString(), dcp.getProperty("Jdbc")) &&
ObjectUtilities.equal(dcd.getDriverClass(), dcp.getProperty("JdbcDrivers")) &&
ObjectUtilities.equal(dcd.getName(), dcp.getProperty("::pentaho-reporting::name")))
{
return definition;
}
}
String customName = dcp.getProperty("::pentaho-reporting::name");
if (customName == null)
{
customName = Messages.getString("Olap4JDataSourceEditor.CustomConnection");
}
final String[] strings = dcp.getPropertyNames();
final Properties p = new Properties();
for (int i = 0; i < strings.length; i++)
{
final String string = strings[i];
p.put(string, dcp.getProperty(string));
}
return new DriverConnectionDefinition
(customName, dcp.getDriver(), dcp.getUrl(),
dcp.getProperty("user"), dcp.getProperty("password"),
dcp.getProperty("::pentaho-reporting::hostname"),
dcp.getProperty("::pentaho-reporting::database-name"),
dcp.getProperty("::pentaho-reporting::database-type"),
dcp.getProperty("::pentaho-reporting::port"),
p);
}
if (currentJNDISource instanceof JndiConnectionProvider)
{
final JndiConnectionProvider jcp = (JndiConnectionProvider) currentJNDISource;
final ListModel model = dialogModel.getConnections();
for (int i = 0; i < model.getSize(); i++)
{
final JdbcConnectionDefinition definition = (JdbcConnectionDefinition) model.getElementAt(i);
if (definition instanceof JndiConnectionDefinition == false)
{
continue;
}
final JndiConnectionDefinition dcd = (JndiConnectionDefinition) definition;
if (ObjectUtilities.equal(dcd.getJndiName(), jcp.getConnectionPath()))
{
return dcd;
}
}
return new JndiConnectionDefinition(Messages.getString("Olap4JDataSourceEditor.CustomConnection"),