Browse Source

无jira 数据连接信息配置更新

research/11.0
bryantzzz 1 year ago
parent
commit
b9f474c108
  1. 41
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  2. 7
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  3. 7
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  4. 11
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java
  5. 39
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  6. 11
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java
  7. 8
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionShowPane.java
  8. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  9. 6
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  10. 4
      designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java
  11. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/SettingController.java
  12. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/action/SearchConnectionAction.java
  13. 3
      designer-realize/src/main/java/com/fr/start/module/optimized/ConfigurationActivator4Designer.java

41
designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java

@ -1,25 +1,19 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.data.impl.Connection;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionShowPane;
import com.fr.design.data.datapane.connect.DatabaseConnectionPane; import com.fr.design.data.datapane.connect.DatabaseConnectionPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.editlock.ConnectionLockChangeChecker; import com.fr.design.editlock.ConnectionLockChangeChecker;
import com.fr.design.editlock.EditLockUtils; import com.fr.design.editlock.EditLockUtils;
import com.fr.design.gui.NameInspector;
import com.fr.design.gui.imenu.UILockMenuItem; import com.fr.design.gui.imenu.UILockMenuItem;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.os.support.OSSupportCenter;
import com.fr.design.os.impl.DatabaseDialogAction; import com.fr.design.os.impl.DatabaseDialogAction;
import com.fr.file.ConnectionConfig;
import com.fr.report.LockItem; import com.fr.report.LockItem;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.Map;
/** /**
* DatasourceList Action * DatasourceList Action
@ -69,41 +63,6 @@ public class ConnectionListAction extends UpdateAction {
} }
} }
/**
* 更新datasourceManager
*
* @param datasourceManager datasource管理对象
* @param connectionShowPane datasource面板
* @param databaseListDialog datasource管理对话框
* @return boolean 是否更新成功
*/
public static boolean doWithDatasourceManager(ConnectionConfig datasourceManager, ConnectionShowPane connectionShowPane, BasicDialog databaseListDialog) {
boolean isFailed = false;
//存在请重命名则不能更新
int index = isConnectionMapContainsRename(datasourceManager);
if (index != -1) {
isFailed = true;
connectionShowPane.setSelectedIndex(index);
}
databaseListDialog.setDoOKSucceed(!isFailed);
return !isFailed;
}
/**
* 是否包含重命名key
*
* @return 包含则返回序列 ,若返回-1则说明不包含重命名key
*/
public static int isConnectionMapContainsRename(ConnectionConfig datasourceManager) {
Map<String, Connection> tableDataMap = datasourceManager.getConnections();
if (tableDataMap.containsKey(NameInspector.ILLEGAL_NAME_HOLDER)) {
return datasourceManager.getConnectionIndex(NameInspector.ILLEGAL_NAME_HOLDER);
}
return -1;
}
public void update() { public void update() {
this.setEnabled(true); this.setEnabled(true);

7
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

@ -1,5 +1,6 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.core.DataCoreUtils; import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.DBUtils;
@ -32,7 +33,6 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -324,11 +324,10 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
if (StringUtils.isEmpty(selectedDSName)) { if (StringUtils.isEmpty(selectedDSName)) {
return null; // peter:选中了当前的零长度的节点,直接返回. return null; // peter:选中了当前的零长度的节点,直接返回.
} }
ConnectionConfig connectionConfig = ConnectionConfig.getInstance();
List<String> authConnections = getHasAuthConnections(); List<String> authConnections = getHasAuthConnections();
for (String name : authConnections) { for (String name : authConnections) {
if (ComparatorUtils.equals(selectedDSName, name)) { if (ComparatorUtils.equals(selectedDSName, name)) {
return connectionConfig.getConnection(name); return ConnectionConfigProviderFactory.getConfigProvider().getConnection(name);
} }
} }
return null; return null;
@ -336,7 +335,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private List<String> getHasAuthConnections() { private List<String> getHasAuthConnections() {
List<String> authConnections = new ArrayList<>(); List<String> authConnections = new ArrayList<>();
Set<String> allConnections = ConnectionConfig.getInstance().getConnections().keySet(); Set<String> allConnections = ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet();
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections();
if (noAuthConnections == null) { if (noAuthConnections == null) {
return authConnections; return authConnections;

7
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

@ -1,5 +1,6 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
@ -9,7 +10,6 @@ import com.fr.design.editlock.ConnectionLockChangeChecker;
import com.fr.design.editlock.EditLockUtils; import com.fr.design.editlock.EditLockUtils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UILockButton; import com.fr.design.gui.ibutton.UILockButton;
import com.fr.file.ConnectionConfig;
import com.fr.report.LockItem; import com.fr.report.LockItem;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -79,8 +79,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
* 刷新ComboBox.items * 刷新ComboBox.items
*/ */
protected Iterator<String> items() { protected Iterator<String> items() {
ConnectionConfig mgr = ConnectionConfig.getInstance(); Iterator<String> nameIt = ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet().iterator();
Iterator<String> nameIt = mgr.getConnections().keySet().iterator();
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections();
@ -94,7 +93,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
if (noAuthConnections.contains(conName)) { if (noAuthConnections.contains(conName)) {
continue; continue;
} }
Connection connection = mgr.getConnection(conName); Connection connection = ConnectionConfigProviderFactory.getConfigProvider().getConnection(conName);
// nameList依赖items方法初始化,父类ItemEditableComboBoxPanel里异步执行item方法 // nameList依赖items方法初始化,父类ItemEditableComboBoxPanel里异步执行item方法
filterConnection(connection, conName, nameList); filterConnection(connection, conName, nameList);
} }

11
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java

@ -1,15 +1,16 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.data.impl.Connection;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.editlock.EditLockUtils; import com.fr.design.editlock.EditLockUtils;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.file.ConnectionConfig;
import com.fr.report.LockItem; import com.fr.report.LockItem;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import java.util.Map;
/** /**
* @author hades * @author hades
@ -20,14 +21,14 @@ public class ConnectionListDialogActionAdapter extends DialogActionAdapter {
private final ConnectionManagerPane connectionManagerPane; private final ConnectionManagerPane connectionManagerPane;
private final BasicDialog connectionListDialog; private final BasicDialog connectionListDialog;
private final ConnectionConfig connectionConfig; private final Map<String, Connection> connectionMap;
public ConnectionListDialogActionAdapter(ConnectionManagerPane connectionManagerPane, public ConnectionListDialogActionAdapter(ConnectionManagerPane connectionManagerPane,
BasicDialog connectionListDialog, BasicDialog connectionListDialog,
ConnectionConfig connectionConfig) { Map<String, Connection> connectionMap) {
this.connectionManagerPane = connectionManagerPane; this.connectionManagerPane = connectionManagerPane;
this.connectionListDialog = connectionListDialog; this.connectionListDialog = connectionListDialog;
this.connectionConfig = connectionConfig; this.connectionMap = connectionMap;
} }
@Override @Override
@ -37,7 +38,7 @@ public class ConnectionListDialogActionAdapter extends DialogActionAdapter {
return; return;
} }
try { try {
connectionManagerPane.update(connectionConfig); connectionManagerPane.update(connectionMap);
} catch (Exception e) { } catch (Exception e) {
connectionListDialog.setDoOKSucceed(false); connectionListDialog.setDoOKSucceed(false);
FineJOptionPane.showMessageDialog(connectionManagerPane, e.getMessage(), Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(connectionManagerPane, e.getMessage(), Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE);

39
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -1,5 +1,6 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fr.config.remote.RemoteConfigEvent; import com.fr.config.remote.RemoteConfigEvent;
import com.fr.data.driver.DriverClassNotFoundException; import com.fr.data.driver.DriverClassNotFoundException;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
@ -18,7 +19,6 @@ import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.file.ConnectionConfig;
import com.fr.file.ConnectionOperator; import com.fr.file.ConnectionOperator;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.license.database.DBTypes; import com.fr.license.database.DBTypes;
@ -29,8 +29,6 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.database.DataBaseTypeOperator; import com.fr.workspace.server.database.DataBaseTypeOperator;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -191,15 +189,12 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
return TITLE_NAME; return TITLE_NAME;
} }
/**
* Populate. //todo config invalidate
* public void populate(Map<String, Connection> connectionMap) {
* @param connectionConfig the new datasourceManager.
*/
public void populate(ConnectionConfig connectionConfig) {
List<NameObject> nameObjectList = new ArrayList<NameObject>(); List<NameObject> nameObjectList = new ArrayList<NameObject>();
populatedConnectionsSnapshot.clear(); populatedConnectionsSnapshot.clear();
for (Map.Entry<String, Connection> entry : connectionConfig.getConnections().entrySet()) { for (Map.Entry<String, Connection> entry : ConnectionConfigProviderFactory.getConfigProvider().getConnections().entrySet()) {
nameObjectList.add(new NameObject(entry.getKey(), entry.getValue())); nameObjectList.add(new NameObject(entry.getKey(), entry.getValue()));
try { try {
populatedConnectionsSnapshot.put(entry.getKey(), (Connection) entry.getValue().clone()); populatedConnectionsSnapshot.put(entry.getKey(), (Connection) entry.getValue().clone());
@ -213,7 +208,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
/** /**
* Update. * Update.
*/ */
public void update(ConnectionConfig connectionConfig) throws Exception { public void update(Map<String, Connection> connectionMap) throws Exception {
// Nameable[]居然不能强转成NameObject[],一定要这么写... // Nameable[]居然不能强转成NameObject[],一定要这么写...
Nameable[] res = this.update(); Nameable[] res = this.update();
Map<String, Connection> updatedMap = new LinkedHashMap<>(); Map<String, Connection> updatedMap = new LinkedHashMap<>();
@ -337,7 +332,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
// hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效 // hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
EventDispatcher.fire(RemoteConfigEvent.EDIT, ConnectionConfig.getInstance().getNameSpace()); EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig");
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -345,41 +340,35 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
} }
private boolean saveByOldWay(List<String> removedConnNames, List<ConnectionBean> addedOrUpdatedConnections) { private boolean saveByOldWay(List<String> removedConnNames, List<ConnectionBean> addedOrUpdatedConnections) {
final int remaining = ConnectionConfig.getInstance().getRemainingCon(removedConnNames.size(), addedOrUpdatedConnections.size()); final int remaining = ConnectionConfigProviderFactory.getConfigProvider().getRemainingCon(removedConnNames.size(), addedOrUpdatedConnections.size());
try { try {
return Configurations.modify(new WorkerFacade(ConnectionConfig.class) { removedConnNames.forEach(n -> ConnectionConfigProviderFactory.getConfigProvider().removeConnection(n));
@Override
public void run() {
removedConnNames.forEach(n -> ConnectionConfig.getInstance().removeConnection(n));
int innerRemaining = remaining; int innerRemaining = remaining;
for (ConnectionBean cb : addedOrUpdatedConnections) { for (ConnectionBean cb : addedOrUpdatedConnections) {
if (innerRemaining > 0) { if (innerRemaining > 0) {
ConnectionConfig.getInstance().addConnectionWithoutCheck(cb.getName(), cb.getConnection()); ConnectionConfigProviderFactory.getConfigProvider().addConnectionWithoutCheck(cb.getName(), cb.getConnection());
innerRemaining--; innerRemaining--;
} else { } else {
break; break;
} }
} }
} return true;
});
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return false; return false;
} }
public static void showDialog(Window parent) { public static void showDialog(Window parent) {
final ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); Map<String, Connection> connectionMap = ConnectionConfigProviderFactory.getConfigProvider().getConnections();
final ConnectionManagerPane connectionManagerPane = new ConnectionManagerPane() { final ConnectionManagerPane connectionManagerPane = new ConnectionManagerPane() {
@Override @Override
public void complete() { public void complete() {
ConnectionConfig cloned = connectionConfig.mirror(); populate(connectionMap);
populate(cloned);
} }
}; };
final BasicDialog connectionListDialog = connectionManagerPane.showLargeWindow(parent, null); final BasicDialog connectionListDialog = connectionManagerPane.showLargeWindow(parent, null);
connectionListDialog.addDialogActionListener(new ConnectionListDialogActionAdapter(connectionManagerPane, connectionListDialog, connectionConfig)); connectionListDialog.addDialogActionListener(new ConnectionListDialogActionAdapter(connectionManagerPane, connectionListDialog, connectionMap));
connectionListDialog.setVisible(true); connectionListDialog.setVisible(true);
} }

11
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java

@ -1,12 +1,13 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.data.impl.Connection;
import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.file.ConnectionConfig;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
public class ConnectionManagerPane extends LoadingBasicPane implements ConnectionShowPane { public class ConnectionManagerPane extends LoadingBasicPane implements ConnectionShowPane {
@ -32,14 +33,14 @@ public class ConnectionManagerPane extends LoadingBasicPane implements Connectio
return connectionListPane.getRenameMap(); return connectionListPane.getRenameMap();
} }
public void populate(ConnectionConfig datasourceManager) { public void populate(Map<String, Connection> connectionMap) {
// this.connectionTextField.setText(WorkContext.getCurrent().getPath() + File.separator + ProjectConstants.RESOURCES_NAME // this.connectionTextField.setText(WorkContext.getCurrent().getPath() + File.separator + ProjectConstants.RESOURCES_NAME
// + File.separator + datasourceManager.fileName()); // + File.separator + datasourceManager.fileName());
this.connectionListPane.populate(datasourceManager); this.connectionListPane.populate(connectionMap);
} }
public void update(ConnectionConfig datasourceManager) throws Exception { public void update(Map<String, Connection> connectionMap) throws Exception {
this.connectionListPane.update(datasourceManager); this.connectionListPane.update(connectionMap);
} }
/** /**

8
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionShowPane.java

@ -1,15 +1,17 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.file.ConnectionConfig; import com.fr.data.impl.Connection;
import java.util.Map;
/** /**
* Created by yaoh.wu on 2017/4/22. * Created by yaoh.wu on 2017/4/22.
* 数据链接显示面板 * 数据链接显示面板
*/ */
public interface ConnectionShowPane { public interface ConnectionShowPane {
void update(ConnectionConfig connectionConfig) throws Exception; void update(Map<String, Connection> connectionMap) throws Exception;
void populate(ConnectionConfig connectionConfig); void populate(Map<String, Connection> connectionMap);
void setSelectedIndex(int index); void setSelectedIndex(int index);
} }

4
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java

@ -1,5 +1,6 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.StoreProcedureParameter; import com.fr.base.StoreProcedureParameter;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
@ -31,7 +32,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.ConnectionConfig;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -174,7 +174,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
} }
private boolean isAutoParameterDatabase() { private boolean isAutoParameterDatabase() {
Connection connection = ConnectionConfig.getInstance().getConnection(connectionTableProcedurePane.getSelectedDatabaseConnnectonName()); Connection connection = ConnectionConfigProviderFactory.getConfigProvider().getConnection(connectionTableProcedurePane.getSelectedDatabaseConnnectonName());
return connection == null ? false : ArrayUtils.contains(DRIVERS, connection.getDriver()); return connection == null ? false : ArrayUtils.contains(DRIVERS, connection.getDriver());
} }

6
designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

@ -1,5 +1,6 @@
package com.fr.design.gui.ilist; package com.fr.design.gui.ilist;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.data.core.DataCoreUtils; import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
@ -10,7 +11,6 @@ import com.fr.data.operator.DataOperator;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.dnd.SerializableTransferable; import com.fr.design.mainframe.dnd.SerializableTransferable;
import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -95,7 +95,7 @@ public class TableViewList extends UIList {
@Override @Override
protected DefaultListModel doInBackground() throws Exception { protected DefaultListModel doInBackground() throws Exception {
Connection datasource = ConnectionConfig.getInstance().getConnection(databaseName); Connection datasource = ConnectionConfigProviderFactory.getConfigProvider().getConnection(databaseName);
boolean status = false; boolean status = false;
int count = 3; int count = 3;
//总共给3次连接的机会 //总共给3次连接的机会
@ -154,7 +154,7 @@ public class TableViewList extends UIList {
*/ */
private DefaultListModel processDataInAnotherThread(String databaseName, String searchFilter, String... typesFilter) throws Exception { private DefaultListModel processDataInAnotherThread(String databaseName, String searchFilter, String... typesFilter) throws Exception {
DefaultListModel defaultListModel = new DefaultListModel(); DefaultListModel defaultListModel = new DefaultListModel();
Connection datasource = ConnectionConfig.getInstance().getConnection(databaseName); Connection datasource = ConnectionConfigProviderFactory.getConfigProvider().getConnection(databaseName);
if (datasource == null) { if (datasource == null) {
return defaultListModel; return defaultListModel;
} }

4
designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java

@ -1,13 +1,13 @@
package com.fr.design.mainframe.authority; package com.fr.design.mainframe.authority;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fr.base.CloneCollector; import com.fr.base.CloneCollector;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.file.ConnectionConfig;
import com.fr.file.TableDataConfig; import com.fr.file.TableDataConfig;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -51,7 +51,7 @@ public class JTemplateAuthorityChecker {
allDatasetNames.add(authServerDataSetName); allDatasetNames.add(authServerDataSetName);
} }
allConnectionNames = ConnectionConfig.getInstance().getConnections().keySet(); allConnectionNames = ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet();
UserAuthority templateAuthority = WorkContext.getCurrent().get(UserAuthority.class); UserAuthority templateAuthority = WorkContext.getCurrent().get(UserAuthority.class);
Map<String, Set<String>> authNamesMap = templateAuthority.getAuthServerDataSetAndConnectionNames(); Map<String, Set<String>> authNamesMap = templateAuthority.getAuthServerDataSetAndConnectionNames();

4
designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/SettingController.java

@ -1,6 +1,7 @@
package com.fr.design.actions.replace.action.setting; package com.fr.design.actions.replace.action.setting;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.actions.replace.action.ShowValue; import com.fr.design.actions.replace.action.ShowValue;
import com.fr.design.actions.replace.action.setting.action.SearchCellDSColumnAction; import com.fr.design.actions.replace.action.setting.action.SearchCellDSColumnAction;
@ -15,7 +16,6 @@ import com.fr.design.actions.replace.ui.ITReplaceNorthPanel;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.file.ConnectionConfig;
import com.fr.general.data.TableDataColumn; import com.fr.general.data.TableDataColumn;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.DSColumn;
@ -266,7 +266,7 @@ public enum SettingController implements ShowValue {
@Override @Override
public List<String> getItems() { public List<String> getItems() {
List<String> nameList = new ArrayList<>(); List<String> nameList = new ArrayList<>();
for (String name : ConnectionConfig.getInstance().getConnections().keySet()) { for (String name : ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet()) {
nameList.add(name); nameList.add(name);
} }
return nameList; return nameList;

4
designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/action/SearchConnectionAction.java

@ -1,5 +1,6 @@
package com.fr.design.actions.replace.action.setting.action; package com.fr.design.actions.replace.action.setting.action;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.base.TableDataConnection; import com.fr.base.TableDataConnection;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
@ -9,7 +10,6 @@ import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.info.DataSourceInfo; import com.fr.design.actions.replace.info.DataSourceInfo;
import com.fr.design.actions.replace.info.base.ITContent; import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.file.ConnectionConfig;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -35,7 +35,7 @@ public class SearchConnectionAction implements SearchAction {
@Override @Override
public void search4Infos(JTemplate jTemplate) { public void search4Infos(JTemplate jTemplate) {
List<DataSourceInfo> connectionInfos = new ArrayList<>(); List<DataSourceInfo> connectionInfos = new ArrayList<>();
Map<String, Connection> map = ConnectionConfig.getInstance().getConnections(); Map<String, Connection> map = ConnectionConfigProviderFactory.getConfigProvider().getConnections();
Map<String, Connection> needMap = new HashMap<>(); Map<String, Connection> needMap = new HashMap<>();
TableDataSource source = (TableDataSource) jTemplate.getTarget(); TableDataSource source = (TableDataSource) jTemplate.getTarget();
Iterator dataIterator = source.getTableDataNameIterator(); Iterator dataIterator = source.getTableDataNameIterator();

3
designer-realize/src/main/java/com/fr/start/module/optimized/ConfigurationActivator4Designer.java

@ -6,6 +6,8 @@ import com.fr.config.dao.DaoSelectorFactory;
import com.fr.config.dao.impl.remote.PropertiesClassHelperDao; import com.fr.config.dao.impl.remote.PropertiesClassHelperDao;
import com.fr.config.dao.impl.remote.PropertiesEntityDao; import com.fr.config.dao.impl.remote.PropertiesEntityDao;
import com.fr.config.dao.impl.remote.PropertiesXmlEntityDao; import com.fr.config.dao.impl.remote.PropertiesXmlEntityDao;
import com.fr.transaction.PropertiesTransactor;
import com.fr.transaction.TransactorFactory;
/** /**
* @author hades * @author hades
@ -17,6 +19,7 @@ public class ConfigurationActivator4Designer extends ConfigurationActivator {
@Override @Override
protected void initLocalDao() { protected void initLocalDao() {
if (DaoSelectorFactory.getDaoSelector().useCacheDao()) { if (DaoSelectorFactory.getDaoSelector().useCacheDao()) {
TransactorFactory.setTransactor(new PropertiesTransactor());
DaoContext.setClassHelperDao(new PropertiesClassHelperDao()); DaoContext.setClassHelperDao(new PropertiesClassHelperDao());
DaoContext.setEntityDao(new PropertiesEntityDao()); DaoContext.setEntityDao(new PropertiesEntityDao());
DaoContext.setXmlEntityDao(new PropertiesXmlEntityDao()); DaoContext.setXmlEntityDao(new PropertiesXmlEntityDao());

Loading…
Cancel
Save