|
|
@ -1,10 +1,9 @@ |
|
|
|
package com.fr.design.data.datapane.connect; |
|
|
|
package com.fr.design.data.datapane.connect; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.TemplateUtils; |
|
|
|
|
|
|
|
import com.fr.data.core.db.JDBCSecurityChecker; |
|
|
|
|
|
|
|
import com.fr.data.impl.Connection; |
|
|
|
import com.fr.data.impl.Connection; |
|
|
|
import com.fr.data.impl.JDBCDatabaseConnection; |
|
|
|
import com.fr.data.impl.JDBCDatabaseConnection; |
|
|
|
import com.fr.data.impl.JNDIDatabaseConnection; |
|
|
|
import com.fr.data.impl.JNDIDatabaseConnection; |
|
|
|
|
|
|
|
import com.fr.data.operator.DataOperator; |
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
import com.fr.design.data.MapCompareUtils; |
|
|
|
import com.fr.design.data.MapCompareUtils; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
@ -181,7 +180,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.checkSecurity(addedOrUpdatedConnections); |
|
|
|
this.validateConnections(addedOrUpdatedConnections); |
|
|
|
alterConnections(removedConnNames, addedOrUpdatedConnections); |
|
|
|
alterConnections(removedConnNames, addedOrUpdatedConnections); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -190,20 +189,17 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh |
|
|
|
addedOrUpdatedConnections.forEach((name, conn) -> ConnectionConfig.getInstance().addConnection(name, conn)); |
|
|
|
addedOrUpdatedConnections.forEach((name, conn) -> ConnectionConfig.getInstance().addConnection(name, conn)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void checkSecurity(Map<String, Connection> addedOrUpdatedConnections) throws Exception { |
|
|
|
private void validateConnections(Map<String, Connection> addedOrUpdatedConnections) throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, Connection> entry : addedOrUpdatedConnections.entrySet()) { |
|
|
|
for (Map.Entry<String, Connection> entry : addedOrUpdatedConnections.entrySet()) { |
|
|
|
Connection connection = entry.getValue(); |
|
|
|
Connection connection = entry.getValue(); |
|
|
|
if (connection instanceof JDBCDatabaseConnection) { |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
JDBCSecurityChecker.checkURL(TemplateUtils.render(((JDBCDatabaseConnection) connection).getURL())); |
|
|
|
DataOperator.getInstance().validateConnectionSettings(connection); |
|
|
|
JDBCSecurityChecker.checkValidationQuery(((JDBCDatabaseConnection) connection).getDbcpAttr().getValidationQuery()); |
|
|
|
|
|
|
|
} catch (SQLException e) { |
|
|
|
} catch (SQLException e) { |
|
|
|
throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", entry.getKey()) + ", " + e.getMessage(), e.getCause()); |
|
|
|
throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", entry.getKey()) + ", " + e.getMessage(), e.getCause()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCopyItem() { |
|
|
|
public void onCopyItem() { |
|
|
|