├── clusterAdminLibrary ├── .gitignore ├── install.bat ├── src │ ├── main │ │ ├── resources │ │ │ ├── icons │ │ │ │ ├── wp.png │ │ │ │ ├── wps.png │ │ │ │ ├── Rouble.png │ │ │ │ ├── add_16.png │ │ │ │ ├── add_24.png │ │ │ │ ├── sort.png │ │ │ │ ├── user.png │ │ │ │ ├── watch.png │ │ │ │ ├── edit_16.png │ │ │ │ ├── edit_24.png │ │ │ │ ├── infobase.png │ │ │ │ ├── lock_16.png │ │ │ │ ├── lock_24.png │ │ │ │ ├── move_up.png │ │ │ │ ├── service.png │ │ │ │ ├── view_16.png │ │ │ │ ├── cluster_24.png │ │ │ │ ├── connection.png │ │ │ │ ├── delete_16.png │ │ │ │ ├── delete_24.png │ │ │ │ ├── favorites.png │ │ │ │ ├── hiddenPass.png │ │ │ │ ├── move_down.png │ │ │ │ ├── sleepUser.png │ │ │ │ ├── taskError.png │ │ │ │ ├── taskRunning.png │ │ │ │ ├── tumblerOff.png │ │ │ │ ├── tumblerOn.png │ │ │ │ ├── update_16.png │ │ │ │ ├── update_24.png │ │ │ │ ├── visiblePass.png │ │ │ │ ├── infobases_24.png │ │ │ │ ├── lock_users_16.png │ │ │ │ ├── taskCompleted.png │ │ │ │ ├── updateAuto_24.png │ │ │ │ ├── connect_action_24.png │ │ │ │ ├── infobase_favorite.png │ │ │ │ ├── server_default_24.png │ │ │ │ ├── working_server_24.png │ │ │ │ ├── disconnect_action_24.png │ │ │ │ ├── server_connected_24.png │ │ │ │ ├── server_connecting_24.png │ │ │ │ ├── infobase_favorite_left.png │ │ │ │ └── server_connectError_24.png │ │ │ └── logback.xml │ │ └── java │ │ │ └── ru │ │ │ └── yanygin │ │ │ ├── clusterAdminLibrary │ │ │ ├── ClusterAdminLibraryMain.java │ │ │ ├── Messages.java │ │ │ ├── AssignmentRuleContentProvider.java │ │ │ ├── UserPassPair.java │ │ │ ├── InfoBaseInfoShortExt.java │ │ │ ├── CellValue.java │ │ │ ├── ConnectionInfoExtended.java │ │ │ ├── LockInfoExtended.java │ │ │ ├── AssignmentRuleLabelProvider.java │ │ │ ├── WorkingServerInfoExtended.java │ │ │ ├── WorkingProcessInfoExtended.java │ │ │ ├── ClusterProvider.java │ │ │ ├── BaseInfoExtended.java │ │ │ ├── ColumnProperties.java │ │ │ └── messages.properties │ │ │ └── clusterAdminLibraryUI │ │ │ ├── Messages.java │ │ │ ├── NewServersChoiseDialog.java │ │ │ ├── DropInfobaseDialog.java │ │ │ ├── AuthenticateDialog.java │ │ │ ├── AboutDialog.java │ │ │ ├── AdminEditDialog.java │ │ │ ├── AssignmentRuleDialog.java │ │ │ └── SessionInfoDialog.java │ └── test │ │ ├── java │ │ └── ru │ │ │ └── yanygin │ │ │ └── clusterAdminLibrary │ │ │ └── ConfigTest.java │ │ └── resources │ │ ├── config_0.2.0.json │ │ └── config_0.2.0_convert_0.3.0.json ├── .settings │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.ui.prefs ├── .checkstyle ├── .project └── .classpath ├── clusterAdminApplication ├── .gitignore ├── package.bat ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.ui.prefs ├── scripts │ ├── Запуск_Конфигуратор.bat │ ├── Запуск_Предприятие.bat │ ├── Выгрузка_CF.bat │ ├── Выгрузка_DT.bat │ ├── echo_long.bat │ └── echo_fast.bat ├── .checkstyle ├── .project ├── src │ └── main │ │ └── java │ │ └── ru │ │ └── yanygin │ │ └── clusterAdminApplication │ │ ├── ClusterAdmin.java │ │ └── ClusterViewer.java ├── .classpath └── pom.xml ├── lib ├── install-libs-lin.sh └── install-libs-win.bat ├── .github └── workflows │ ├── build-linux.yml │ ├── build-macOS.yml │ ├── build-windows.yml │ └── SonarCloud.yml └── README.md /clusterAdminLibrary/.gitignore: -------------------------------------------------------------------------------- 1 | /logs/ 2 | /bin/ 3 | /target/ -------------------------------------------------------------------------------- /clusterAdminApplication/.gitignore: -------------------------------------------------------------------------------- 1 | /logs/ 2 | /bin/ 3 | /config*.json 4 | /target/ 5 | -------------------------------------------------------------------------------- /clusterAdminLibrary/install.bat: -------------------------------------------------------------------------------- 1 | mvn clean install -Pwindows-x86_64 & mvn install -Plinux & mvn install -PmacOS & cmd /k -------------------------------------------------------------------------------- /clusterAdminApplication/package.bat: -------------------------------------------------------------------------------- 1 | mvn clean package -Pwindows-x86_64 & mvn package -Plinux & mvn package -PmacOS & cmd /k -------------------------------------------------------------------------------- /clusterAdminApplication/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding/=UTF-8 4 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/wp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/wp.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/wps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/wps.png -------------------------------------------------------------------------------- /clusterAdminLibrary/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles=windows-x86_64 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/Rouble.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/Rouble.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/add_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/add_16.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/add_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/add_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/sort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/sort.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/user.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/watch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/watch.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/edit_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/edit_16.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/edit_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/edit_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/infobase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/infobase.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/lock_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/lock_16.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/lock_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/lock_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/move_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/move_up.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/service.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/view_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/view_16.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/cluster_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/cluster_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/connection.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/delete_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/delete_16.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/delete_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/delete_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/favorites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/favorites.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/hiddenPass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/hiddenPass.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/move_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/move_down.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/sleepUser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/sleepUser.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/taskError.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/taskError.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/taskRunning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/taskRunning.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/tumblerOff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/tumblerOff.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/tumblerOn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/tumblerOn.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/update_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/update_16.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/update_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/update_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/visiblePass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/visiblePass.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/infobases_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/infobases_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/lock_users_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/lock_users_16.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/taskCompleted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/taskCompleted.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/updateAuto_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/updateAuto_24.png -------------------------------------------------------------------------------- /clusterAdminApplication/scripts/Запуск_Конфигуратор.bat: -------------------------------------------------------------------------------- 1 | chcp 65001 2 | "C:\Program Files\1cv8\common\1cestart.exe" DESIGNER /S %v8serverName%:%v8managerPort%\%v8infobase% /N Администратор /P 1234 -------------------------------------------------------------------------------- /clusterAdminApplication/scripts/Запуск_Предприятие.bat: -------------------------------------------------------------------------------- 1 | chcp 65001 2 | "C:\Program Files\1cv8\common\1cestart.exe" ENTERPRISE /S %v8serverName%:%v8managerPort%\%v8infobase% /N Администратор /P 1234 -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/connect_action_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/connect_action_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/infobase_favorite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/infobase_favorite.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/server_default_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/server_default_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/working_server_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/working_server_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/disconnect_action_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/disconnect_action_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/server_connected_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/server_connected_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/server_connecting_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/server_connecting_24.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/infobase_favorite_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/infobase_favorite_left.png -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/icons/server_connectError_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YanSergey/OneS_ClusterAdmin/HEAD/clusterAdminLibrary/src/main/resources/icons/server_connectError_24.png -------------------------------------------------------------------------------- /clusterAdminApplication/scripts/Выгрузка_CF.bat: -------------------------------------------------------------------------------- 1 | chcp 65001 2 | "C:\Program Files\1cv8\common\1cestart.exe" DESIGNER /S %v8serverName%:%v8managerPort%\%v8infobase% /N Администратор /P 1234 /DumpCfg D:\DumpIB\%v8infobase%.cf -------------------------------------------------------------------------------- /clusterAdminApplication/scripts/Выгрузка_DT.bat: -------------------------------------------------------------------------------- 1 | chcp 65001 2 | "C:\Program Files\1cv8\common\1cestart.exe" DESIGNER /S %v8serverName%:%v8managerPort%\%v8infobase% /N Администратор /P 1234 /DumpIB D:\DumpIB\%v8infobase%.dt -------------------------------------------------------------------------------- /clusterAdminApplication/scripts/echo_long.bat: -------------------------------------------------------------------------------- 1 | # пока что каждый командный файл должен содержать строку chcp 65001 2 | 3 | @echo off 4 | chcp 65001 5 | #chcp 6 | ping 127.0.0.1 -n 20 7 | echo server: %v8serverName%:%v8managerPort% 8 | echo infobase: %v8infobase% 9 | echo end 10 | -------------------------------------------------------------------------------- /clusterAdminApplication/scripts/echo_fast.bat: -------------------------------------------------------------------------------- 1 | # пока что каждый командный файл должен содержать строку chcp 65001 2 | 3 | @echo off 4 | chcp 65001 5 | echo server: %v8serverName%:%v8managerPort% 6 | echo password: %v8password% 7 | echo infobase: %v8infobase% 8 | echo username: %v8username% 9 | echo infobase1: %infobase1% 10 | echo end 11 | -------------------------------------------------------------------------------- /clusterAdminApplication/.settings/org.eclipse.jdt.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | formatter_profile=org.eclipse.jdt.ui.default_profile 3 | formatter_settings_version=21 4 | org.eclipse.jdt.ui.ignorelowercasenames=true 5 | org.eclipse.jdt.ui.importorder= 6 | org.eclipse.jdt.ui.ondemandthreshold=99 7 | org.eclipse.jdt.ui.staticondemandthreshold=99 8 | -------------------------------------------------------------------------------- /clusterAdminApplication/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /clusterAdminLibrary/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/java/ru/yanygin/clusterAdminLibrary=UTF-8 4 | encoding//src/main/java/ru/yanygin/clusterAdminLibraryUI=UTF-8 5 | encoding//src/main/resources=UTF-8 6 | encoding//src/test/java=UTF-8 7 | encoding//src/test/resources=UTF-8 8 | encoding/=UTF-8 9 | -------------------------------------------------------------------------------- /clusterAdminLibrary/.settings/org.eclipse.jdt.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | formatter_profile=org.eclipse.jdt.ui.default_profile 3 | formatter_settings_version=21 4 | org.eclipse.jdt.ui.ignorelowercasenames=true 5 | org.eclipse.jdt.ui.importorder=; 6 | org.eclipse.jdt.ui.ondemandthreshold=99 7 | org.eclipse.jdt.ui.staticondemandthreshold=99 8 | org.eclipse.jdt.ui.text.custom_code_templates= 9 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/ClusterAdminLibraryMain.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | /** 4 | * Entry point main class. 5 | * 6 | * @author Yanygin Sergey 7 | */ 8 | public class ClusterAdminLibraryMain { 9 | 10 | /** 11 | * Entry point. 12 | * 13 | * @param args - command args 14 | */ 15 | public static void main(String[] args) { 16 | new ClusterProvider(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /clusterAdminLibrary/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /clusterAdminLibrary/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | clusterAdminLibrary 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | net.sf.eclipsecs.core.CheckstyleBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.jdt.core.javanature 26 | org.eclipse.m2e.core.maven2Nature 27 | net.sf.eclipsecs.core.CheckstyleNature 28 | 29 | 30 | -------------------------------------------------------------------------------- /clusterAdminApplication/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | clusterAdminApplication 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | net.sf.eclipsecs.core.CheckstyleBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.jdt.core.javanature 26 | org.eclipse.m2e.core.maven2Nature 27 | net.sf.eclipsecs.core.CheckstyleNature 28 | 29 | 30 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/Messages.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibraryUI; 2 | 3 | import java.util.MissingResourceException; 4 | import java.util.ResourceBundle; 5 | 6 | /** Messages. */ 7 | public class Messages { 8 | private static final String BUNDLE_NAME = 9 | "ru.yanygin.clusterAdminLibraryUI.messages"; //$NON-NLS-1$ 10 | 11 | private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); 12 | 13 | private Messages() {} 14 | 15 | /** 16 | * Get the localized string. 17 | * 18 | * @param key - key of string 19 | * @return localized string 20 | */ 21 | public static String getString(String key) { 22 | try { 23 | return RESOURCE_BUNDLE.getString(key); 24 | } catch (MissingResourceException e) { 25 | return '!' + key + '!'; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /clusterAdminApplication/src/main/java/ru/yanygin/clusterAdminApplication/ClusterAdmin.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminApplication; 2 | 3 | import org.eclipse.swt.widgets.Display; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | 7 | /** ClusterAdmin application. */ 8 | public class ClusterAdmin { 9 | 10 | private static final Logger LOGGER = LoggerFactory.getLogger("ClusterProvider"); //$NON-NLS-1$ 11 | 12 | /** 13 | * ClusterAdmin application main. 14 | * 15 | * @param args - args 16 | */ 17 | public static void main(String[] args) { 18 | 19 | try { 20 | ClusterViewer window = new ClusterViewer(null); 21 | window.setBlockOnOpen(true); 22 | window.open(); 23 | Display.getCurrent().dispose(); 24 | 25 | } catch (Exception excp) { 26 | excp.printStackTrace(); 27 | LOGGER.error("Error:", excp); //$NON-NLS-1$ 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/install-libs-lin.sh: -------------------------------------------------------------------------------- 1 | mvn install:install-file -Dfile=com._1c.v8.core-1.0.30-SNAPSHOT.jar -DgroupId=com._1c.v8 -DartifactId=com._1c.v8.core -Dversion=1.0.30-SNAPSHOT -Dpackaging=jar 2 | mvn install:install-file -Dfile=com._1c.v8.ibis.admin-1.6.7.jar -DgroupId=com._1c.v8 -DartifactId=com._1c.v8.ibis.admin -Dversion=1.6.7 -Dpackaging=jar 3 | mvn install:install-file -Dfile=com._1c.v8.ibis.swp-1.1.1-SNAPSHOT.jar -DgroupId=com._1c.v8 -DartifactId=com._1c.v8.ibis.swp -Dversion=1.1.1-SNAPSHOT -Dpackaging=jar 4 | mvn install:install-file -Dfile=com._1c.v8.ibis-1.1.1-SNAPSHOT.jar -DgroupId=com._1c.v8 -DartifactId=com._1c.v8.ibis -Dversion=1.1.1-SNAPSHOT -Dpackaging=jar 5 | mvn install:install-file -Dfile=com._1c.v8.swp.netty-1.0.3-SNAPSHOT.jar -DgroupId=com._1c.v8 -DartifactId=com._1c.v8.swp.netty -Dversion=1.0.3-SNAPSHOT -Dpackaging=jar 6 | mvn install:install-file -Dfile=com._1c.v8.swp-1.0.3-SNAPSHOT.jar -DgroupId=com._1c.v8 -DartifactId=com._1c.v8.swp -Dversion=1.0.3-SNAPSHOT -Dpackaging=jar 7 | -------------------------------------------------------------------------------- /lib/install-libs-win.bat: -------------------------------------------------------------------------------- 1 | call mvn install:install-file -Dfile=com._1c.v8.core-1.0.30-SNAPSHOT.jar -DgroupId=com._1c.v8 -DartifactId=com._1c.v8.core -Dversion=1.0.30-SNAPSHOT -Dpackaging=jar 2 | call mvn install:install-file -Dfile=com._1c.v8.ibis.admin-1.6.7.jar -DgroupId=com._1c.v8 -DartifactId=com._1c.v8.ibis.admin -Dversion=1.6.7 -Dpackaging=jar 3 | call mvn install:install-file -Dfile=com._1c.v8.ibis.swp-1.1.1-SNAPSHOT.jar -DgroupId=com._1c.v8 -DartifactId=com._1c.v8.ibis.swp -Dversion=1.1.1-SNAPSHOT -Dpackaging=jar 4 | call mvn install:install-file -Dfile=com._1c.v8.ibis-1.1.1-SNAPSHOT.jar -DgroupId=com._1c.v8 -DartifactId=com._1c.v8.ibis -Dversion=1.1.1-SNAPSHOT -Dpackaging=jar 5 | call mvn install:install-file -Dfile=com._1c.v8.swp.netty-1.0.3-SNAPSHOT.jar -DgroupId=com._1c.v8 -DartifactId=com._1c.v8.swp.netty -Dversion=1.0.3-SNAPSHOT -Dpackaging=jar 6 | call mvn install:install-file -Dfile=com._1c.v8.swp-1.0.3-SNAPSHOT.jar -DgroupId=com._1c.v8 -DartifactId=com._1c.v8.swp -Dversion=1.0.3-SNAPSHOT -Dpackaging=jar 7 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n 8 | 9 | 10 | 11 | 12 | 13 | ./logs/app.log 14 | 15 | logs/%d{yyyy-MM-dd}.log 16 | 7 17 | 1GB 18 | 19 | 20 | 21 | 22 | %d %p %c{1.} [%t] %m%n 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Messages.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import java.util.Locale; 4 | import java.util.MissingResourceException; 5 | import java.util.ResourceBundle; 6 | 7 | /** Messages. */ 8 | public class Messages { 9 | private static final String BUNDLE_NAME = 10 | "ru.yanygin.clusterAdminLibrary.messages"; //$NON-NLS-1$ 11 | 12 | private static ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); 13 | 14 | /** 15 | * Reload localized strings. 16 | * 17 | * @param targetLocale - target locale 18 | */ 19 | public static void reloadBundle(Locale targetLocale) { 20 | RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, targetLocale); 21 | } 22 | 23 | private Messages() {} 24 | 25 | /** 26 | * Get localized string. 27 | * 28 | * @param key - key of string 29 | * @return localized string 30 | */ 31 | public static String getString(String key) { 32 | try { 33 | return RESOURCE_BUNDLE.getString(key); 34 | } catch (MissingResourceException e) { 35 | return '!' + key + '!'; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/AssignmentRuleContentProvider.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import com._1c.v8.ibis.admin.IAssignmentRuleInfo; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | import org.eclipse.jface.viewers.IStructuredContentProvider; 8 | 9 | /** Контент-провайдер для заполнения таблицы с ТНФ. */ 10 | public class AssignmentRuleContentProvider implements IStructuredContentProvider { 11 | 12 | static Map ruleNumbers = new HashMap<>(); 13 | 14 | /** 15 | * Returns the elements in the input, which must be either an array or a Collection . 16 | */ 17 | @Override 18 | public Object[] getElements(Object inputElement) { 19 | List listTnf = (List) inputElement; 20 | setRuleNumbers(listTnf); 21 | return listTnf.toArray(); 22 | } 23 | 24 | private static void setRuleNumbers(List rules) { 25 | ruleNumbers.clear(); 26 | for (int i = 0; i < rules.size(); i++) { 27 | ruleNumbers.put(rules.get(i), i + 1); 28 | } 29 | } 30 | 31 | public static int getRuleNumber(IAssignmentRuleInfo rule) { 32 | return ruleNumbers.getOrDefault(rule, 0); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /.github/workflows/build-linux.yml: -------------------------------------------------------------------------------- 1 | name: Build Linux 2 | 3 | on: 4 | push: 5 | branches: 6 | - develop 7 | - master 8 | pull_request: 9 | branches: 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | 16 | - name: Checkout 17 | uses: actions/checkout@v4 18 | 19 | - name: Set up JDK 11 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: 11 23 | 24 | - name: Download and install Libs 25 | env: 26 | GITHUB_TOKEN: ${{ secrets.ONES_IBIS_LIBS_TOKEN }} 27 | LIBS_REPO: ${{ secrets.ONES_IBIS_LIBS_REPO }} 28 | run: | 29 | cd lib 30 | gh release download --repo "$LIBS_REPO" 1.0 31 | ls -lh 32 | sh install-libs-lin.sh 33 | 34 | - name: Install clusterAdmin lib 35 | run: | 36 | cd clusterAdminLibrary 37 | mvn -B clean install -Plinux -DskipTests 38 | 39 | - name: Package Application 40 | run: | 41 | cd clusterAdminApplication 42 | mvn -B clean package -Plinux -DskipTests 43 | 44 | - name: Upload build to artifacts 45 | uses: actions/upload-artifact@master 46 | with: 47 | name: OneS_ClusterAdmin-linux 48 | path: ${{ github.workspace }}/clusterAdminApplication/target/OneS_ClusterAdmin-*-linux.jar -------------------------------------------------------------------------------- /.github/workflows/build-macOS.yml: -------------------------------------------------------------------------------- 1 | name: Build MacOS 2 | 3 | on: 4 | push: 5 | branches: 6 | - develop 7 | - master 8 | pull_request: 9 | branches: 10 | 11 | jobs: 12 | build: 13 | runs-on: macOS-latest 14 | steps: 15 | 16 | - name: Checkout 17 | uses: actions/checkout@v4 18 | 19 | - name: Set up JDK 11 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: 11 23 | 24 | - name: Download and install Libs 25 | env: 26 | GITHUB_TOKEN: ${{ secrets.ONES_IBIS_LIBS_TOKEN }} 27 | LIBS_REPO: ${{ secrets.ONES_IBIS_LIBS_REPO }} 28 | run: | 29 | cd lib 30 | gh release download --repo "$LIBS_REPO" 1.0 31 | ls -lh 32 | sh install-libs-lin.sh 33 | 34 | - name: Install clusterAdmin lib 35 | run: | 36 | cd clusterAdminLibrary 37 | mvn -B clean install -PmacOS -DskipTests 38 | 39 | - name: Package Application 40 | run: | 41 | cd clusterAdminApplication 42 | mvn -B clean package -PmacOS -DskipTests 43 | 44 | - name: Upload build to artifacts 45 | uses: actions/upload-artifact@master 46 | with: 47 | name: OneS_ClusterAdmin-macOS 48 | path: ${{ github.workspace }}/clusterAdminApplication/target/OneS_ClusterAdmin-*-macOS.jar -------------------------------------------------------------------------------- /.github/workflows/build-windows.yml: -------------------------------------------------------------------------------- 1 | name: Build Windows 2 | 3 | on: 4 | push: 5 | branches: 6 | - develop 7 | - master 8 | pull_request: 9 | branches: 10 | 11 | jobs: 12 | build: 13 | runs-on: windows-latest 14 | steps: 15 | 16 | - name: Checkout 17 | uses: actions/checkout@v4 18 | 19 | - name: Set up JDK 11 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: 11 23 | 24 | - name: Download and install Libs 25 | env: 26 | GITHUB_TOKEN: ${{ secrets.ONES_IBIS_LIBS_TOKEN }} 27 | LIBS_REPO: ${{ secrets.ONES_IBIS_LIBS_REPO }} 28 | shell: cmd 29 | run: | 30 | cd lib 31 | gh release download --repo "%LIBS_REPO%" 1.0 32 | dir 33 | install-libs-win.bat 34 | 35 | - name: Install clusterAdmin lib 36 | shell: cmd 37 | run: | 38 | cd clusterAdminLibrary 39 | mvn -B clean install -Pwindows-x86_64 40 | 41 | - name: Package Application 42 | shell: cmd 43 | run: | 44 | cd clusterAdminApplication 45 | mvn -B clean package -Pwindows-x86_64 46 | 47 | - name: Upload build to artifacts 48 | uses: actions/upload-artifact@master 49 | with: 50 | name: OneS_ClusterAdmin-windows-x64 51 | path: ${{ github.workspace }}\clusterAdminApplication\target\OneS_ClusterAdmin-*-windows-x64.jar -------------------------------------------------------------------------------- /.github/workflows/SonarCloud.yml: -------------------------------------------------------------------------------- 1 | name: SonarCloud 2 | 3 | on: 4 | push: 5 | branches: 6 | - develop 7 | - master 8 | pull_request: 9 | 10 | jobs: 11 | SonarCloud: 12 | runs-on: ubuntu-latest 13 | if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.event.repository.full_name 14 | steps: 15 | 16 | - name: Checkout 17 | uses: actions/checkout@v4 18 | with: 19 | fetch-depth: '' 20 | - run: | 21 | git fetch --prune --unshallow 22 | 23 | - name: Set up JDK 17 24 | uses: actions/setup-java@v1 25 | with: 26 | java-version: 17 27 | 28 | - name: Download and install Libs 29 | env: 30 | GITHUB_TOKEN: ${{ secrets.ONES_IBIS_LIBS_TOKEN }} 31 | LIBS_REPO: ${{ secrets.ONES_IBIS_LIBS_REPO }} 32 | run: | 33 | cd lib 34 | gh release download --repo "$LIBS_REPO" 1.0 35 | ls -lh 36 | sh install-libs-lin.sh 37 | 38 | - name: SonarCloud Scan 39 | env: 40 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 41 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 42 | run: > 43 | cd clusterAdminLibrary 44 | 45 | mvn -B verify -DskipTests sonar:sonar 46 | -Dsonar.projectKey=YanSergey_OneS_ClusterAdmin 47 | -Dsonar.projectName="OneS ClusterAdmin" 48 | -Dsonar.organization=yansergey 49 | -Dsonar.host.url=https://sonarcloud.io 50 | -Dsonar.login=$SONAR_TOKEN -------------------------------------------------------------------------------- /clusterAdminApplication/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OneS_ClusterAdmin 2 | 3 | [![Download](https://img.shields.io/github/release/YanSergey/OneS_ClusterAdmin?label=download&style=flat)](https://github.com/YanSergey/OneS_ClusterAdmin/releases/latest) 4 | [![GitHub Releases](https://img.shields.io/github/downloads/YanSergey/OneS_ClusterAdmin/latest/total?style=flat-square)](https://github.com/YanSergey/OneS_ClusterAdmin/releases) 5 | [![GitHub All Releases](https://img.shields.io/github/downloads/YanSergey/OneS_ClusterAdmin/total?style=flat-square)](https://github.com/YanSergey/OneS_ClusterAdmin/releases) 6 | 7 | ## Утилита для интерактивного администрирования серверов 1С 8 | 9 | ![Donate](/clusterAdminLibrary/src/main/resources/icons/Rouble.png) 10 | Поддержать проект https://boosty.to/YanSergeyCoder 11 | 12 | Статья с описанием возможностей утилиты на Infostart https://infostart.ru/public/1489055/ 13 | 14 | Разработка ведется в `Eclipse IDE for Java Developers` 15 | 16 | Для разработки необходимо: 17 | - установить в локальный репозиторий maven jar-библиотеки от 1С, описаннные в примечании и расположенные в каталоге `clusterAdminLibrary\lib` командой `mvn install:install-file`. Пример команд в файле [clusterAdminLibrary/lib/install-libs.bat](clusterAdminLibrary/lib/install-libs.bat) 18 | 19 | 20 | Сборка: 21 | 22 | - установить в локальный репозиторий библиотеку `clusterAdminLibrary`, выполнив команду `mvn clean install`. Пример в [clusterAdminLibrary/install.bat](clusterAdminLibrary/install.bat) 23 | 24 | - выполнить команду `mvn clean package` для сборки приложения для Windows (профиль по-умолчанию), либо с указанием конкретной ОС `mvn clean package -Plinux`, либо для всех трех ОС командой из [clusterAdminApplication/package.bat](clusterAdminApplication/package.bat) 25 | 26 | ### Примечание: 27 | 28 | Для соединения с RAS используется "Программный Java-интерфейс для административного сервера", который опубликован в свободном доступе [на сайте ИТС в разделе "Методическая поддержка для разработчиков и администраторов 1С:Предприятия 8"](https://its.1c.ru/db/metod8dev#content:4985:hdoc). 29 | Есть две версии: 30 | - для 8.3.6 - 8.3.10 31 | - для 8.3.11+ 32 | 33 | В утилите используется версия для 8.3.11+, которая успешно работает с платформой 8.3.10. Платформ версий ниже 8.3.10 в своем распоряжении не имею, а потому работа с ними не тестировалась. 34 | -------------------------------------------------------------------------------- /clusterAdminLibrary/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /clusterAdminApplication/src/main/java/ru/yanygin/clusterAdminApplication/ClusterViewer.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminApplication; 2 | 3 | import org.eclipse.jface.action.MenuManager; 4 | import org.eclipse.jface.action.StatusLineManager; 5 | import org.eclipse.jface.action.ToolBarManager; 6 | import org.eclipse.jface.window.ApplicationWindow; 7 | import org.eclipse.swt.SWT; 8 | import org.eclipse.swt.graphics.Point; 9 | import org.eclipse.swt.widgets.Composite; 10 | import org.eclipse.swt.widgets.Control; 11 | import org.eclipse.swt.widgets.Menu; 12 | import org.eclipse.swt.widgets.Shell; 13 | import org.eclipse.swt.widgets.ToolBar; 14 | import ru.yanygin.clusterAdminLibrary.ClusterProvider; 15 | import ru.yanygin.clusterAdminLibrary.Config; 16 | import ru.yanygin.clusterAdminLibraryUI.ViewerArea; 17 | 18 | /** Application window class. */ 19 | public class ClusterViewer extends ApplicationWindow { 20 | 21 | Composite mainForm; 22 | 23 | ClusterProvider clusterProvider = new ClusterProvider(); 24 | Config config; 25 | 26 | /** 27 | * Create the application window. 28 | * 29 | * @param configPath - путь к файлу конфигурации 30 | */ 31 | public ClusterViewer(String configPath) { 32 | super(null); 33 | createActions(); 34 | addToolBar(SWT.FLAT | SWT.WRAP); 35 | addMenuBar(); 36 | addStatusLine(); 37 | 38 | this.config = Config.readConfig(configPath); 39 | } 40 | 41 | @Override 42 | public boolean close() { 43 | config.close(); 44 | return super.close(); 45 | } 46 | 47 | /** 48 | * Create contents of the application window. 49 | * 50 | * @param parent - parent composite 51 | */ 52 | @Override 53 | protected Control createContents(Composite parent) { 54 | this.mainForm = parent; 55 | 56 | ToolBar toolBar = this.getToolBarManager().createControl(parent); 57 | 58 | Menu menu = this.getMenuBarManager().getMenu(); 59 | 60 | ViewerArea container = new ViewerArea(parent, SWT.NONE, menu, toolBar, clusterProvider, config); 61 | 62 | return container; 63 | } 64 | 65 | 66 | /** Create the actions. */ 67 | private void createActions() { 68 | // Create the actions 69 | } 70 | 71 | /** 72 | * Create the menu manager. 73 | * 74 | * @return the menu manager 75 | */ 76 | @Override 77 | protected MenuManager createMenuManager() { 78 | MenuManager menuManager = new MenuManager("menu"); 79 | return menuManager; 80 | } 81 | 82 | /** 83 | * Create the toolbar manager. 84 | * 85 | * @return the toolbar manager 86 | */ 87 | @Override 88 | protected ToolBarManager createToolBarManager(int style) { 89 | ToolBarManager toolBarManager = new ToolBarManager(style); 90 | return toolBarManager; 91 | } 92 | 93 | /** 94 | * Create the status line manager. 95 | * 96 | * @return the status line manager 97 | */ 98 | @Override 99 | protected StatusLineManager createStatusLineManager() { 100 | StatusLineManager statusLineManager = new StatusLineManager(); 101 | return statusLineManager; 102 | } 103 | 104 | /** 105 | * Configure the shell. 106 | * 107 | * @param newShell - shell 108 | */ 109 | @Override 110 | protected void configureShell(Shell newShell) { 111 | super.configureShell(newShell); 112 | newShell.setText("OneS Cluster Administrator"); 113 | // icon 114 | } 115 | 116 | /** Return the initial size of the window. */ 117 | @Override 118 | protected Point getInitialSize() { 119 | return new Point(1600, 800); 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/test/java/ru/yanygin/clusterAdminLibrary/ConfigTest.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | import static org.junit.jupiter.api.Assertions.assertNotEquals; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | class ConfigTest { 9 | 10 | @Test 11 | void testReadConfig() { 12 | 13 | Config simpleConfig = new Config(); 14 | 15 | // проверка чтения конфига из текущего каталога 16 | Config defaultPathConfig = Config.readConfig(); 17 | assertEquals(simpleConfig.getConfigPath(), defaultPathConfig.getConfigPath()); 18 | Config nullConfig = Config.readConfig(null); 19 | assertEquals(simpleConfig.getConfigPath(), nullConfig.getConfigPath()); 20 | Config blankPathConfig = Config.readConfig(""); 21 | assertEquals(simpleConfig.getConfigPath(), blankPathConfig.getConfigPath()); 22 | 23 | // проверка чтения пустого конфига (создание нового) 24 | // assertEquals(simpleConfig.getLocale(), blankPathConfig.getLocale()); 25 | // assertEquals(simpleConfig.getServers(), blankPathConfig.getServers()); 26 | 27 | // проверка чтения несуществующего конфига (создание нового) 28 | Config notExistConfig = Config.readConfig("src\\test\\resources\\not_exist_config.json"); 29 | 30 | assertNotEquals(simpleConfig.getConfigPath(), notExistConfig.getConfigPath()); 31 | assertEquals(simpleConfig.getLocale(), notExistConfig.getLocale()); 32 | assertEquals(simpleConfig.getServers(), notExistConfig.getServers()); 33 | 34 | // проверка миграции конфига с версии 0.2.0 на 0.3.0 35 | Config config020 = Config.readConfig("src\\test\\resources\\config_0.2.0.json"); 36 | Config config030 = Config.readConfig("src\\test\\resources\\config_0.2.0_convert_0.3.0.json"); 37 | 38 | config020 39 | .getServers() 40 | .forEach( 41 | (server020Key, server020) -> { 42 | Server server030 = config030.getServers().get(server020Key); 43 | 44 | // проверка миграции варианта хранения кредов 45 | assertEquals( 46 | server020.getSaveCredentialsVariant(), server030.getSaveCredentialsVariant()); 47 | 48 | // проврка миграции кредов агента 49 | UserPassPair agent020Creds = server020.getAgentCredential(); 50 | UserPassPair agent030Creds = server030.getAgentCredential(); 51 | assertEquals(agent020Creds.getDescription(), agent030Creds.getDescription()); 52 | assertEquals(agent020Creds.getUsername(), agent030Creds.getUsername()); 53 | assertEquals(agent020Creds.getPassword(), agent030Creds.getPassword()); 54 | 55 | // проврка миграции кредов кластера 56 | server020 57 | .getAllClustersCredentials() 58 | .forEach( 59 | (uuid, creds020) -> { 60 | UserPassPair creds030 = server030.getClusterCredentials(uuid); 61 | assertEquals(creds020.getDescription(), creds030.getDescription()); 62 | assertEquals(creds020.getUsername(), creds030.getUsername()); 63 | assertEquals(creds020.getPassword(), creds030.getPassword()); 64 | }); 65 | 66 | }); 67 | } 68 | 69 | @Test 70 | void testCreateNewServer() { 71 | 72 | Config emptyConfig = new Config(); 73 | 74 | Server server = emptyConfig.createNewServer(); 75 | 76 | assertEquals("Server1c", server.getAgentHost()); 77 | assertEquals("1540", server.getAgentPortAsString()); 78 | assertEquals("Server1c", server.getRasHost()); 79 | assertEquals("1545", server.getRasPortAsString()); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/UserPassPair.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | import ru.yanygin.clusterAdminLibrary.Server.SaveCredentialsVariant; 6 | 7 | /** Пара логин-пароль с доп. информацией. */ 8 | public class UserPassPair { 9 | 10 | @SerializedName("Username") 11 | @Expose 12 | private String username = ""; 13 | 14 | @SerializedName("Password") 15 | @Expose 16 | private String password = ""; 17 | 18 | @SerializedName("Description") 19 | @Expose 20 | private String description = ""; 21 | 22 | private static final String EMPTY_STRING = ""; //$NON-NLS-1$ 23 | private static final String HIDDEN_PASSWORD = "***"; //$NON-NLS-1$ 24 | 25 | /** Создание экземпляра с пустыми логин/паролем. */ 26 | public UserPassPair() {} 27 | 28 | /** 29 | * Создание экземпляра логин/пароля. 30 | * 31 | * @param username - логин 32 | * @param password - пароль 33 | */ 34 | public UserPassPair(String username, String password) { 35 | this.username = username; 36 | this.password = password; 37 | } 38 | 39 | /** 40 | * Создание экземпляра логин/пароля с доп. информацией. 41 | * 42 | * @param username - логин 43 | * @param password - пароль 44 | * @param description - описание, доп. информация 45 | */ 46 | public UserPassPair(String username, String password, String description) { 47 | this.username = username; 48 | this.password = password; 49 | this.description = description; 50 | } 51 | 52 | /** 53 | * Получение имени пользователя. 54 | * 55 | * @return имя пользователя 56 | */ 57 | public String getUsername() { 58 | return username; 59 | } 60 | 61 | /** 62 | * Получение пароля. 63 | * 64 | * @return пароль 65 | */ 66 | public String getPassword() { 67 | return password; 68 | } 69 | 70 | /** 71 | * Получение пароля. 72 | * 73 | * @param showPasswordMode - если истина возвращается пароль, иначе звездочки 74 | * @return пароль 75 | */ 76 | public String getPassword(Boolean showPasswordMode) { 77 | return Boolean.TRUE.equals(showPasswordMode) ? password : HIDDEN_PASSWORD; 78 | } 79 | 80 | /** 81 | * Получение описания, доп информации. 82 | * 83 | * @return описание 84 | */ 85 | public String getDescription() { 86 | return description; 87 | } 88 | 89 | /** 90 | * Очистка имени пользователя и пароля. 91 | * 92 | * @param variant - вариант хранения логин/пароля 93 | */ 94 | public void clear(SaveCredentialsVariant variant) { 95 | 96 | switch (variant) { 97 | case DISABLE: 98 | this.username = EMPTY_STRING; 99 | this.password = EMPTY_STRING; 100 | break; 101 | 102 | case NAME: 103 | this.password = EMPTY_STRING; 104 | break; 105 | 106 | default: 107 | break; 108 | } 109 | } 110 | 111 | /** 112 | * Установка имени пользователя. 113 | * 114 | * @param username - имя пользователя 115 | */ 116 | public void setUsername(String username) { 117 | this.username = username; 118 | } 119 | 120 | /** 121 | * Установка нового паролядля пользователя. 122 | * 123 | * @param password - пароль 124 | */ 125 | public void setPassword(String password) { 126 | this.password = password; 127 | } 128 | 129 | /** 130 | * Описание, доп информация. 131 | * 132 | * @param description - описание 133 | */ 134 | public void setDescription(String description) { 135 | this.description = description; 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/InfoBaseInfoShortExt.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import com._1c.v8.ibis.admin.IInfoBaseInfoShort; 4 | import com._1c.v8.ibis.admin.InfoBaseInfoShort; 5 | import java.text.Collator; 6 | import java.util.Locale; 7 | import org.eclipse.swt.graphics.Image; 8 | 9 | /** Класс расширяет возможности InfoBaseInfoShort. */ 10 | public class InfoBaseInfoShortExt extends InfoBaseInfoShort 11 | implements Comparable { 12 | 13 | private static final String DEFAULT_ICON_FILENAME = "infobase.png"; //$NON-NLS-1$ 14 | private static final String FAVORITE_ICON_FILENAME = "infobase_favorite.png"; //$NON-NLS-1$ 15 | private static Image defaultIcon = Helper.getImage(DEFAULT_ICON_FILENAME); 16 | private static Image favoriteIcon = Helper.getImage(FAVORITE_ICON_FILENAME); 17 | 18 | static final String INFOBASE_ID = "InfobaseId"; //$NON-NLS-1$ 19 | static final String INFOBASE_INFO_SHORT_EXT = "InfobaseInfoShortExt"; //$NON-NLS-1$ 20 | 21 | int index = 0; 22 | boolean isFavorite = false; 23 | Image currentIcon; // protected 24 | 25 | /** 26 | * Возвращает порядковый номер инфобазы из кластера. 27 | * 28 | * @return the index 29 | */ 30 | public int getIndex() { 31 | return index; 32 | } 33 | 34 | /** 35 | * Устанавливает порядковый номер инфобазы из кластера. 36 | * 37 | * @param index - индекс 38 | */ 39 | public void setIndex(int index) { 40 | this.index = index; 41 | } 42 | 43 | /** 44 | * Возвращает находится ли инфобаза в списке избранных. 45 | * 46 | * @return the isFavorite 47 | */ 48 | public boolean isFavorite() { 49 | return isFavorite; 50 | } 51 | 52 | /** 53 | * Возвращает иконку инфобазы. 54 | * 55 | * @return Image currentIcon 56 | */ 57 | public Image getIcon() { 58 | return currentIcon; 59 | } 60 | 61 | /** 62 | * Устанавливает признак избранной инфобазы. 63 | * 64 | * @param isFavorite - текущее состояние 65 | */ 66 | public void setFavoriteState(boolean isFavorite) { 67 | this.isFavorite = isFavorite; 68 | this.currentIcon = isFavorite ? favoriteIcon : defaultIcon; 69 | } 70 | 71 | /** 72 | * Создает класс краткое (расширенное) описание инфобазыю. 73 | * 74 | * @param ib - краткое описание инфобазы 75 | * @param index - порядковый номер инфобазы из кластера 76 | * @param isFavorite - инфобаза в избранном 77 | */ 78 | public InfoBaseInfoShortExt(IInfoBaseInfoShort ib, int index, boolean isFavorite) { 79 | super(ib.getInfoBaseId()); 80 | this.setDescr(ib.getDescr()); 81 | this.setName(ib.getName()); 82 | this.index = index; 83 | this.isFavorite = isFavorite; 84 | this.currentIcon = isFavorite ? favoriteIcon : defaultIcon; 85 | } 86 | 87 | /** Направление сортировки инфобаз. */ 88 | public enum InfobasesSortDirection { 89 | /** Выключено. */ 90 | DISABLE, 91 | /** По имени. */ 92 | BY_NAME, 93 | /** По избранноми и имени. */ 94 | BY_FAVORITES_AND_NAME 95 | } 96 | 97 | @Override 98 | public int compareTo(InfoBaseInfoShortExt o) { 99 | 100 | InfobasesSortDirection sortDirection = Config.currentConfig.getInfobasesSortDirection(); 101 | Collator collator = Collator.getInstance(Locale.getDefault()); 102 | 103 | int compareResult = 0; 104 | switch (sortDirection) { 105 | case BY_NAME: 106 | compareResult = collator.compare(getName(), o.getName()); 107 | break; 108 | case BY_FAVORITES_AND_NAME: 109 | compareResult = Boolean.compare(o.isFavorite, isFavorite()); 110 | if (compareResult == 0) { 111 | compareResult = collator.compare(getName(), o.getName()); 112 | } 113 | break; 114 | 115 | case DISABLE: 116 | compareResult = Integer.compare(index, o.index); 117 | break; 118 | 119 | default: 120 | return 0; 121 | } 122 | 123 | return compareResult; 124 | } 125 | 126 | /** 127 | * Получение названия инфобазы для дерева. 128 | * 129 | * @return названия инфобазы для дерева 130 | */ 131 | public String getInfobaseDescription() { 132 | String infobaseTitle; 133 | if (Config.currentConfig.isShowInfobaseDescription() && !getDescr().isBlank()) { 134 | infobaseTitle = String.format("%s (%s)", getName(), getDescr()); //$NON-NLS-1$ 135 | } else { 136 | infobaseTitle = String.format("%s", getName()); //$NON-NLS-1$ 137 | } 138 | return infobaseTitle; 139 | } 140 | 141 | } 142 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/NewServersChoiseDialog.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibraryUI; 2 | 3 | import java.util.List; 4 | import org.eclipse.jface.dialogs.Dialog; 5 | import org.eclipse.jface.dialogs.IDialogConstants; 6 | import org.eclipse.swt.SWT; 7 | import org.eclipse.swt.events.SelectionAdapter; 8 | import org.eclipse.swt.events.SelectionEvent; 9 | import org.eclipse.swt.layout.GridData; 10 | import org.eclipse.swt.layout.GridLayout; 11 | import org.eclipse.swt.widgets.Button; 12 | import org.eclipse.swt.widgets.Composite; 13 | import org.eclipse.swt.widgets.Control; 14 | import org.eclipse.swt.widgets.Shell; 15 | import org.eclipse.swt.widgets.Table; 16 | import org.eclipse.swt.widgets.TableColumn; 17 | import org.eclipse.swt.widgets.TableItem; 18 | import ru.yanygin.clusterAdminLibrary.Helper; 19 | import ru.yanygin.clusterAdminLibrary.Server; 20 | 21 | /** Форма для выбора, какие найденные сервера добавлять в список. */ 22 | public class NewServersChoiseDialog extends Dialog { 23 | private Table table; 24 | private List newServers; 25 | 26 | /** 27 | * Create the dialog. 28 | * 29 | * @param parentShell - parent shell 30 | */ 31 | public NewServersChoiseDialog(Shell parentShell) { 32 | super(parentShell); 33 | setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL); 34 | } 35 | 36 | @Override 37 | protected void configureShell(Shell newShell) { 38 | super.configureShell(newShell); 39 | newShell.setText(Strings.TITLE_WINDOW); 40 | } 41 | 42 | /** 43 | * Create contents of the dialog. 44 | * 45 | * @param parent - parent composite 46 | */ 47 | @Override 48 | protected Control createDialogArea(Composite parent) { 49 | 50 | Composite container = (Composite) super.createDialogArea(parent); 51 | GridLayout gridLayout = (GridLayout) container.getLayout(); 52 | gridLayout.marginHeight = 0; 53 | gridLayout.marginWidth = 0; 54 | 55 | table = new Table(container, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION); 56 | table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); 57 | table.setHeaderVisible(true); 58 | table.setLinesVisible(true); 59 | 60 | TableColumn columnHost = new TableColumn(table, SWT.LEFT); 61 | columnHost.setResizable(false); 62 | columnHost.setWidth(200); 63 | columnHost.setText(Strings.HOST); 64 | 65 | TableColumn columnAgentPort = new TableColumn(table, SWT.LEFT); 66 | columnAgentPort.setResizable(false); 67 | columnAgentPort.setWidth(100); 68 | columnAgentPort.setText(Strings.PORT); 69 | 70 | newServers = Helper.findNewServers(); 71 | 72 | table.removeAll(); 73 | newServers.forEach( 74 | (serv) -> { 75 | TableItem item = new TableItem(table, SWT.NONE); 76 | item.setText(0, serv.getAgentHost()); 77 | item.setText(1, serv.getAgentPortAsString()); 78 | item.setData(serv); 79 | }); 80 | 81 | columnHost.pack(); 82 | columnAgentPort.pack(); 83 | 84 | return container; 85 | } 86 | 87 | private void saveNewServers() { 88 | TableItem[] items = table.getItems(); 89 | 90 | for (TableItem tableItem : items) { 91 | if (!tableItem.getChecked()) { 92 | newServers.remove(tableItem.getData()); 93 | } 94 | } 95 | } 96 | 97 | /** 98 | * Получение списка серверов, выбранных пользователем. 99 | * 100 | * @return список новых серверов 101 | */ 102 | public List getNewServers() { 103 | return newServers; 104 | } 105 | 106 | /** 107 | * Create contents of the button bar. 108 | * 109 | * @param parent - parent composite 110 | */ 111 | @Override 112 | protected void createButtonsForButtonBar(Composite parent) { 113 | Button button = 114 | createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.OK_LABEL, true); 115 | button.addSelectionListener( 116 | new SelectionAdapter() { 117 | @Override 118 | public void widgetSelected(SelectionEvent e) { 119 | saveNewServers(); 120 | close(); 121 | } 122 | }); 123 | createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); 124 | } 125 | 126 | private static class Strings { 127 | static final String TITLE_WINDOW = Messages.getString("NewServersDialog.TitleDialog"); 128 | static final String HOST = getString("Host"); 129 | static final String PORT = getString("Port"); 130 | 131 | static String getString(String key) { 132 | return Messages.getString("ServerDialog." + key); // $NON-NLS-1$ 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/CellValue.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import java.text.DecimalFormat; 4 | import java.util.Date; 5 | 6 | /** Value of cell from lists. */ 7 | public class CellValue { 8 | 9 | public enum CELL_VALUE_TYPE { 10 | TEXT, 11 | INT, 12 | BOOLEAN, 13 | DATE, 14 | SECONDS_INT, 15 | SECONDS_LONG, 16 | INT_GROUP, 17 | LONG_GROUP, 18 | DECIMAL_3_CHAR, 19 | DECIMAL_6_CHAR 20 | } 21 | 22 | public String name; 23 | public String descr; 24 | public String value; 25 | public Object originalValue; 26 | public CELL_VALUE_TYPE type; 27 | 28 | DecimalFormat decimalFormatDouble3 = new DecimalFormat("###,##0.000"); //$NON-NLS-1$ 29 | DecimalFormat decimalFormatDouble6 = new DecimalFormat("#,##0.000000"); //$NON-NLS-1$ 30 | DecimalFormat decimalFormatLong = new DecimalFormat("###,###"); //$NON-NLS-1$ 31 | 32 | // NumberFormat fmt = NumberFormat.getInstance(); 33 | // fmt.setGroupingUsed(false); 34 | // fmt.setMaximumIntegerDigits(999); 35 | // fmt.setMaximumFractionDigits(999); 36 | 37 | /** 38 | * Create cell value class. 39 | * 40 | * @param name - Name of column 41 | * @param descr - Description of column 42 | * @param value - Value of cell 43 | * @param type - Type value of cell 44 | */ 45 | public CellValue(String name, String descr, Object value, CELL_VALUE_TYPE type) { 46 | this.name = name; 47 | this.descr = descr; 48 | this.originalValue = value; 49 | this.type = type; 50 | 51 | switch (type) { 52 | case INT: 53 | this.value = Integer.toString((int) value); 54 | break; 55 | 56 | case BOOLEAN: 57 | this.value = Boolean.toString((boolean) value); 58 | break; 59 | 60 | case DATE: 61 | this.value = Helper.dateToString((Date) value); 62 | break; 63 | 64 | case SECONDS_INT: 65 | this.value = double3ToString((int) value); 66 | // double d = Double.valueOf((int) value); 67 | // this.value = millisecondToString((int) value); 68 | break; 69 | 70 | case SECONDS_LONG: 71 | this.value = double3ToString((long) value); 72 | // this.value = millisecondToString((long) value); 73 | break; 74 | 75 | case INT_GROUP: 76 | this.value = longToStringGroup((int) value); 77 | break; 78 | 79 | case LONG_GROUP: 80 | this.value = longToStringGroup((long) value); 81 | break; 82 | 83 | case DECIMAL_3_CHAR: 84 | if (value instanceof Integer) { 85 | this.value = double3ToString((int) value); 86 | } else if (value instanceof Long) { 87 | this.value = double3ToString((long) value); 88 | } 89 | break; 90 | 91 | case DECIMAL_6_CHAR: 92 | this.value = double6ToString((double) value); 93 | break; 94 | 95 | case TEXT: 96 | default: 97 | this.value = (String) value; 98 | } 99 | } 100 | 101 | /** 102 | * Cast double value to string. 103 | * 104 | * @param value - double value 105 | * @return double value to string 106 | */ 107 | private String double3ToString(double value) { 108 | return decimalFormatDouble3.format(value / 1000); 109 | } 110 | 111 | /** 112 | * Cast double value to string. 113 | * 114 | * @param value - double value 115 | * @return double value to string 116 | */ 117 | private String double6ToString(double value) { 118 | return decimalFormatDouble6.format(value); 119 | } 120 | 121 | /** 122 | * Cast long value to string. 123 | * 124 | * @param value - long value 125 | * @return long value to string 126 | */ 127 | private String longToStringGroup(long value) { 128 | return decimalFormatLong.format(value); 129 | } 130 | 131 | /** 132 | * Cast millisecond to string. 133 | * 134 | * @param value - millisecond 135 | * @return millisecond to string 136 | */ 137 | private String millisecondToString(int value) { 138 | return Double.toString(((double) value) / 1000); 139 | } 140 | 141 | /** 142 | * Cast millisecond to string. 143 | * 144 | * @param value - millisecond 145 | * @return millisecond to string 146 | */ 147 | private String millisecondToString(long value) { 148 | return Double.toString(((double) value) / 1000); 149 | } 150 | 151 | /** 152 | * Cast double value to string. 153 | * 154 | * @param value - double value 155 | * @return double value to string 156 | */ 157 | private String doubleToString1(double value) { 158 | return String.format("%.9f", value); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/DropInfobaseDialog.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibraryUI; 2 | 3 | import java.util.UUID; 4 | import org.eclipse.jface.dialogs.Dialog; 5 | import org.eclipse.jface.dialogs.IDialogConstants; 6 | import org.eclipse.swt.SWT; 7 | import org.eclipse.swt.events.SelectionAdapter; 8 | import org.eclipse.swt.events.SelectionEvent; 9 | import org.eclipse.swt.graphics.Point; 10 | import org.eclipse.swt.layout.GridData; 11 | import org.eclipse.swt.layout.GridLayout; 12 | import org.eclipse.swt.widgets.Button; 13 | import org.eclipse.swt.widgets.Composite; 14 | import org.eclipse.swt.widgets.Control; 15 | import org.eclipse.swt.widgets.Label; 16 | import org.eclipse.swt.widgets.Shell; 17 | import ru.yanygin.clusterAdminLibrary.Server; 18 | 19 | /** Диалог удаления информационной базы. */ 20 | public class DropInfobaseDialog extends Dialog { 21 | 22 | private Server server; 23 | private UUID clusterId; 24 | private UUID infobaseId; 25 | private int databaseDropMode; 26 | 27 | /** 28 | * Create the dialog. 29 | * 30 | * @param parentShell - parent shell 31 | * @param server - server parameters 32 | * @param clusterId - cluster ID 33 | * @param infobaseId - infobase ID 34 | */ 35 | public DropInfobaseDialog(Shell parentShell, Server server, UUID clusterId, UUID infobaseId) { 36 | super(parentShell); 37 | setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); 38 | 39 | this.server = server; 40 | this.clusterId = clusterId; 41 | this.infobaseId = infobaseId; 42 | } 43 | 44 | @Override 45 | protected void configureShell(Shell newShell) { 46 | super.configureShell(newShell); 47 | newShell.setText(Strings.TITLE_WINDOW); 48 | } 49 | 50 | /** 51 | * Create contents of the dialog. 52 | * 53 | * @param parent - parent composite 54 | */ 55 | @Override 56 | protected Control createDialogArea(Composite parent) { 57 | 58 | Composite container = (Composite) super.createDialogArea(parent); 59 | GridLayout gridLayout = (GridLayout) container.getLayout(); 60 | gridLayout.numColumns = 2; 61 | 62 | Label lblInfo = new Label(container, SWT.WRAP); 63 | GridData gdlblInfo = new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1); 64 | gdlblInfo.heightHint = 34; 65 | lblInfo.setLayoutData(gdlblInfo); 66 | lblInfo.setText(Strings.DROP_INFOBASE_DESCRIPTION); 67 | new Label(container, SWT.NONE); 68 | 69 | Button btnNotDelete = new Button(container, SWT.RADIO); 70 | btnNotDelete.setText(Strings.LEAVE_DATABASE_UNCHANGED); 71 | btnNotDelete.addSelectionListener( 72 | new SelectionAdapter() { 73 | @Override 74 | public void widgetSelected(SelectionEvent e) { 75 | databaseDropMode = 0; 76 | } 77 | }); 78 | new Label(container, SWT.NONE); 79 | 80 | Button btnDeleteTheDatabase = new Button(container, SWT.RADIO); 81 | btnDeleteTheDatabase.setText(Strings.DELETE_THE_ENTIRE_DATABASE); 82 | btnDeleteTheDatabase.addSelectionListener( 83 | new SelectionAdapter() { 84 | @Override 85 | public void widgetSelected(SelectionEvent e) { 86 | databaseDropMode = 1; 87 | } 88 | }); 89 | new Label(container, SWT.NONE); 90 | 91 | Button btnClearTheDatabase = new Button(container, SWT.RADIO); 92 | btnClearTheDatabase.setText(Strings.CLEAR_THE_DATABASE); 93 | btnClearTheDatabase.addSelectionListener( 94 | new SelectionAdapter() { 95 | @Override 96 | public void widgetSelected(SelectionEvent e) { 97 | databaseDropMode = 2; 98 | } 99 | }); 100 | 101 | return container; 102 | } 103 | 104 | private void runRemoveInfobase() { 105 | 106 | if (server.dropInfoBase(clusterId, infobaseId, databaseDropMode)) { 107 | close(); 108 | } 109 | } 110 | 111 | /** 112 | * Create contents of the button bar. 113 | * 114 | * @param parent - parent composite 115 | */ 116 | @Override 117 | protected void createButtonsForButtonBar(Composite parent) { 118 | Button button = 119 | createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.OK_LABEL, true); 120 | button.addSelectionListener( 121 | new SelectionAdapter() { 122 | @Override 123 | public void widgetSelected(SelectionEvent e) { 124 | runRemoveInfobase(); 125 | } 126 | }); 127 | 128 | createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); 129 | } 130 | 131 | private static class Strings { 132 | 133 | static final String TITLE_WINDOW = getString("TitleDropInfobaseParameters"); 134 | static final String DROP_INFOBASE_DESCRIPTION = getString("DropInfobaseDescription"); 135 | static final String LEAVE_DATABASE_UNCHANGED = getString("LeaveDatabaseUnchanged"); 136 | static final String DELETE_THE_ENTIRE_DATABASE = getString("DeleteTheEntireDatabase"); 137 | static final String CLEAR_THE_DATABASE = getString("ClearTheDatabase"); 138 | 139 | static String getString(String key) { 140 | return Messages.getString("InfobaseDialog." + key); //$NON-NLS-1$ 141 | } 142 | } 143 | 144 | @Override 145 | protected Point getInitialSize() { 146 | return new Point(500, 230); 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/ConnectionInfoExtended.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import com._1c.v8.ibis.admin.IInfoBaseConnectionShort; 4 | import com._1c.v8.ibis.admin.IWorkingProcessInfo; 5 | import java.util.UUID; 6 | import org.eclipse.swt.graphics.Image; 7 | import org.eclipse.swt.widgets.TabItem; 8 | import org.eclipse.swt.widgets.Table; 9 | import ru.yanygin.clusterAdminLibrary.CellValue.CELL_VALUE_TYPE; 10 | 11 | /** Расширенная информация для соединения. */ 12 | public class ConnectionInfoExtended extends BaseInfoExtended { 13 | 14 | private static final String TITLE_INFOBASE = "SessionInfo.Infobase"; //$NON-NLS-1$ 15 | private static final String TITLE_CONNECTION = "ConnectionInfo.Connection"; //$NON-NLS-1$ 16 | private static final String TITLE_SESSION = "ConnectionInfo.Session"; //$NON-NLS-1$ 17 | private static final String TITLE_COMPUTER = "SessionInfo.Computer"; //$NON-NLS-1$ 18 | private static final String TITLE_APPLICATION = "SessionInfo.Application"; //$NON-NLS-1$ 19 | private static final String TITLE_SERVER = "SessionInfo.Server"; //$NON-NLS-1$ 20 | private static final String TITLE_RP_HOST_PORT = "ConnectionInfo.RpHostPort"; //$NON-NLS-1$ 21 | private static final String TITLE_CONNECTED_AT = "ConnectionInfo.ConnectedAt"; //$NON-NLS-1$ 22 | 23 | private static Config commonConfig = Config.currentConfig; 24 | private static ColumnProperties columnProperties = 25 | commonConfig.getColumnsProperties(ConnectionInfoExtended.class); 26 | 27 | private static final String DEFAULT_ICON_FILENAME = "connection.png"; 28 | private static Image defaultIcon; 29 | 30 | private static final String TAB_TEXT_TEMPLATE = 31 | Messages.getString("TabText.ConnectionsCount"); //$NON-NLS-1$ 32 | 33 | private static TabItem currentTab; 34 | private static int itemCount; 35 | 36 | private IInfoBaseConnectionShort connectionInfo; 37 | 38 | /** 39 | * Создание расширенной информации для соединения. 40 | * 41 | * @param server - server 42 | * @param clusterId - cluster ID 43 | * @param connectionInfo - connection info 44 | */ 45 | public ConnectionInfoExtended( 46 | Server server, UUID clusterId, IInfoBaseConnectionShort connectionInfo) { 47 | 48 | this.server = server; 49 | this.clusterId = clusterId; 50 | this.connectionInfo = connectionInfo; 51 | this.currentIcon = defaultIcon; 52 | 53 | computeExtendedInfoData(); 54 | } 55 | 56 | protected void computeExtendedInfoData() { 57 | 58 | String infobaseName = ""; //$NON-NLS-1$ 59 | String wpHostName = ""; //$NON-NLS-1$ 60 | String wpPort = ""; //$NON-NLS-1$ 61 | 62 | if (!connectionInfo.getInfoBaseId().equals(Helper.EMPTY_UUID)) { 63 | infobaseName = server.getInfoBaseName(clusterId, connectionInfo.getInfoBaseId()); 64 | } 65 | 66 | IWorkingProcessInfo workingProcess = 67 | server.getWorkingProcessInfo(clusterId, connectionInfo.getWorkingProcessId()); 68 | 69 | if (workingProcess != null) { 70 | wpHostName = workingProcess.getHostName(); 71 | wpPort = Integer.toString(workingProcess.getMainPort()); 72 | } 73 | 74 | columnProperties.prepareDataMap(data); 75 | 76 | putData(TITLE_INFOBASE, infobaseName, CELL_VALUE_TYPE.TEXT); 77 | putData(TITLE_CONNECTION, connectionInfo.getConnId(), CELL_VALUE_TYPE.INT); 78 | putData(TITLE_SESSION, connectionInfo.getSessionNumber(), CELL_VALUE_TYPE.INT); 79 | putData(TITLE_COMPUTER, connectionInfo.getHost(), CELL_VALUE_TYPE.TEXT); 80 | putData(TITLE_APPLICATION, getApplicationName(), CELL_VALUE_TYPE.TEXT); 81 | putData(TITLE_SERVER, wpHostName, CELL_VALUE_TYPE.TEXT); 82 | putData(TITLE_RP_HOST_PORT, wpPort, CELL_VALUE_TYPE.TEXT); 83 | putData(TITLE_CONNECTED_AT, connectionInfo.getConnectedAt(), CELL_VALUE_TYPE.DATE); 84 | 85 | } 86 | 87 | @Override 88 | public void addToTable(Table table, int index) { 89 | createTableItem(table, index, connectionInfo.getConnectedAt()); 90 | } 91 | 92 | /** 93 | * Получение ConnectionInfo. 94 | * 95 | * @return the ConnectionInfo 96 | */ 97 | public IInfoBaseConnectionShort getConnectionInfo() { 98 | return connectionInfo; 99 | } 100 | 101 | private String getApplicationName() { 102 | return server.getApplicationName(connectionInfo.getApplication()); 103 | } 104 | 105 | /** Инициализация имен колонок. */ 106 | protected static void initColumnsName() { 107 | 108 | columnProperties.addColumnsInMap( 109 | TITLE_INFOBASE, 110 | TITLE_CONNECTION, 111 | TITLE_SESSION, 112 | TITLE_COMPUTER, 113 | TITLE_APPLICATION, 114 | TITLE_SERVER, 115 | TITLE_RP_HOST_PORT, 116 | TITLE_CONNECTED_AT); 117 | 118 | defaultIcon = Helper.getImage(DEFAULT_ICON_FILENAME); 119 | } 120 | 121 | /** 122 | * Обновление заголовка вкладки. 123 | * 124 | * @param count - количество элементов 125 | */ 126 | protected static void updateTabText(int count) { 127 | itemCount = count; 128 | currentTab.setText(String.format(TAB_TEXT_TEMPLATE, itemCount)); 129 | } 130 | 131 | /** Сброс заголовка вкладки на неизвестное количество элементов. */ 132 | protected static void resetTabTextCount() { 133 | currentTab.setText(String.format(TAB_TEXT_TEMPLATE, itemCount + "*")); 134 | } 135 | 136 | /** 137 | * Установка связи с вкладкой TabItem. 138 | * 139 | * @param tabitem вкладка Tabitem 140 | */ 141 | protected static void linkTabItem(TabItem tabitem) { 142 | currentTab = tabitem; 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/AuthenticateDialog.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibraryUI; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import org.eclipse.jface.dialogs.Dialog; 6 | import org.eclipse.jface.dialogs.IDialogConstants; 7 | import org.eclipse.swt.SWT; 8 | import org.eclipse.swt.events.SelectionAdapter; 9 | import org.eclipse.swt.events.SelectionEvent; 10 | import org.eclipse.swt.graphics.Point; 11 | import org.eclipse.swt.layout.GridData; 12 | import org.eclipse.swt.layout.GridLayout; 13 | import org.eclipse.swt.widgets.Button; 14 | import org.eclipse.swt.widgets.Combo; 15 | import org.eclipse.swt.widgets.Composite; 16 | import org.eclipse.swt.widgets.Control; 17 | import org.eclipse.swt.widgets.Label; 18 | import org.eclipse.swt.widgets.Shell; 19 | import org.eclipse.swt.widgets.Text; 20 | import ru.yanygin.clusterAdminLibrary.UserPassPair; 21 | 22 | /** Диалог для ввода логина и пароля. */ 23 | public class AuthenticateDialog extends Dialog { 24 | 25 | private UserPassPair currentUserPass; 26 | private List credentials = new ArrayList<>(); 27 | private String authExcpMessage; 28 | private String authTitle; 29 | 30 | private Combo txtUsername; 31 | private Text txtPassword; 32 | 33 | /** 34 | * Создание диалога ввода имени пользователя и пароля. 35 | * 36 | * @param parentShell - parent shell 37 | * @param currentUserPass - текущие имя пользователя и пароль 38 | * @param authTitle - заголовок окна аутентификации 39 | * @param authExcpMessage - ошибка аутентификации для вывода пользователю 40 | * @wbp.parser.constructor 41 | */ 42 | public AuthenticateDialog( 43 | Shell parentShell, UserPassPair currentUserPass, String authTitle, String authExcpMessage) { 44 | super(parentShell); 45 | setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); 46 | 47 | this.currentUserPass = currentUserPass; 48 | this.authTitle = authTitle; 49 | this.authExcpMessage = authExcpMessage; 50 | } 51 | 52 | /** 53 | * Создание диалога ввода имени пользователя и пароля с возможностью выбора пользователя. 54 | * 55 | * @param parentShell - parent shell 56 | * @param userPass - имя пользователя и пароль 57 | * @param authTitle - заголовок окна аутентификации 58 | * @param authExcpMessage - ошибка аутентификации для вывода пользователю 59 | * @param credentials - список сохраненных логин/паролей 60 | */ 61 | public AuthenticateDialog( 62 | Shell parentShell, 63 | UserPassPair userPass, 64 | String authTitle, 65 | String authExcpMessage, 66 | List credentials) { 67 | 68 | this(parentShell, userPass, authTitle, authExcpMessage); 69 | this.credentials = credentials; 70 | } 71 | 72 | @Override 73 | protected void configureShell(Shell newShell) { 74 | newShell.setMinimumSize(new Point(300, 39)); 75 | super.configureShell(newShell); 76 | newShell.setText(authTitle); 77 | } 78 | 79 | /** 80 | * Create contents of the dialog. 81 | * 82 | * @param parent - parent composite 83 | */ 84 | @Override 85 | protected Control createDialogArea(Composite parent) { 86 | 87 | Composite container = (Composite) super.createDialogArea(parent); 88 | GridLayout gridLayout = (GridLayout) container.getLayout(); 89 | gridLayout.numColumns = 2; 90 | 91 | Label lblAuthenticateInfo = new Label(container, SWT.WRAP); 92 | lblAuthenticateInfo.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 2, 1)); 93 | lblAuthenticateInfo.setText(authTitle); 94 | 95 | Label lblUsername = new Label(container, SWT.NONE); 96 | lblUsername.setText(Strings.USERNAME); 97 | 98 | txtUsername = new Combo(container, SWT.NONE); 99 | txtUsername.setToolTipText(Strings.USERNAME); 100 | txtUsername.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 101 | txtUsername.addSelectionListener( 102 | new SelectionAdapter() { 103 | @Override 104 | public void widgetSelected(SelectionEvent e) { 105 | String pass = (String) txtUsername.getData(txtUsername.getText()); 106 | txtPassword.setText(pass); 107 | } 108 | }); 109 | 110 | credentials.forEach( 111 | userpass -> { 112 | txtUsername.add(userpass.getUsername()); 113 | txtUsername.setData(userpass.getUsername(), userpass.getPassword()); 114 | }); 115 | 116 | Label lblPassword = new Label(container, SWT.NONE); 117 | lblPassword.setText(Strings.PASSWORD); 118 | 119 | txtPassword = new Text(container, SWT.BORDER | SWT.PASSWORD); 120 | txtPassword.setToolTipText(Strings.PASSWORD); 121 | txtPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 122 | 123 | Label lblAuthExcpMessage = new Label(container, SWT.WRAP); 124 | lblAuthExcpMessage.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 2, 1)); 125 | lblAuthExcpMessage.setText(authExcpMessage); 126 | 127 | initProperties(); 128 | 129 | return container; 130 | } 131 | 132 | /** 133 | * Получает введенный пользователем логин. 134 | * 135 | * @return логин 136 | */ 137 | public UserPassPair getUserPass() { 138 | return currentUserPass; 139 | } 140 | 141 | private void initProperties() { 142 | this.txtUsername.setText(currentUserPass.getUsername()); 143 | this.txtPassword.setText(currentUserPass.getPassword()); 144 | } 145 | 146 | private void extractVariablesFromControls() { 147 | 148 | currentUserPass = 149 | new UserPassPair( 150 | txtUsername.getText(), txtPassword.getText(), currentUserPass.getDescription()); 151 | } 152 | 153 | /** 154 | * Create contents of the button bar. 155 | * 156 | * @param parent - parent composite 157 | */ 158 | @Override 159 | protected void createButtonsForButtonBar(Composite parent) { 160 | Button button = 161 | createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.OK_LABEL, true); 162 | button.addSelectionListener( 163 | new SelectionAdapter() { 164 | @Override 165 | public void widgetSelected(SelectionEvent e) { 166 | extractVariablesFromControls(); 167 | close(); 168 | } 169 | }); 170 | 171 | createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); 172 | } 173 | 174 | private static class Strings { 175 | 176 | // static final String TITLE_WINDOW = getString("ServerParameters"); 177 | static final String USERNAME = getString("Username"); //$NON-NLS-1$ 178 | static final String PASSWORD = getString("Password"); //$NON-NLS-1$ 179 | 180 | static String getString(String key) { 181 | return Messages.getString("Dialogs." + key); //$NON-NLS-1$ 182 | } 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/LockInfoExtended.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import com._1c.v8.ibis.admin.IInfoBaseConnectionShort; 4 | import com._1c.v8.ibis.admin.IObjectLockInfo; 5 | import com._1c.v8.ibis.admin.ISessionInfo; 6 | import com._1c.v8.ibis.admin.IWorkingProcessInfo; 7 | import java.util.List; 8 | import java.util.UUID; 9 | import org.eclipse.swt.graphics.Image; 10 | import org.eclipse.swt.widgets.TabItem; 11 | import org.eclipse.swt.widgets.Table; 12 | import ru.yanygin.clusterAdminLibrary.CellValue.CELL_VALUE_TYPE; 13 | 14 | /** Расширенная информация для блокировки. */ 15 | public class LockInfoExtended extends BaseInfoExtended { 16 | 17 | private static final String TITLE_DESCRIPTION = "InfoTables.Description"; //$NON-NLS-1$ 18 | private static final String TITLE_INFOBASE = "SessionInfo.Infobase"; //$NON-NLS-1$ 19 | private static final String TITLE_CONNECTION = "ConnectionInfo.Connection"; //$NON-NLS-1$ 20 | private static final String TITLE_SESSION = "ConnectionInfo.Session"; //$NON-NLS-1$ 21 | private static final String TITLE_COMPUTER = "SessionInfo.Computer"; //$NON-NLS-1$ 22 | private static final String TITLE_APPLICATION = "SessionInfo.Application"; //$NON-NLS-1$ 23 | private static final String TITLE_HOSTNAME = "ConnectionInfo.Hostname"; //$NON-NLS-1$ 24 | private static final String TITLE_PORT = "SessionInfo.Port"; //$NON-NLS-1$ 25 | private static final String TITLE_LOCKED_AT = "LockInfo.LockedAt"; //$NON-NLS-1$ 26 | 27 | private static Config commonConfig = Config.currentConfig; 28 | private static ColumnProperties columnProperties = 29 | commonConfig.getColumnsProperties(LockInfoExtended.class); 30 | 31 | private static final String DEFAULT_ICON_FILENAME = "lock_16.png"; 32 | private static Image defaultIcon; 33 | 34 | private static final String TAB_TEXT_TEMPLATE = 35 | Messages.getString("TabText.LocksCount"); //$NON-NLS-1$ 36 | 37 | private static TabItem currentTab; 38 | private static int itemCount; 39 | 40 | private IObjectLockInfo lockInfo; 41 | private List sessionsInfo; 42 | private List connections; 43 | 44 | /** 45 | * Создание расширенной информации для блокировки. 46 | * 47 | * @param server - server 48 | * @param clusterId - cluster ID 49 | * @param lockInfo - lock info 50 | */ 51 | public LockInfoExtended(Server server, UUID clusterId, IObjectLockInfo lockInfo) { 52 | 53 | this.server = server; 54 | this.clusterId = clusterId; 55 | 56 | this.lockInfo = lockInfo; 57 | this.sessionsInfo = server.getSessions(clusterId); 58 | this.currentIcon = defaultIcon; 59 | 60 | computeExtendedInfoData(); 61 | } 62 | 63 | protected void computeExtendedInfoData() { 64 | 65 | var connectionNumber = ""; //$NON-NLS-1$ 66 | var sessionNumber = ""; //$NON-NLS-1$ 67 | var computerName = ""; //$NON-NLS-1$ 68 | var appName = ""; //$NON-NLS-1$ 69 | var hostName = ""; //$NON-NLS-1$ 70 | var hostPort = ""; //$NON-NLS-1$ 71 | var infobaseName = ""; //$NON-NLS-1$ 72 | 73 | if (!lockInfo.getSid().equals(Helper.EMPTY_UUID)) { 74 | ISessionInfo session = getSessionInfoFromLockConnectionId(lockInfo, sessionsInfo); 75 | if (session != null) { 76 | sessionNumber = Integer.toString(session.getSessionId()); 77 | computerName = session.getHost(); 78 | appName = session.getAppId(); 79 | infobaseName = server.getInfoBaseName(clusterId, session.getInfoBaseId()); 80 | } 81 | 82 | } else if (!lockInfo.getConnectionId().equals(Helper.EMPTY_UUID)) { 83 | IInfoBaseConnectionShort connection = 84 | getConnectionInfoFromLockConnectionId(lockInfo, connections); 85 | 86 | if (connection != null) { 87 | connectionNumber = Integer.toString(connection.getConnId()); 88 | computerName = connection.getHost(); 89 | appName = connection.getApplication(); 90 | infobaseName = server.getInfoBaseName(clusterId, connection.getInfoBaseId()); 91 | 92 | UUID wpId = connection.getWorkingProcessId(); 93 | IWorkingProcessInfo wpInfo = server.getWorkingProcessInfo(clusterId, wpId); 94 | if (wpInfo != null) { 95 | hostName = wpInfo.getHostName(); 96 | hostPort = Integer.toString(wpInfo.getMainPort()); 97 | } 98 | } 99 | } 100 | 101 | columnProperties.prepareDataMap(data); 102 | 103 | putData(TITLE_DESCRIPTION, lockInfo.getLockDescr(), CELL_VALUE_TYPE.TEXT); 104 | putData(TITLE_INFOBASE, infobaseName, CELL_VALUE_TYPE.TEXT); 105 | putData(TITLE_CONNECTION, connectionNumber, CELL_VALUE_TYPE.TEXT); 106 | putData(TITLE_SESSION, sessionNumber, CELL_VALUE_TYPE.TEXT); 107 | putData(TITLE_COMPUTER, computerName, CELL_VALUE_TYPE.TEXT); 108 | putData(TITLE_APPLICATION, server.getApplicationName(appName), CELL_VALUE_TYPE.TEXT); 109 | putData(TITLE_HOSTNAME, hostName, CELL_VALUE_TYPE.TEXT); 110 | putData(TITLE_PORT, hostPort, CELL_VALUE_TYPE.TEXT); 111 | putData(TITLE_LOCKED_AT, lockInfo.getLockedAt(), CELL_VALUE_TYPE.DATE); 112 | } 113 | 114 | @Override 115 | public void addToTable(Table table, int index) { 116 | createTableItem(table, index, lockInfo.getLockedAt()); 117 | } 118 | 119 | /** 120 | * Get LockInfo. 121 | * 122 | * @return the lockInfo 123 | */ 124 | public IObjectLockInfo getLockInfo() { 125 | return lockInfo; 126 | } 127 | 128 | private ISessionInfo getSessionInfoFromLockConnectionId( 129 | IObjectLockInfo lockInfo, List sessionsInfo) { 130 | 131 | for (ISessionInfo session : sessionsInfo) { 132 | if (session.getSid().equals(lockInfo.getSid())) { 133 | return session; 134 | } 135 | } 136 | return null; 137 | } 138 | 139 | private IInfoBaseConnectionShort getConnectionInfoFromLockConnectionId( 140 | IObjectLockInfo lockInfo, List connections) { 141 | 142 | return server.getConnectionInfoShort(clusterId, lockInfo.getConnectionId()); 143 | } 144 | 145 | /** Инициализация имен колонок. */ 146 | protected static void initColumnsName() { 147 | 148 | columnProperties.addColumnsInMap( 149 | TITLE_DESCRIPTION, 150 | TITLE_INFOBASE, 151 | TITLE_CONNECTION, 152 | TITLE_SESSION, 153 | TITLE_COMPUTER, 154 | TITLE_APPLICATION, 155 | TITLE_HOSTNAME, 156 | TITLE_PORT, 157 | TITLE_LOCKED_AT); 158 | 159 | defaultIcon = Helper.getImage(DEFAULT_ICON_FILENAME); 160 | } 161 | 162 | /** 163 | * Обновление заголовка вкладки. 164 | * 165 | * @param count - количество элементов 166 | */ 167 | protected static void updateTabText(int count) { 168 | itemCount = count; 169 | currentTab.setText(String.format(TAB_TEXT_TEMPLATE, itemCount)); 170 | } 171 | 172 | /** Сброс заголовка вкладки на неизвестное количество элементов. */ 173 | protected static void resetTabTextCount() { 174 | currentTab.setText(String.format(TAB_TEXT_TEMPLATE, itemCount + "*")); 175 | } 176 | 177 | /** 178 | * Установка связи с вкладкой TabItem. 179 | * 180 | * @param tabitem вкладка Tabitem 181 | */ 182 | protected static void linkTabItem(TabItem tabitem) { 183 | currentTab = tabitem; 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/AboutDialog.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibraryUI; 2 | 3 | import java.lang.module.ModuleDescriptor.Version; 4 | import org.eclipse.jface.dialogs.Dialog; 5 | import org.eclipse.jface.dialogs.IDialogConstants; 6 | import org.eclipse.swt.SWT; 7 | import org.eclipse.swt.events.SelectionAdapter; 8 | import org.eclipse.swt.events.SelectionEvent; 9 | import org.eclipse.swt.graphics.Point; 10 | import org.eclipse.swt.layout.GridData; 11 | import org.eclipse.swt.program.Program; 12 | import org.eclipse.swt.widgets.Button; 13 | import org.eclipse.swt.widgets.Composite; 14 | import org.eclipse.swt.widgets.Control; 15 | import org.eclipse.swt.widgets.Label; 16 | import org.eclipse.swt.widgets.Link; 17 | import org.eclipse.swt.widgets.Shell; 18 | import org.eclipse.wb.swt.SWTResourceManager; 19 | import ru.yanygin.clusterAdminLibrary.Config; 20 | import ru.yanygin.clusterAdminLibrary.Helper; 21 | 22 | /** Диалог "О программе". */ 23 | public class AboutDialog extends Dialog { 24 | 25 | private static final String SEGOE_FONT = "Segoe UI"; //$NON-NLS-1$ 26 | private static final String GITHUB_LINK = 27 | "https://github.com/YanSergey/OneS_ClusterAdmin"; //$NON-NLS-1$ 28 | private static final String TELEGRAM_LINK = "https://t.me/YanSergey"; //$NON-NLS-1$ 29 | private static final String EMAIL_LINK = "mailto:yanyginsa@gmail.com"; //$NON-NLS-1$ 30 | 31 | Config config = Config.currentConfig; 32 | 33 | private Link linkLatestVersion; 34 | 35 | /** 36 | * Create the dialog. 37 | * 38 | * @param parentShell - parent shell 39 | */ 40 | public AboutDialog(Shell parentShell) { 41 | super(parentShell); 42 | setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); 43 | } 44 | 45 | @Override 46 | protected void configureShell(Shell newShell) { 47 | super.configureShell(newShell); 48 | newShell.setText(Strings.TITLE_WINDOW); 49 | } 50 | 51 | /** 52 | * Create contents of the dialog. 53 | * 54 | * @param parent - parent composite 55 | */ 56 | @Override 57 | protected Control createDialogArea(Composite parent) { 58 | 59 | Composite container = (Composite) super.createDialogArea(parent); 60 | 61 | Label lblMainTitle = new Label(container, SWT.NONE); 62 | lblMainTitle.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1)); 63 | lblMainTitle.setFont(SWTResourceManager.getFont(SEGOE_FONT, 20, SWT.BOLD)); 64 | lblMainTitle.setText(Strings.MAIN_TITLE); 65 | 66 | Label lblDescription = new Label(container, SWT.NONE); 67 | lblDescription.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); 68 | lblDescription.setText(Strings.DESCRIPTION); 69 | lblDescription.setFont(SWTResourceManager.getFont(SEGOE_FONT, 10, SWT.NORMAL)); 70 | 71 | Link linkCurrentVersion = new Link(container, 0); 72 | linkCurrentVersion.setFont(SWTResourceManager.getFont(SEGOE_FONT, 10, SWT.NORMAL)); 73 | linkCurrentVersion.setText(String.format(Strings.CURRENT_VERSION, config.getCurrentVersion())); 74 | 75 | linkLatestVersion = new Link(container, 0); 76 | linkLatestVersion.setText(Strings.CURRENT_VERSION_IS_UNKNOWN); 77 | linkLatestVersion.addSelectionListener(downloadLatestVersionListener); 78 | makeLatestVersionTitle(); 79 | 80 | Label lblAutor = new Label(container, SWT.NONE); 81 | lblAutor.setText(Strings.AUTOR); 82 | 83 | Link linkGitHub = new Link(container, SWT.NONE); 84 | linkGitHub.setText(Strings.GITHUB_DESCRIPTION); 85 | linkGitHub.addSelectionListener(goToLinkListener); 86 | 87 | Link linkTelegram = new Link(container, 0); 88 | linkTelegram.setText(Strings.TELEGRAM_DESCRIPTION); 89 | linkTelegram.addSelectionListener(goToLinkListener); 90 | 91 | Link linkEmail = new Link(container, 0); 92 | linkEmail.setText(Strings.EMAIL_DESCRIPTION); 93 | linkEmail.addSelectionListener(goToLinkListener); 94 | 95 | Link linkBoosty = new Link(container, 0); 96 | linkBoosty.setText(Strings.BOOSTY_DESCRIPTION); 97 | linkBoosty.addSelectionListener(goToLinkListener); 98 | 99 | return container; 100 | } 101 | 102 | private void makeLatestVersionTitle() { 103 | 104 | final Version currentVersion = config.getCurrentVersion(); 105 | final Version latestVersion = config.getLatestVersion(); 106 | 107 | if (latestVersion == null) { 108 | linkLatestVersion.setText(Strings.CURRENT_VERSION_IS_UNKNOWN); 109 | } else if (currentVersion.equals(latestVersion) 110 | || currentVersion.compareTo(latestVersion) > 0) { 111 | linkLatestVersion.setText(Strings.CURRENT_VERSION_IS_LATEST); 112 | } else { 113 | linkLatestVersion.setText(String.format(Strings.CURRENT_VERSION_IS_OLD, latestVersion)); 114 | } 115 | } 116 | 117 | /** 118 | * Create contents of the button bar. 119 | * 120 | * @param parent - parent composite 121 | */ 122 | @Override 123 | protected void createButtonsForButtonBar(Composite parent) { 124 | Button button = 125 | createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); 126 | button.addSelectionListener( 127 | new SelectionAdapter() { 128 | @Override 129 | public void widgetSelected(SelectionEvent e) { 130 | close(); 131 | } 132 | }); 133 | } 134 | 135 | SelectionAdapter downloadLatestVersionListener = 136 | new SelectionAdapter() { 137 | @Override 138 | public void widgetSelected(SelectionEvent e) { 139 | if (config.getLatestVersion() == null) { 140 | config.readUpstreamVersion(); 141 | makeLatestVersionTitle(); 142 | } else { 143 | config.runDownloadRelease(getParentShell()); 144 | } 145 | } 146 | }; 147 | 148 | SelectionAdapter goToLinkListener = 149 | new SelectionAdapter() { 150 | @Override 151 | public void widgetSelected(SelectionEvent e) { 152 | Program.launch(e.text); 153 | } 154 | }; 155 | 156 | private static class Strings { 157 | 158 | static final String TITLE_WINDOW = getString("TitleDialog"); 159 | static final String MAIN_TITLE = getString("MainTitle"); 160 | 161 | static final String CURRENT_VERSION = getString("CurrentVersion"); 162 | static final String CURRENT_VERSION_IS_LATEST = getString("CurrentVersionIsLatest"); 163 | static final String CURRENT_VERSION_IS_OLD = getString("CurrentVersionIsOld"); 164 | static final String CURRENT_VERSION_IS_UNKNOWN = getString("CurrentVersionIsUnknown"); 165 | 166 | static final String DESCRIPTION = getString("Description"); 167 | static final String AUTOR = getString("Autor"); 168 | static final String GITHUB_DESCRIPTION = 169 | String.format(getString("GitHub_Description"), GITHUB_LINK); 170 | static final String TELEGRAM_DESCRIPTION = 171 | String.format(getString("Telegram_Description"), TELEGRAM_LINK); 172 | static final String EMAIL_DESCRIPTION = 173 | String.format(getString("Email_Description"), EMAIL_LINK); 174 | static final String BOOSTY_DESCRIPTION = 175 | String.format(getString("Boosty_Description"), Helper.BOOSTY_LINK); 176 | 177 | static String getString(String key) { 178 | return Messages.getString("AboutDialog." + key); //$NON-NLS-1$ 179 | } 180 | } 181 | 182 | @Override 183 | protected Point getInitialSize() { 184 | return new Point(500, 418); 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/AssignmentRuleLabelProvider.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import com._1c.v8.ibis.admin.IAssignmentRuleInfo; 4 | import java.util.Arrays; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | import org.eclipse.jface.viewers.ColumnLabelProvider; 8 | 9 | /** Провайдер требований назначения функциональности. */ 10 | public class AssignmentRuleLabelProvider extends ColumnLabelProvider { 11 | 12 | private static final String NUMBER = "AssignmentRule.Number"; 13 | private static final String OBJECT_TYPE = "AssignmentRule.ObjectType"; 14 | private static final String RULE_TYPE = "AssignmentRule.RuleType"; 15 | private static final String INFOBASE_NAME = "AssignmentRule.InfoBaseName"; 16 | private static final String APPLICATION_EXT = "AssignmentRule.ApplicationExt"; 17 | private static final String PRIORITY = "AssignmentRule.Priority"; 18 | 19 | private static Config commonConfig = Config.currentConfig; 20 | private static ColumnProperties columnProperties = 21 | commonConfig.getColumnsProperties(IAssignmentRuleInfo.class); 22 | 23 | private String columnName; 24 | 25 | public static final String RULE_TYPE_DO_NOT_ASSIGN = 26 | Messages.getString("AssignmentRule.RuleType.DoNotAssign"); // "Не назначать" = 0 27 | public static final String RULE_TYPE_AUTO = 28 | Messages.getString("AssignmentRule.RuleType.Auto"); // "Авто" = 1 29 | public static final String RULE_TYPE_ASSIGN = 30 | Messages.getString("AssignmentRule.RuleType.Assign"); // "Назначать" = 2 31 | 32 | static final String[] ruleType = {RULE_TYPE_DO_NOT_ASSIGN, RULE_TYPE_AUTO, RULE_TYPE_ASSIGN}; 33 | static final Map objectTypes = fillObjectType(); 34 | 35 | public AssignmentRuleLabelProvider(String columnName) { 36 | this.columnName = columnName; 37 | } 38 | 39 | private static Map fillObjectType() { 40 | 41 | Map objectTypes = new HashMap<>(); 42 | objectTypes.put("", Messages.getString("AssignmentRule.ObjectType.ForAll")); 43 | 44 | String[] ruleKeys = { 45 | "Connection", 46 | "ClientTestingService", 47 | "SessionDataService", 48 | "DataEditLockService", 49 | "JobService", 50 | "ExternalDataSourceXMLAService", 51 | "ExternalSessionManagerService", 52 | "EventLogService", 53 | "TimestampService", 54 | "AuxiliaryService", 55 | "ExternalDataSourceODBCService", 56 | "OpenID2ProviderContextService", 57 | "SessionReuseService", 58 | "TransactionLockService", 59 | "LicenseService", 60 | "FulltextSearchService", 61 | "SettingsService", 62 | "NumerationService", 63 | "DataBaseConfigurationUpdateService", 64 | "DatabaseTableNumberingService", 65 | "CounterService", 66 | 67 | // доступны с версии платформы, где добавлен дата акселератор (?) 68 | "DbCopiesTimeService", 69 | "GetSessionsService", 70 | "IntegrationDataService", 71 | "DbCopiesService", 72 | "DataAcceleratorService" 73 | }; 74 | Arrays.sort(ruleKeys); 75 | 76 | for (String ruleKey : ruleKeys) { 77 | objectTypes.put(ruleKey, Messages.getString("AssignmentRule.ObjectType." + ruleKey)); 78 | } 79 | return objectTypes; 80 | } 81 | 82 | /** Возвращает возможные значения доп. параметров. */ 83 | public static String[] getApplicationExtValues() { 84 | String[] appExtValues = { 85 | "Designer", 86 | "1CV8", 87 | "1CV8C", 88 | "1CV8CDirect", 89 | "WebClient", 90 | "COMConnection", 91 | "WSConnection", 92 | "HTTPServiceConnection", 93 | "ODataConnection", 94 | "BotConnection", 95 | "WebServerExtension", 96 | "MobileClient", 97 | "AnalyticsSystemClient", 98 | "AnalyticsSystemQuery", 99 | "BackgroundJob.ScheduledJob.<Имя объекта конфигурации>", 100 | "BackgroundJob.CommonModule", 101 | "BackgroundJob.CommonModule.<Имя модуля>.<Имя метода>", 102 | "BackgroundJob.FullTextSearchIndexUpdate", 103 | "BackgroundJob.GenerateReport.<Полное имя объекта конфигурации>", 104 | "BackgroundJob.InputByString.<Полное имя объекта конфигурации>", 105 | "BackgroundJob.DynamicListSearch.<Полное имя формы>.<Имя таблицы формы связанной со списком>", 106 | "BackgroundJob.DBCopiesFilling", 107 | "BackgroundJob.DBCopiesNotification", 108 | "BackgroundJob.UpdateDataHistoryImmediatelyAfterWrite", 109 | "BackgroundJob.AfterWriteDataHistoryVersionsProcessing", 110 | "BackgroundJob.GlobalSearchFunctionsMenu", 111 | "BackgroundJob.GlobalSearchFullTextSearch", 112 | "BackgroundJob.GlobalSearchHelp", 113 | "BackgroundJob.GlobalSearchAllFunctions", 114 | "BackgroundJob.GlobalSearch.<имя модуля>.<имя метода>", 115 | "BackgroundJob.IntegrationServiceReceivedMessagesProcessing.<Полное имя канала сервиса интеграции>", 116 | "SystemBackgroundJob.DBConfigUpdate", 117 | "SystemBackgroundJob.RecalcTotals", 118 | "BackgroundJob.SendIntegrationSystemMessagesQueueProcessing.<полное имя сервиса интеграции>", 119 | "BackgroundJob.ReceiveIntegrationSystemMessagesQueueProcessing.<полное имя сервиса интеграции>", 120 | "BackgroundJob.ReceivingIntegrationSystemMessages.<полное имя сервиса интеграции>", 121 | "BackgroundJob.ReceivedIntegrationSystemMessagesProcessing.<полное имя канала сервиса интеграции>", 122 | "BackgroundJob.StandaloneExchange" 123 | }; 124 | return appExtValues; 125 | } 126 | 127 | private static void putObjectType(Map objectTypes, String key) { 128 | objectTypes.put(key, Messages.getString("AssignmentRule.ObjectType." + key)); 129 | } 130 | 131 | public static Map getObjectTypes() { 132 | return objectTypes; 133 | } 134 | 135 | public static String getObjectType(String key) { 136 | return objectTypes.getOrDefault(key, "unknown"); 137 | } 138 | 139 | @Override 140 | public String getText(Object element) { 141 | if (!(element instanceof IAssignmentRuleInfo)) { 142 | return null; 143 | } 144 | return String.valueOf(getValue(element)); 145 | } 146 | 147 | /** 148 | * Возвращает наименование правила ТНФ. 149 | * 150 | * @param element - элемент, для которого нужно вернуть наименование ТНФ 151 | */ 152 | public Object getValue(Object element) { 153 | if (!(element instanceof IAssignmentRuleInfo)) { 154 | return null; 155 | } 156 | IAssignmentRuleInfo rule = (IAssignmentRuleInfo) element; 157 | 158 | switch (columnName) { 159 | case NUMBER: 160 | return AssignmentRuleContentProvider.getRuleNumber(rule); 161 | case OBJECT_TYPE: 162 | return objectTypes.getOrDefault(rule.getObjectType(), "unknown"); 163 | case RULE_TYPE: 164 | return ruleType[rule.getRuleType()]; 165 | case INFOBASE_NAME: 166 | return rule.getInfoBaseName(); 167 | case APPLICATION_EXT: 168 | return rule.getApplicationExt(); 169 | case PRIORITY: 170 | return rule.getPriority(); 171 | default: 172 | return "UnknownColumn"; 173 | } 174 | } 175 | 176 | /** Инициализация имен колонок. */ 177 | protected static void initColumnsName() { 178 | columnProperties.addColumnsInMap( 179 | OBJECT_TYPE, RULE_TYPE, INFOBASE_NAME, APPLICATION_EXT, NUMBER, PRIORITY); 180 | } 181 | 182 | private static class Strings { 183 | 184 | static String getString(String key) { 185 | return Messages.getString("AssignmentRule." + key); // $NON-NLS-1$ 186 | } 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/WorkingServerInfoExtended.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import com._1c.v8.ibis.admin.IPortRangeInfo; 4 | import com._1c.v8.ibis.admin.IWorkingServerInfo; 5 | import java.util.UUID; 6 | import org.eclipse.swt.graphics.Image; 7 | import org.eclipse.swt.widgets.TabItem; 8 | import org.eclipse.swt.widgets.Table; 9 | import ru.yanygin.clusterAdminLibrary.CellValue.CELL_VALUE_TYPE; 10 | 11 | /** Расширенная информация для рабочего сервера. */ 12 | public class WorkingServerInfoExtended extends BaseInfoExtended { 13 | 14 | private static final String TITLE_DESCRIPTION = "InfoTables.Description"; //$NON-NLS-1$ 15 | private static final String TITLE_COMPUTER = "SessionInfo.Computer"; //$NON-NLS-1$ 16 | private static final String TITLE_IP_PORT = "WSInfo.IPPort"; //$NON-NLS-1$ 17 | private static final String TITLE_RANGE_IP_PORTS = "WSInfo.RangeIPPorts"; //$NON-NLS-1$ 18 | private static final String TITLE_SAFE_WORKING_PROCESSES_MEMORY_LIMIT = "WSInfo.SafeWorkingProcessesMemoryLimit"; //$NON-NLS-1$ 19 | private static final String TITLE_SAFE_CALL_MEMORY_LIMIT = "WSInfo.SafeCallMemoryLimit"; //$NON-NLS-1$ 20 | private static final String TITLE_WORKING_PROCESS_MEMORY_LIMIT = "WSInfo.WorkingProcessMemoryLimit"; //$NON-NLS-1$ 21 | private static final String TITLE_CRITICAL_PROCESSES_TOTAL_MEMORY = "WSInfo.CriticalProcessesTotalMemory"; //$NON-NLS-1$ 22 | private static final String TITLE_TEMP_ALLOWED_PROC_TOTAL_MEMORY = "WSInfo.TemporaryAllowedProcessesTotalMemory"; //$NON-NLS-1$ 23 | private static final String TITLE_TEMP_ALLOWED_PROC_TOTAL_MEMORY_TIME_LIMIT = "WSInfo.TemporaryAllowedProcessesTotalMemoryTimeLimit"; //$NON-NLS-1$ 24 | private static final String TITLE_IB_PER_PROCESS_LIMIT = "WSInfo.IBPerProcessLimit"; //$NON-NLS-1$ 25 | private static final String TITLE_CONN_PER_PROCESS_LIMIT = "WSInfo.ConnPerProcessLimit"; //$NON-NLS-1$ 26 | private static final String TITLE_IP_PORT_MAIN_MANAGER = "WSInfo.IPPortMainManager"; //$NON-NLS-1$ 27 | private static final String TITLE_DEDICATED_MANAGERS = "WSInfo.DedicatedManagers"; //$NON-NLS-1$ 28 | private static final String TITLE_MAIN_SERVER = "WSInfo.MainServer"; //$NON-NLS-1$ 29 | 30 | private static Config commonConfig = Config.currentConfig; 31 | private static ColumnProperties columnProperties = 32 | commonConfig.getColumnsProperties(WorkingServerInfoExtended.class); 33 | 34 | private static final String DEFAULT_ICON_FILENAME = "working_server_24.png"; 35 | private static Image defaultIcon; 36 | 37 | private static final String TAB_TEXT_TEMPLATE = 38 | Messages.getString("TabText.WorkingServersCount"); //$NON-NLS-1$ 39 | 40 | private static TabItem currentTab; 41 | private static int itemCount; 42 | 43 | IWorkingServerInfo workingServerInfo; 44 | 45 | /** 46 | * Создание расширенной информации для рабочего сервера. 47 | * 48 | * @param server - server 49 | * @param clusterId - cluster ID 50 | * @param workingServer - working server info 51 | */ 52 | public WorkingServerInfoExtended( 53 | Server server, UUID clusterId, IWorkingServerInfo workingServer) { 54 | 55 | this.server = server; 56 | this.clusterId = clusterId; 57 | this.workingServerInfo = workingServer; 58 | this.currentIcon = defaultIcon; 59 | 60 | computeExtendedInfoData(); 61 | } 62 | 63 | protected void computeExtendedInfoData() { 64 | 65 | columnProperties.prepareDataMap(data); 66 | 67 | putData(TITLE_DESCRIPTION, workingServerInfo.getName(), CELL_VALUE_TYPE.TEXT); 68 | putData(TITLE_COMPUTER, workingServerInfo.getHostName(), CELL_VALUE_TYPE.TEXT); 69 | putData(TITLE_IP_PORT, workingServerInfo.getMainPort(), CELL_VALUE_TYPE.INT); 70 | putData(TITLE_RANGE_IP_PORTS, getPortRange(), CELL_VALUE_TYPE.TEXT); 71 | putData( 72 | TITLE_SAFE_WORKING_PROCESSES_MEMORY_LIMIT, 73 | workingServerInfo.getSafeWorkingProcessesMemoryLimit(), 74 | CELL_VALUE_TYPE.LONG_GROUP); 75 | putData( 76 | TITLE_SAFE_CALL_MEMORY_LIMIT, 77 | workingServerInfo.getSafeCallMemoryLimit(), 78 | CELL_VALUE_TYPE.LONG_GROUP); 79 | putData( 80 | TITLE_WORKING_PROCESS_MEMORY_LIMIT, 81 | workingServerInfo.getWorkingProcessMemoryLimit(), 82 | CELL_VALUE_TYPE.LONG_GROUP); 83 | putData( 84 | TITLE_CRITICAL_PROCESSES_TOTAL_MEMORY, 85 | workingServerInfo.getCriticalProcessesTotalMemory(), 86 | CELL_VALUE_TYPE.LONG_GROUP); 87 | putData( 88 | TITLE_TEMP_ALLOWED_PROC_TOTAL_MEMORY, 89 | workingServerInfo.getTemporaryAllowedProcessesTotalMemory(), 90 | CELL_VALUE_TYPE.LONG_GROUP); 91 | putData( 92 | TITLE_TEMP_ALLOWED_PROC_TOTAL_MEMORY_TIME_LIMIT, 93 | workingServerInfo.getTemporaryAllowedProcessesTotalMemoryTimeLimit(), 94 | CELL_VALUE_TYPE.LONG_GROUP); 95 | putData( 96 | TITLE_IB_PER_PROCESS_LIMIT, 97 | workingServerInfo.getInfoBasesPerWorkingProcessLimit(), 98 | CELL_VALUE_TYPE.INT); 99 | putData( 100 | TITLE_CONN_PER_PROCESS_LIMIT, 101 | workingServerInfo.getConnectionsPerWorkingProcessLimit(), 102 | CELL_VALUE_TYPE.INT); 103 | putData(TITLE_IP_PORT_MAIN_MANAGER, workingServerInfo.getClusterMainPort(), CELL_VALUE_TYPE.INT); 104 | putData(TITLE_DEDICATED_MANAGERS, workingServerInfo.isDedicatedManagers(), CELL_VALUE_TYPE.BOOLEAN); 105 | putData(TITLE_MAIN_SERVER, workingServerInfo.isMainServer(), CELL_VALUE_TYPE.BOOLEAN); 106 | } 107 | 108 | @Override 109 | public void addToTable(Table table, int index) { 110 | createTableItem(table, index, null); 111 | } 112 | 113 | private String getPortRange() { 114 | IPortRangeInfo portRangesInfo = workingServerInfo.getPortRanges().get(0); 115 | return Integer.toString(portRangesInfo.getLowBound()) 116 | .concat(":") //$NON-NLS-1$ 117 | .concat(Integer.toString(portRangesInfo.getHighBound())); 118 | } 119 | 120 | /** 121 | * Получение строки заголовка узла рабочих серверов. 122 | * 123 | * @param count - количество элементов 124 | * @return строку с текстом заголовка 125 | */ 126 | public static String getNodeTitle(int count) { 127 | return String.format(TAB_TEXT_TEMPLATE, count); 128 | } 129 | 130 | /** 131 | * Получение UUID рабочего сервера. 132 | * 133 | * @return UUID рабочего сервера 134 | */ 135 | public UUID getWorkingServerId() { 136 | return workingServerInfo.getWorkingServerId(); 137 | } 138 | 139 | /** Инициализация имен колонок. */ 140 | protected static void initColumnsName() { 141 | 142 | columnProperties.addColumnsInMap( 143 | TITLE_DESCRIPTION, 144 | TITLE_COMPUTER, 145 | TITLE_IP_PORT, 146 | TITLE_RANGE_IP_PORTS, 147 | TITLE_SAFE_WORKING_PROCESSES_MEMORY_LIMIT, 148 | TITLE_SAFE_CALL_MEMORY_LIMIT, 149 | TITLE_WORKING_PROCESS_MEMORY_LIMIT, 150 | TITLE_CRITICAL_PROCESSES_TOTAL_MEMORY, 151 | TITLE_TEMP_ALLOWED_PROC_TOTAL_MEMORY, 152 | TITLE_TEMP_ALLOWED_PROC_TOTAL_MEMORY_TIME_LIMIT, 153 | TITLE_IB_PER_PROCESS_LIMIT, 154 | TITLE_CONN_PER_PROCESS_LIMIT, 155 | TITLE_IP_PORT_MAIN_MANAGER, 156 | TITLE_DEDICATED_MANAGERS, 157 | TITLE_MAIN_SERVER); 158 | 159 | defaultIcon = Helper.getImage(DEFAULT_ICON_FILENAME); 160 | } 161 | 162 | /** 163 | * Обновление заголовка вкладки. 164 | * 165 | * @param count - количество элементов 166 | */ 167 | protected static void updateTabText(int count) { 168 | itemCount = count; 169 | currentTab.setText(String.format(TAB_TEXT_TEMPLATE, itemCount)); 170 | } 171 | 172 | /** Сброс заголовка вкладки на неизвестное количество элементов. */ 173 | protected static void resetTabTextCount() { 174 | currentTab.setText(String.format(TAB_TEXT_TEMPLATE, itemCount + "*")); 175 | } 176 | 177 | /** 178 | * Установка связи с вкладкой TabItem. 179 | * 180 | * @param tabitem вкладка Tabitem 181 | */ 182 | protected static void linkTabItem(TabItem tabitem) { 183 | currentTab = tabitem; 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/WorkingProcessInfoExtended.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import com._1c.v8.ibis.admin.IWorkingProcessInfo; 4 | import java.util.UUID; 5 | import org.eclipse.swt.graphics.Image; 6 | import org.eclipse.swt.widgets.TabItem; 7 | import org.eclipse.swt.widgets.Table; 8 | import ru.yanygin.clusterAdminLibrary.CellValue.CELL_VALUE_TYPE; 9 | 10 | /** Расширенная информация для рабочего процесса. */ 11 | public class WorkingProcessInfoExtended extends BaseInfoExtended { 12 | 13 | private static final String TITLE_COMPUTER = "SessionInfo.Computer"; //$NON-NLS-1$ 14 | private static final String TITLE_PORT = "SessionInfo.Port"; //$NON-NLS-1$ 15 | private static final String TITLE_USING = "WPInfo.Using"; //$NON-NLS-1$ 16 | private static final String TITLE_ENABLES = "WPInfo.Enabled"; //$NON-NLS-1$ 17 | private static final String TITLE_ACTIVE = "WPInfo.Active"; //$NON-NLS-1$ 18 | private static final String TITLE_PID = "SessionInfo.PID"; //$NON-NLS-1$ 19 | private static final String TITLE_MEMORY = "WPInfo.Memory"; //$NON-NLS-1$ 20 | private static final String TITLE_MEMORY_EXCEEDED = "WPInfo.MemoryExceeded"; //$NON-NLS-1$ 21 | private static final String TITLE_AVAILABLE_PERFORMANCE = "WPInfo.AvailablePerformance"; //$NON-NLS-1$ 22 | private static final String TITLE_LICENSE = "SessionInfo.License"; //$NON-NLS-1$ 23 | private static final String TITLE_STARTED_AT = "SessionInfo.StartedAt"; //$NON-NLS-1$ 24 | private static final String TITLE_CONNECTIONS_COUNT = "WPInfo.ConnectionsCount"; //$NON-NLS-1$ 25 | private static final String TITLE_BACK_CALL_TIME = "WPInfo.BackCallTime"; //$NON-NLS-1$ 26 | private static final String TITLE_SERVER_CALL_TIME = "WPInfo.ServerCallTime"; //$NON-NLS-1$ 27 | private static final String TITLE_DB_CALL_TIME = "WPInfo.DBCallTime"; //$NON-NLS-1$ 28 | private static final String TITLE_CALL_TIME = "WPInfo.CallTime"; //$NON-NLS-1$ 29 | private static final String TITLE_LOCK_CALL_TIME = "WPInfo.LockCallTime"; //$NON-NLS-1$ 30 | private static final String TITLE_CLIENT_THREADS = "WPInfo.ClientThreads"; //$NON-NLS-1$ 31 | 32 | private static Config commonConfig = Config.currentConfig; 33 | private static ColumnProperties columnProperties = 34 | commonConfig.getColumnsProperties(WorkingProcessInfoExtended.class); 35 | 36 | private IWorkingProcessInfo workingProcessInfo; 37 | 38 | private static final String DEFAULT_ICON_FILENAME = "wp.png"; 39 | private static Image defaultIcon; 40 | 41 | private static final String TAB_TEXT_TEMPLATE = 42 | Messages.getString("TabText.WorkingProcessesCount"); //$NON-NLS-1$ 43 | 44 | private static TabItem currentTab; 45 | private static int itemCount; 46 | 47 | /** 48 | * Создание расширенной информации для рабочего процесса. 49 | * 50 | * @param server - server 51 | * @param clusterId - cluster ID 52 | * @param workingProcess - working process 53 | */ 54 | public WorkingProcessInfoExtended( 55 | Server server, UUID clusterId, IWorkingProcessInfo workingProcess) { 56 | 57 | this.server = server; 58 | this.clusterId = clusterId; 59 | this.workingProcessInfo = workingProcess; 60 | this.currentIcon = defaultIcon; 61 | 62 | computeExtendedInfoData(); 63 | } 64 | 65 | protected void computeExtendedInfoData() { 66 | 67 | // license 68 | final var license = 69 | workingProcessInfo.getLicense().isEmpty() 70 | ? "" //$NON-NLS-1$ 71 | : workingProcessInfo.getLicense().get(0).getFullPresentation(); 72 | 73 | columnProperties.prepareDataMap(data); 74 | 75 | putData(TITLE_COMPUTER, workingProcessInfo.getHostName(), CELL_VALUE_TYPE.TEXT); 76 | putData(TITLE_PORT, workingProcessInfo.getMainPort(), CELL_VALUE_TYPE.INT); 77 | putData(TITLE_USING, isUse(), CELL_VALUE_TYPE.TEXT); 78 | putData(TITLE_ENABLES, workingProcessInfo.isEnable(), CELL_VALUE_TYPE.BOOLEAN); 79 | putData(TITLE_ACTIVE, isRunning(), CELL_VALUE_TYPE.TEXT); 80 | putData(TITLE_PID, workingProcessInfo.getPid(), CELL_VALUE_TYPE.TEXT); 81 | putData(TITLE_MEMORY, workingProcessInfo.getMemorySize(), CELL_VALUE_TYPE.INT_GROUP); 82 | putData(TITLE_MEMORY_EXCEEDED, workingProcessInfo.getMemoryExcessTime(), CELL_VALUE_TYPE.LONG_GROUP); 83 | putData( 84 | TITLE_AVAILABLE_PERFORMANCE, 85 | workingProcessInfo.getAvailablePerfomance(), 86 | CELL_VALUE_TYPE.INT_GROUP); 87 | putData(TITLE_LICENSE, license, CELL_VALUE_TYPE.TEXT); 88 | putData(TITLE_STARTED_AT, workingProcessInfo.getStartedAt(), CELL_VALUE_TYPE.DATE); 89 | putData(TITLE_CONNECTIONS_COUNT, workingProcessInfo.getConnections(), CELL_VALUE_TYPE.INT_GROUP); 90 | 91 | putData( 92 | TITLE_BACK_CALL_TIME, workingProcessInfo.getAvgBackCallTime(), CELL_VALUE_TYPE.DECIMAL_6_CHAR); 93 | putData( 94 | TITLE_SERVER_CALL_TIME, 95 | workingProcessInfo.getAvgServerCallTime(), 96 | CELL_VALUE_TYPE.DECIMAL_6_CHAR); 97 | putData(TITLE_DB_CALL_TIME, workingProcessInfo.getAvgDBCallTime(), CELL_VALUE_TYPE.DECIMAL_6_CHAR); 98 | putData(TITLE_CALL_TIME, workingProcessInfo.getAvgCallTime(), CELL_VALUE_TYPE.DECIMAL_6_CHAR); 99 | putData( 100 | TITLE_LOCK_CALL_TIME, workingProcessInfo.getAvgLockCallTime(), CELL_VALUE_TYPE.DECIMAL_6_CHAR); 101 | putData(TITLE_CLIENT_THREADS, workingProcessInfo.getAvgThreads(), CELL_VALUE_TYPE.DECIMAL_6_CHAR); 102 | } 103 | 104 | @Override 105 | public void addToTable(Table table, int index) { 106 | createTableItem(table, index, workingProcessInfo.getStartedAt()); 107 | } 108 | 109 | private String isUse() { 110 | 111 | String isUse; 112 | switch (workingProcessInfo.getUse()) { 113 | case 1: 114 | isUse = Messages.getString("WPInfo.Used"); //$NON-NLS-1$ 115 | break; 116 | case 2: 117 | isUse = Messages.getString("WPInfo.UsedAsReserve"); //$NON-NLS-1$ 118 | break; 119 | case 0: 120 | default: 121 | isUse = Messages.getString("WPInfo.NotUsed"); //$NON-NLS-1$ 122 | break; 123 | } 124 | return isUse; 125 | } 126 | 127 | private String isRunning() { 128 | 129 | String isRunning; 130 | switch (workingProcessInfo.getRunning()) { 131 | case 1: 132 | isRunning = Messages.getString("WPInfo.ProcessIsRunning"); //$NON-NLS-1$ 133 | break; 134 | case 0: 135 | default: 136 | isRunning = Messages.getString("WPInfo.ProcessIsStopped"); //$NON-NLS-1$ 137 | break; 138 | } 139 | return isRunning; 140 | } 141 | 142 | /** 143 | * Get WorkingProcessInfo. 144 | * 145 | * @return the workingProcessInfo 146 | */ 147 | public IWorkingProcessInfo getWorkingProcessInfo() { 148 | return workingProcessInfo; 149 | } 150 | 151 | /** 152 | * Получение строки заголовка узла рабочих процессов. 153 | * 154 | * @param count - количество элементов 155 | * @return строку с текстом заголовка 156 | */ 157 | public static String getNodeTitle(int count) { 158 | return String.format(TAB_TEXT_TEMPLATE, count); 159 | } 160 | 161 | /** Инициализация имен колонок. */ 162 | protected static void initColumnsName() { 163 | 164 | columnProperties.addColumnsInMap( 165 | TITLE_COMPUTER, 166 | TITLE_PORT, 167 | TITLE_USING, 168 | TITLE_ENABLES, 169 | TITLE_ACTIVE, 170 | TITLE_PID, 171 | TITLE_MEMORY, 172 | TITLE_MEMORY_EXCEEDED, 173 | TITLE_AVAILABLE_PERFORMANCE, 174 | TITLE_LICENSE, 175 | TITLE_STARTED_AT, 176 | TITLE_CONNECTIONS_COUNT, 177 | TITLE_BACK_CALL_TIME, 178 | TITLE_SERVER_CALL_TIME, 179 | TITLE_DB_CALL_TIME, 180 | TITLE_CALL_TIME, 181 | TITLE_LOCK_CALL_TIME, 182 | TITLE_CLIENT_THREADS); 183 | 184 | defaultIcon = Helper.getImage(DEFAULT_ICON_FILENAME); 185 | } 186 | 187 | /** 188 | * Обновление заголовка вкладки. 189 | * 190 | * @param count - количество элементов 191 | */ 192 | protected static void updateTabText(int count) { 193 | itemCount = count; 194 | currentTab.setText(String.format(TAB_TEXT_TEMPLATE, itemCount)); 195 | } 196 | 197 | /** Сброс заголовка вкладки на неизвестное количество элементов. */ 198 | protected static void resetTabTextCount() { 199 | currentTab.setText(String.format(TAB_TEXT_TEMPLATE, itemCount + "*")); 200 | } 201 | 202 | /** 203 | * Установка связи с вкладкой TabItem. 204 | * 205 | * @param tabitem вкладка Tabitem 206 | */ 207 | protected static void linkTabItem(TabItem tabitem) { 208 | currentTab = tabitem; 209 | } 210 | } 211 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/test/resources/config_0.2.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "ExpandServers": true, 3 | "ExpandClustersTree": true, 4 | "ExpandInfobasesTree": true, 5 | "ShowWorkingServersTree": false, 6 | "ExpandWorkingServersTree": false, 7 | "ShowWorkingProcessesTree": false, 8 | "ExpandWorkingProcessesTree": false, 9 | "ShowServerDescription": true, 10 | "ShowServerVersion": true, 11 | "ShowInfobaseDescription": true, 12 | "ShowLocalRasConnectInfo": true, 13 | "Locale": "ru-RU", 14 | "ShadowSleepSessions": true, 15 | "HighlightNewItems": true, 16 | "HighlightNewItemsDuration": 60, 17 | "ReadClipboard": true, 18 | "Servers": { 19 | "server2:1340": { 20 | "Description": "Платформа 13", 21 | "AgentHost": "server1c", 22 | "AgentPort": 1340, 23 | "RasHost": "server1c", 24 | "RasPort": 1345, 25 | "UseLocalRas": false, 26 | "LocalRasPort": 1345, 27 | "LocalRasV8version": "", 28 | "Autoconnect": false, 29 | "SaveCredentials": true, 30 | "AgentUser": "AgentAdmin", 31 | "AgentPassword": "321", 32 | "ClustersCredentials": { 33 | "701453f0-c23f-4ce4-9e50-1771be85fd68": [ 34 | "Cluster_Admin_1340", 35 | "123", 36 | "Локальный кластер (1340)" 37 | ] 38 | } 39 | } 40 | }, 41 | "SessionColumnProperties": { 42 | "Order": [ 43 | 0, 44 | 1, 45 | 2, 46 | 3, 47 | 4, 48 | 5, 49 | 6, 50 | 7, 51 | 8, 52 | 9, 53 | 10, 54 | 11, 55 | 12, 56 | 13, 57 | 14, 58 | 15, 59 | 16, 60 | 17, 61 | 18, 62 | 19, 63 | 20, 64 | 21, 65 | 22, 66 | 23, 67 | 24, 68 | 25, 69 | 26, 70 | 27, 71 | 28, 72 | 29, 73 | 30, 74 | 31, 75 | 32, 76 | 33, 77 | 34, 78 | 35, 79 | 36, 80 | 37, 81 | 38, 82 | 39, 83 | 40, 84 | 41, 85 | 42, 86 | 43, 87 | 44, 88 | 45, 89 | 46, 90 | 47, 91 | 48, 92 | 49 93 | ], 94 | "Width": [ 95 | 140, 96 | 76, 97 | 63, 98 | 93, 99 | 113, 100 | 113, 101 | 80, 102 | 173, 103 | 54, 104 | 51, 105 | 41, 106 | 126, 107 | 113, 108 | 118, 109 | 132, 110 | 129, 111 | 185, 112 | 174, 113 | 173, 114 | 134, 115 | 129, 116 | 147, 117 | 144, 118 | 137, 119 | 170, 120 | 173, 121 | 142, 122 | 137, 123 | 111, 124 | 0, 125 | 0, 126 | 115, 127 | 98, 128 | 0, 129 | 108, 130 | 0, 131 | 0, 132 | 0, 133 | 0, 134 | 0, 135 | 114, 136 | 117, 137 | 122, 138 | 106, 139 | 199, 140 | 196, 141 | 196, 142 | 191, 143 | 171, 144 | 189 145 | ], 146 | "Visible": [ 147 | true, 148 | true, 149 | true, 150 | true, 151 | true, 152 | true, 153 | true, 154 | true, 155 | true, 156 | true, 157 | true, 158 | true, 159 | true, 160 | true, 161 | true, 162 | true, 163 | true, 164 | true, 165 | true, 166 | true, 167 | true, 168 | true, 169 | true, 170 | true, 171 | true, 172 | true, 173 | true, 174 | true, 175 | true, 176 | true, 177 | true, 178 | true, 179 | true, 180 | true, 181 | true, 182 | true, 183 | true, 184 | true, 185 | true, 186 | true, 187 | true, 188 | true, 189 | true, 190 | true, 191 | true, 192 | true, 193 | true, 194 | true, 195 | true, 196 | true 197 | ], 198 | "SortColumn": 24, 199 | "SortDirection": -1 200 | }, 201 | "ConnectionColumnProperties": { 202 | "Order": [ 203 | 0, 204 | 1, 205 | 2, 206 | 3, 207 | 4, 208 | 5, 209 | 6, 210 | 7 211 | ], 212 | "Width": [ 213 | 165, 214 | 82, 215 | 52, 216 | 84, 217 | 171, 218 | 70, 219 | 93, 220 | 131 221 | ], 222 | "Visible": [ 223 | true, 224 | true, 225 | true, 226 | true, 227 | true, 228 | true, 229 | true, 230 | true 231 | ], 232 | "SortColumn": 0, 233 | "SortDirection": 0 234 | }, 235 | "LockColumnProperties": { 236 | "Order": [ 237 | 0, 238 | 1, 239 | 2, 240 | 3, 241 | 4, 242 | 5, 243 | 6, 244 | 7, 245 | 8 246 | ], 247 | "Width": [ 248 | 352, 249 | 79, 250 | 90, 251 | 83, 252 | 86, 253 | 171, 254 | 86, 255 | 38, 256 | 120 257 | ], 258 | "Visible": [ 259 | true, 260 | true, 261 | true, 262 | true, 263 | true, 264 | true, 265 | true, 266 | true, 267 | true 268 | ], 269 | "SortColumn": 0, 270 | "SortDirection": 0 271 | }, 272 | "WPColumnProperties": { 273 | "Order": [ 274 | 0, 275 | 1, 276 | 2, 277 | 3, 278 | 4, 279 | 5, 280 | 6, 281 | 7, 282 | 8, 283 | 9, 284 | 10, 285 | 11, 286 | 12, 287 | 13, 288 | 14, 289 | 15, 290 | 16, 291 | 17 292 | ], 293 | "Width": [ 294 | 87, 295 | 68, 296 | 104, 297 | 71, 298 | 62, 299 | 46, 300 | 75, 301 | 80, 302 | 49, 303 | 86, 304 | 117, 305 | 83, 306 | 104, 307 | 130, 308 | 106, 309 | 132, 310 | 219, 311 | 130 312 | ], 313 | "Visible": [ 314 | true, 315 | true, 316 | true, 317 | true, 318 | true, 319 | true, 320 | true, 321 | true, 322 | true, 323 | true, 324 | true, 325 | true, 326 | true, 327 | true, 328 | true, 329 | true, 330 | true, 331 | true 332 | ], 333 | "SortColumn": 0, 334 | "SortDirection": 0 335 | }, 336 | "WSColumnProperties": { 337 | "Order": [ 338 | 0, 339 | 1, 340 | 2, 341 | 3, 342 | 4, 343 | 5, 344 | 6, 345 | 7, 346 | 8, 347 | 9, 348 | 10, 349 | 11, 350 | 12, 351 | 13, 352 | 14 353 | ], 354 | "Width": [ 355 | 160, 356 | 79, 357 | 60, 358 | 135, 359 | 141, 360 | 0, 361 | 0, 362 | 0, 363 | 0, 364 | 0, 365 | 81, 366 | 0, 367 | 0, 368 | 48, 369 | 41 370 | ], 371 | "Visible": [ 372 | true, 373 | true, 374 | true, 375 | true, 376 | true, 377 | true, 378 | true, 379 | true, 380 | true, 381 | true, 382 | true, 383 | true, 384 | true, 385 | true, 386 | true 387 | ], 388 | "SortColumn": 0, 389 | "SortDirection": 0 390 | } 391 | } -------------------------------------------------------------------------------- /clusterAdminLibrary/src/test/resources/config_0.2.0_convert_0.3.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigVersion": "0.3.0", 3 | "CheckingUpdate": false, 4 | "ExpandServers": true, 5 | "ExpandClustersTree": true, 6 | "ExpandInfobasesTree": true, 7 | "ShowWorkingServersTree": false, 8 | "ExpandWorkingServersTree": false, 9 | "ShowWorkingProcessesTree": false, 10 | "ExpandWorkingProcessesTree": false, 11 | "ShowServerDescription": true, 12 | "ShowServerVersion": true, 13 | "ShowInfobaseDescription": true, 14 | "ShowLocalRasConnectInfo": true, 15 | "Locale": "ru-RU", 16 | "ShadeSleepingSessions": false, 17 | "HighlightNewItems": true, 18 | "HighlightNewItemsDuration": 60, 19 | "ReadClipboard": true, 20 | "RowSortDirection": "DISABLE", 21 | "InfobasesSortDirection": "DISABLE", 22 | "Servers": { 23 | "server2:1340": { 24 | "Description": "Платформа 13", 25 | "AgentHost": "server1c", 26 | "AgentPort": 1340, 27 | "RasHost": "server1c", 28 | "RasPort": 1345, 29 | "UseLocalRas": false, 30 | "LocalRasPort": 1345, 31 | "LocalRasV8version": "", 32 | "Autoconnect": false, 33 | "SaveCredentialsVariant": "NAMEPASS", 34 | "AgentCredential": { 35 | "Username": "AgentAdmin", 36 | "Password": "321", 37 | "Description": "" 38 | }, 39 | "ClustersCredentialsV3": { 40 | "701453f0-c23f-4ce4-9e50-1771be85fd68": { 41 | "Username": "Cluster_Admin_1340", 42 | "Password": "123", 43 | "Description": "Локальный кластер (1340)" 44 | } 45 | }, 46 | "InfobasesCredentials": [], 47 | "FavoriteInfobases": [] 48 | } 49 | }, 50 | "SessionColumnProperties": { 51 | "Order": [ 52 | 0, 53 | 1, 54 | 2, 55 | 3, 56 | 4, 57 | 5, 58 | 6, 59 | 7, 60 | 8, 61 | 9, 62 | 10, 63 | 11, 64 | 12, 65 | 13, 66 | 14, 67 | 15, 68 | 16, 69 | 17, 70 | 18, 71 | 19, 72 | 20, 73 | 21, 74 | 22, 75 | 23, 76 | 24, 77 | 25, 78 | 26, 79 | 27, 80 | 28, 81 | 29, 82 | 30, 83 | 31, 84 | 32, 85 | 33, 86 | 34, 87 | 35, 88 | 36, 89 | 37, 90 | 38, 91 | 39, 92 | 40, 93 | 41, 94 | 42, 95 | 43, 96 | 44, 97 | 45, 98 | 46, 99 | 47, 100 | 48, 101 | 49 102 | ], 103 | "Width": [ 104 | 140, 105 | 76, 106 | 63, 107 | 93, 108 | 113, 109 | 113, 110 | 80, 111 | 173, 112 | 54, 113 | 51, 114 | 41, 115 | 126, 116 | 113, 117 | 118, 118 | 132, 119 | 129, 120 | 185, 121 | 174, 122 | 173, 123 | 134, 124 | 129, 125 | 147, 126 | 144, 127 | 137, 128 | 170, 129 | 173, 130 | 142, 131 | 137, 132 | 111, 133 | 0, 134 | 0, 135 | 115, 136 | 98, 137 | 0, 138 | 108, 139 | 0, 140 | 0, 141 | 0, 142 | 0, 143 | 0, 144 | 114, 145 | 117, 146 | 122, 147 | 106, 148 | 199, 149 | 196, 150 | 196, 151 | 191, 152 | 171, 153 | 189 154 | ], 155 | "Visible": [ 156 | true, 157 | true, 158 | true, 159 | true, 160 | true, 161 | true, 162 | true, 163 | true, 164 | true, 165 | true, 166 | true, 167 | true, 168 | true, 169 | true, 170 | true, 171 | true, 172 | true, 173 | true, 174 | true, 175 | true, 176 | true, 177 | true, 178 | true, 179 | true, 180 | true, 181 | true, 182 | true, 183 | true, 184 | true, 185 | true, 186 | true, 187 | true, 188 | true, 189 | true, 190 | true, 191 | true, 192 | true, 193 | true, 194 | true, 195 | true, 196 | true, 197 | true, 198 | true, 199 | true, 200 | true, 201 | true, 202 | true, 203 | true, 204 | true, 205 | true 206 | ], 207 | "SortColumn": 24, 208 | "RowSortDirection": "DISABLE" 209 | }, 210 | "ConnectionColumnProperties": { 211 | "Order": [ 212 | 0, 213 | 1, 214 | 2, 215 | 3, 216 | 4, 217 | 5, 218 | 6, 219 | 7 220 | ], 221 | "Width": [ 222 | 165, 223 | 82, 224 | 52, 225 | 84, 226 | 171, 227 | 70, 228 | 93, 229 | 131 230 | ], 231 | "Visible": [ 232 | true, 233 | true, 234 | true, 235 | true, 236 | true, 237 | true, 238 | true, 239 | true 240 | ], 241 | "SortColumn": 0, 242 | "RowSortDirection": "DISABLE" 243 | }, 244 | "LockColumnProperties": { 245 | "Order": [ 246 | 0, 247 | 1, 248 | 2, 249 | 3, 250 | 4, 251 | 5, 252 | 6, 253 | 7, 254 | 8 255 | ], 256 | "Width": [ 257 | 352, 258 | 79, 259 | 90, 260 | 83, 261 | 86, 262 | 171, 263 | 86, 264 | 38, 265 | 120 266 | ], 267 | "Visible": [ 268 | true, 269 | true, 270 | true, 271 | true, 272 | true, 273 | true, 274 | true, 275 | true, 276 | true 277 | ], 278 | "SortColumn": 0, 279 | "RowSortDirection": "DISABLE" 280 | }, 281 | "WPColumnProperties": { 282 | "Order": [ 283 | 0, 284 | 1, 285 | 2, 286 | 3, 287 | 4, 288 | 5, 289 | 6, 290 | 7, 291 | 8, 292 | 9, 293 | 10, 294 | 11, 295 | 12, 296 | 13, 297 | 14, 298 | 15, 299 | 16, 300 | 17 301 | ], 302 | "Width": [ 303 | 87, 304 | 68, 305 | 104, 306 | 71, 307 | 62, 308 | 46, 309 | 75, 310 | 80, 311 | 49, 312 | 86, 313 | 117, 314 | 83, 315 | 104, 316 | 130, 317 | 106, 318 | 132, 319 | 219, 320 | 130 321 | ], 322 | "Visible": [ 323 | true, 324 | true, 325 | true, 326 | true, 327 | true, 328 | true, 329 | true, 330 | true, 331 | true, 332 | true, 333 | true, 334 | true, 335 | true, 336 | true, 337 | true, 338 | true, 339 | true, 340 | true 341 | ], 342 | "SortColumn": 0, 343 | "RowSortDirection": "DISABLE" 344 | }, 345 | "WSColumnProperties": { 346 | "Order": [ 347 | 0, 348 | 1, 349 | 2, 350 | 3, 351 | 4, 352 | 5, 353 | 6, 354 | 7, 355 | 8, 356 | 9, 357 | 10, 358 | 11, 359 | 12, 360 | 13, 361 | 14 362 | ], 363 | "Width": [ 364 | 160, 365 | 79, 366 | 60, 367 | 135, 368 | 141, 369 | 0, 370 | 0, 371 | 0, 372 | 0, 373 | 0, 374 | 81, 375 | 0, 376 | 0, 377 | 48, 378 | 41 379 | ], 380 | "Visible": [ 381 | true, 382 | true, 383 | true, 384 | true, 385 | true, 386 | true, 387 | true, 388 | true, 389 | true, 390 | true, 391 | true, 392 | true, 393 | true, 394 | true, 395 | true 396 | ], 397 | "SortColumn": 0, 398 | "RowSortDirection": "DISABLE" 399 | } 400 | } -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/ClusterProvider.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import java.io.File; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | public class ClusterProvider { 10 | 11 | File configFile; 12 | static Config commonConfig; 13 | private static final String DEFAULT_CONFIG_PATH = "config.json"; //$NON-NLS-1$ 14 | private static final String TEMP_CONFIG_PATH = "config_temp.json"; //$NON-NLS-1$ 15 | 16 | private static final Logger LOGGER = LoggerFactory.getLogger("ClusterProvider"); //$NON-NLS-1$ 17 | 18 | public ClusterProvider() {} 19 | 20 | // public static Config getCommonConfig() { 21 | // return commonConfig; 22 | // } 23 | 24 | /** Читает конфиг из файла по-умолчанию. */ 25 | // public void readConfig() { 26 | // readConfig(DEFAULT_CONFIG_PATH); 27 | // } 28 | 29 | /** 30 | * Читает конфиг из определенного файла. 31 | * 32 | * @param configPath - имя конфиг файла 33 | */ 34 | // public void readConfig(String configPath) { 35 | // LOGGER.info("Start read config from file <{}>", configPath); //$NON-NLS-1$ 36 | // 37 | // if (configPath.isBlank()) { 38 | // LOGGER.debug("Config path is empty, create new config in root folder"); //$NON-NLS-1$ 39 | // commonConfig = new Config(); 40 | // return; 41 | // } 42 | // 43 | // configFile = new File(configPath); 44 | // if (!configFile.exists()) { 45 | // LOGGER.debug("Config file not exists, create new"); //$NON-NLS-1$ 46 | // commonConfig = new Config(); 47 | // return; 48 | // } 49 | // 50 | // JsonReader jsonReader = null; 51 | // 52 | // try { 53 | // jsonReader = 54 | // new JsonReader( 55 | // new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8)); 56 | // } catch (FileNotFoundException excp) { 57 | // LOGGER.debug("Config file read error:", excp); //$NON-NLS-1$ 58 | // LOGGER.debug("Create new config in root folder"); //$NON-NLS-1$ 59 | // configFile = new File(TEMP_CONFIG_PATH); 60 | // commonConfig = new Config(); 61 | // return; 62 | // } 63 | // Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); 64 | // 65 | // try { 66 | // commonConfig = gson.fromJson(jsonReader, Config.class); 67 | // commonConfig.migrateProps(); 68 | // } catch (Exception excp) { 69 | // LOGGER.debug("error convert config from json:", excp); //$NON-NLS-1$ 70 | // LOGGER.debug("Create new config in root folder"); //$NON-NLS-1$ 71 | // configFile = new File(TEMP_CONFIG_PATH); 72 | // commonConfig = new Config(); 73 | // return; 74 | // } 75 | // 76 | // if (commonConfig == null) { 77 | // LOGGER.debug("config is null, after read json"); //$NON-NLS-1$ 78 | // LOGGER.debug("Create new config in root folder"); //$NON-NLS-1$ 79 | // configFile = new File(TEMP_CONFIG_PATH); 80 | // commonConfig = new Config(); 81 | // } else { 82 | // 83 | // commonConfig.init(); 84 | // if (commonConfig.getLocale() != null) { 85 | // LOGGER.debug("Set locale is <{}>", commonConfig.getLocale()); //$NON-NLS-1$ 86 | // Locale locale = Locale.forLanguageTag(commonConfig.getLocale()); 87 | // java.util.Locale.setDefault(locale); 88 | // Messages.reloadBundle(locale); // TODO не совсем понятно как работает 89 | // } 90 | // } 91 | // LOGGER.info("Config file read successfully"); //$NON-NLS-1$ 92 | // } 93 | // 94 | // public void saveConfig() { 95 | // 96 | // LOGGER.info("Start save config to file <{}>", configFile.getAbsolutePath()); //$NON-NLS-1$ 97 | // 98 | // // configFile = new File(configPath); 99 | // 100 | // JsonWriter jsonWriter; 101 | // try { 102 | // jsonWriter = 103 | // new JsonWriter( 104 | // new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8)); 105 | // } catch (FileNotFoundException excp) { 106 | // LOGGER.error("Config file save error:", excp); //$NON-NLS-1$ 107 | // return; 108 | // } 109 | // Gson gson = 110 | // new GsonBuilder() 111 | // .excludeFieldsWithoutExposeAnnotation() 112 | // .setPrettyPrinting() 113 | // .create(); 114 | // try { 115 | // gson.toJson(getCommonConfig(), getCommonConfig().getClass(), jsonWriter); 116 | // } catch (JsonIOException excp) { 117 | // LOGGER.error("Config file save error:", excp); //$NON-NLS-1$ 118 | // } 119 | // 120 | // try { 121 | // jsonWriter.close(); 122 | // } catch (IOException excp) { 123 | // LOGGER.error("Config file save error:", excp); //$NON-NLS-1$ 124 | // } 125 | // LOGGER.info("Config file write successfully"); //$NON-NLS-1$ 126 | // } 127 | 128 | // public Server createNewServer() { 129 | // Server newServer = null; 130 | // 131 | // if (commonConfig.isReadClipboard()) { 132 | // Clipboard clipboard = new Clipboard(Display.getDefault()); 133 | // String clip = (String) clipboard.getContents(TextTransfer.getInstance()); 134 | // clipboard.dispose(); 135 | // 136 | // if (clip != null && clip.startsWith("Srvr=")) { //$NON-NLS-1$ 137 | // String[] srvrPart = clip.split(";"); //$NON-NLS-1$ 138 | // String srvr = srvrPart[0].substring(6, srvrPart[0].length() - 1); 139 | // return new Server(srvr); 140 | // } 141 | // } 142 | // 143 | // return new Server("Server:1541"); //$NON-NLS-1$ 144 | // } 145 | 146 | // public void addNewServer(Server server) { 147 | // commonConfig.getServers().put(server.getServerKey(), server); 148 | // saveConfig(); 149 | // } 150 | // 151 | // public void removeServer(Server server) { 152 | // getCommonConfig().getServers().remove(server.getServerKey(), server); 153 | // saveConfig(); 154 | // } 155 | // 156 | // public Map getServers() { 157 | // return getCommonConfig().getServers(); 158 | // } 159 | 160 | public List findNewServers() { 161 | 162 | List addedServers = new ArrayList<>(); 163 | 164 | return addedServers; 165 | } 166 | 167 | // public void connectToServers() { 168 | // 169 | // getCommonConfig().connectAllServers(); 170 | // } 171 | 172 | // public List getConnectedServers() { 173 | // 174 | // List connectedServers = new ArrayList<>(); 175 | // 176 | // getCommonConfig() 177 | // .getServers() 178 | // .forEach( 179 | // (server, config) -> { 180 | // if (config.isConnected()) { 181 | // connectedServers.add(config.getServerKey()); 182 | // } 183 | // }); 184 | // 185 | // return connectedServers; 186 | // } 187 | 188 | // public void checkConnectToServers() { 189 | // 190 | // getCommonConfig().checkConnectionAllServers(); 191 | // } 192 | 193 | // public void close() { 194 | // 195 | // saveConfig(); 196 | // 197 | // getServers() 198 | // .forEach( 199 | // (server, config) -> { 200 | // if (config.isConnected()) { 201 | // config.disconnectFromAgent(); 202 | // } 203 | // }); 204 | // } 205 | // 206 | // public static Map getInstalledV8Versions() { 207 | // LOGGER.debug("Get installed v8 platform versions"); //$NON-NLS-1$ 208 | // 209 | // Map versions = new HashMap<>(); 210 | // 211 | // if (!commonConfig.isWindows()) { 212 | // return versions; 213 | // } 214 | // 215 | // File v8x64CommonPath = new File("C:\\Program Files\\1cv8"); //$NON-NLS-1$ 216 | // File v8x86CommonPath = new File("C:\\Program Files (x86)\\1cv8"); //$NON-NLS-1$ 217 | // 218 | // FilenameFilter filter = 219 | // new FilenameFilter() { 220 | // @Override 221 | // public boolean accept(File f, String name) { 222 | // return name.matches("8.3.\\d\\d.\\d{4}"); //$NON-NLS-1$ 223 | // } 224 | // }; 225 | // 226 | // try { 227 | // if (v8x64CommonPath.exists()) { 228 | // File[] v8x64dirs = v8x64CommonPath.listFiles(filter); 229 | // for (File dir : v8x64dirs) { 230 | // if (dir.isDirectory()) { 231 | // File ras = new File(dir.getAbsolutePath().concat("\\bin\\ras.exe")); //$NON-NLS-1$ 232 | // if (ras.exists() && ras.isFile()) { 233 | // versions.put(dir.getName().concat(" (x86_64)"), ras.getAbsolutePath()); 234 | // //$NON-NLS-1$ 235 | // } 236 | // } 237 | // } 238 | // } 239 | // } catch (Exception excp) { 240 | // LOGGER.error("Error read dir <{}>", v8x64CommonPath.getAbsolutePath(), excp); 241 | // //$NON-NLS-1$ 242 | // } 243 | // 244 | // try { 245 | // if (v8x86CommonPath.exists()) { 246 | // File[] v8x86dirs = v8x86CommonPath.listFiles(filter); 247 | // for (File dir : v8x86dirs) { 248 | // if (dir.isDirectory()) { 249 | // File ras = new File(dir.getAbsolutePath().concat("\\bin\\ras.exe")); //$NON-NLS-1$ 250 | // if (ras.exists() && ras.isFile()) { 251 | // versions.put(dir.getName(), ras.getAbsolutePath()); //$NON-NLS-1$ 252 | // } 253 | // } 254 | // } 255 | // } 256 | // } catch (Exception excp) { 257 | // LOGGER.error("Error read dir <{}>", v8x64CommonPath.getAbsolutePath(), excp); 258 | // //$NON-NLS-1$ 259 | // } 260 | // 261 | // return versions; 262 | // } 263 | } 264 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/AdminEditDialog.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibraryUI; 2 | 3 | import com._1c.v8.ibis.admin.IRegUserInfo; 4 | import com._1c.v8.ibis.admin.RegUserInfo; 5 | import java.util.UUID; 6 | import org.eclipse.jface.dialogs.Dialog; 7 | import org.eclipse.jface.dialogs.IDialogConstants; 8 | import org.eclipse.swt.SWT; 9 | import org.eclipse.swt.events.ModifyEvent; 10 | import org.eclipse.swt.events.ModifyListener; 11 | import org.eclipse.swt.events.SelectionAdapter; 12 | import org.eclipse.swt.events.SelectionEvent; 13 | import org.eclipse.swt.graphics.Point; 14 | import org.eclipse.swt.layout.GridData; 15 | import org.eclipse.swt.layout.GridLayout; 16 | import org.eclipse.swt.widgets.Button; 17 | import org.eclipse.swt.widgets.Composite; 18 | import org.eclipse.swt.widgets.Control; 19 | import org.eclipse.swt.widgets.Label; 20 | import org.eclipse.swt.widgets.Shell; 21 | import org.eclipse.swt.widgets.Text; 22 | import ru.yanygin.clusterAdminLibrary.Helper; 23 | import ru.yanygin.clusterAdminLibrary.Server; 24 | 25 | /** Диалог редактирования администратора. */ 26 | public class AdminEditDialog extends Dialog { 27 | 28 | private Server server; 29 | private UUID clusterId; 30 | private IRegUserInfo userInfo; 31 | 32 | private Text txtUsername; 33 | private Text txtPassword; 34 | private Text txtPasswordConfirm; 35 | private Text txtSysUsername; 36 | private Text txtDescription; 37 | private Button btnPasswordAuthAllowed; 38 | private Button btnSysAuthAllowed; 39 | 40 | private boolean passIsModified = false; 41 | 42 | /** 43 | * Создание диалога редактирования администратора. 44 | * 45 | * @param parentShell - parent shell 46 | * @param server - Сервер 47 | * @param clusterId - ID кластера 48 | * @param userInfo - IRegUserInfo пользователя 49 | * @wbp.parser.constructor 50 | */ 51 | public AdminEditDialog(Shell parentShell, Server server, UUID clusterId, IRegUserInfo userInfo) { 52 | super(parentShell); 53 | setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); 54 | 55 | this.server = server; 56 | this.clusterId = clusterId; 57 | this.userInfo = userInfo; 58 | } 59 | 60 | @Override 61 | protected void configureShell(Shell newShell) { 62 | newShell.setMinimumSize(new Point(300, 39)); 63 | super.configureShell(newShell); 64 | 65 | if (userInfo == null) { 66 | newShell.setText(clusterId == null ? Strings.TITLE_SERVER_NEW : Strings.TITLE_CLUSTER_NEW); 67 | } else { 68 | newShell.setText(clusterId == null ? Strings.TITLE_SERVER_EDIT : Strings.TITLE_CLUSTER_EDIT); 69 | } 70 | } 71 | 72 | /** 73 | * Create contents of the dialog. 74 | * 75 | * @param parent - parent composite 76 | */ 77 | @Override 78 | protected Control createDialogArea(Composite parent) { 79 | 80 | Composite container = (Composite) super.createDialogArea(parent); 81 | GridLayout gridLayout = (GridLayout) container.getLayout(); 82 | gridLayout.numColumns = 2; 83 | 84 | Label lblUsername = new Label(container, SWT.NONE); 85 | lblUsername.setText(Strings.NAME); 86 | 87 | txtUsername = new Text(container, SWT.BORDER); 88 | txtUsername.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 89 | 90 | Label lblDescription = new Label(container, SWT.NONE); 91 | lblDescription.setText(Strings.DESCRIPTION); 92 | 93 | txtDescription = new Text(container, SWT.BORDER); 94 | txtDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 95 | 96 | btnPasswordAuthAllowed = new Button(container, SWT.CHECK); 97 | btnPasswordAuthAllowed.setText(Strings.PASSWORD_AUTH_ALLOWED); 98 | btnPasswordAuthAllowed.addSelectionListener( 99 | new SelectionAdapter() { 100 | @Override 101 | public void widgetSelected(SelectionEvent e) { 102 | txtPassword.setEditable(btnPasswordAuthAllowed.getSelection()); 103 | txtPasswordConfirm.setEditable(btnPasswordAuthAllowed.getSelection()); 104 | } 105 | }); 106 | 107 | new Label(container, SWT.NONE); 108 | 109 | Label lblPassword = new Label(container, SWT.NONE); 110 | lblPassword.setText(Strings.PASSWORD); 111 | 112 | txtPassword = new Text(container, SWT.BORDER | SWT.PASSWORD); 113 | txtPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); 114 | 115 | Label lblPasswordConfirm = new Label(container, SWT.NONE); 116 | lblPasswordConfirm.setText(Strings.PASSWORD_CONFIRM); 117 | 118 | txtPasswordConfirm = new Text(container, SWT.BORDER | SWT.PASSWORD); 119 | txtPasswordConfirm.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); 120 | 121 | btnSysAuthAllowed = new Button(container, SWT.CHECK); 122 | btnSysAuthAllowed.setText(Strings.SYS_AUTH_ALLOWED); 123 | btnSysAuthAllowed.addSelectionListener( 124 | new SelectionAdapter() { 125 | @Override 126 | public void widgetSelected(SelectionEvent e) { 127 | txtSysUsername.setEditable(btnSysAuthAllowed.getSelection()); 128 | } 129 | }); 130 | 131 | new Label(container, SWT.NONE); 132 | 133 | Label lblSysUsername = new Label(container, SWT.NONE); 134 | lblSysUsername.setText(Strings.SYS_USERNAME); 135 | 136 | txtSysUsername = new Text(container, SWT.BORDER); 137 | txtSysUsername.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 138 | 139 | initProperties(); 140 | 141 | parent.pack(); 142 | 143 | return container; 144 | } 145 | 146 | /** 147 | * Получает итоговую информацию об администраторе. 148 | * 149 | * @return IRegUserInfo информация об администраторе 150 | */ 151 | public IRegUserInfo getUserinfo() { 152 | return userInfo; 153 | } 154 | 155 | private void initProperties() { 156 | if (userInfo != null) { 157 | this.txtUsername.setText(userInfo.getName()); 158 | this.txtDescription.setText(userInfo.getDescr()); 159 | 160 | this.btnPasswordAuthAllowed.setSelection(userInfo.isPasswordAuthAllowed()); 161 | this.txtPassword.setText(userInfo.getPassword()); 162 | this.txtPasswordConfirm.setText(userInfo.getPassword()); 163 | 164 | this.btnSysAuthAllowed.setSelection(userInfo.isSysAuthAllowed()); 165 | this.txtSysUsername.setText(userInfo.getSysUserName()); 166 | } 167 | 168 | txtPassword.addModifyListener( 169 | new ModifyListener() { 170 | public void modifyText(ModifyEvent e) { 171 | passIsModified = true; 172 | } 173 | }); 174 | txtPasswordConfirm.addModifyListener( 175 | new ModifyListener() { 176 | public void modifyText(ModifyEvent e) { 177 | passIsModified = true; 178 | } 179 | }); 180 | txtPassword.setEditable(btnPasswordAuthAllowed.getSelection()); 181 | txtPasswordConfirm.setEditable(btnPasswordAuthAllowed.getSelection()); 182 | txtSysUsername.setEditable(btnSysAuthAllowed.getSelection()); 183 | } 184 | 185 | private boolean regClusterAdmin() { 186 | if (passIsModified && !txtPassword.getText().equals(txtPasswordConfirm.getText())) { 187 | Helper.showMessageBox(Strings.PASSWORDS_NOT_MATCH); 188 | return false; 189 | } 190 | 191 | if (userInfo == null) { 192 | userInfo = 193 | new RegUserInfo( 194 | txtUsername.getText(), 195 | txtDescription.getText(), 196 | txtPassword.getText(), 197 | btnPasswordAuthAllowed.getSelection(), 198 | btnSysAuthAllowed.getSelection(), 199 | txtSysUsername.getText()); 200 | } else { 201 | 202 | userInfo.setName(txtUsername.getText()); 203 | userInfo.setDescr(txtDescription.getText()); 204 | 205 | userInfo.setSysAuthAllowed(btnPasswordAuthAllowed.getSelection()); 206 | userInfo.setPassword(txtPassword.getText()); 207 | 208 | userInfo.setSysAuthAllowed(btnSysAuthAllowed.getSelection()); 209 | userInfo.setSysUserName(txtSysUsername.getText()); 210 | } 211 | 212 | boolean unregOk = 213 | clusterId == null 214 | ? server.regAgentAdmin(userInfo) 215 | : server.regClusterAdmin(clusterId, userInfo); 216 | 217 | return unregOk; 218 | } 219 | 220 | /** 221 | * Create contents of the button bar. 222 | * 223 | * @param parent - parent composite 224 | */ 225 | @Override 226 | protected void createButtonsForButtonBar(Composite parent) { 227 | Button button = 228 | createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.OK_LABEL, true); 229 | button.addSelectionListener( 230 | new SelectionAdapter() { 231 | @Override 232 | public void widgetSelected(SelectionEvent e) { 233 | if (regClusterAdmin()) { 234 | close(); 235 | } 236 | } 237 | }); 238 | 239 | createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); 240 | } 241 | 242 | private static class Strings { 243 | 244 | static final String TITLE_CLUSTER_EDIT = getString("TitleClusterEdit"); 245 | static final String TITLE_CLUSTER_NEW = getString("TitleClusterNew"); 246 | static final String TITLE_SERVER_EDIT = getString("TitleServerEdit"); 247 | static final String TITLE_SERVER_NEW = getString("TitleServerNew"); 248 | 249 | static final String NAME = getString("Name"); 250 | static final String DESCRIPTION = getString("Description"); 251 | static final String PASSWORD_AUTH_ALLOWED = getString("PasswordAuthAllowed"); 252 | static final String PASSWORD = getString("Password"); 253 | static final String PASSWORD_CONFIRM = getString("PasswordConfirm"); 254 | static final String SYS_AUTH_ALLOWED = getString("SysAuthAllowed"); 255 | static final String SYS_USERNAME = getString("SysUsername"); 256 | 257 | static final String PASSWORDS_NOT_MATCH = getString("PasswordsNotMatch"); 258 | 259 | static String getString(String key) { 260 | return Messages.getString("AdminDialog." + key); // $NON-NLS-1$ 261 | } 262 | } 263 | } 264 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/BaseInfoExtended.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import java.text.Collator; 4 | import java.util.Date; 5 | import java.util.LinkedHashMap; 6 | import java.util.Locale; 7 | import java.util.Map; 8 | import java.util.UUID; 9 | import org.eclipse.swt.SWT; 10 | import org.eclipse.swt.graphics.Color; 11 | import org.eclipse.swt.graphics.Image; 12 | import org.eclipse.swt.widgets.TabItem; 13 | import org.eclipse.swt.widgets.Table; 14 | import org.eclipse.swt.widgets.TableItem; 15 | import org.slf4j.Logger; 16 | import org.slf4j.LoggerFactory; 17 | import ru.yanygin.clusterAdminLibrary.CellValue.CELL_VALUE_TYPE; 18 | import ru.yanygin.clusterAdminLibraryUI.ViewerArea; 19 | 20 | /** Базовый класс для расширенной информации. */ 21 | public abstract class BaseInfoExtended implements Comparable { 22 | private static final Logger LOGGER = LoggerFactory.getLogger("clusterAdminLibrary"); //$NON-NLS-1$ 23 | 24 | protected static final Color newItemColor = new Color(0, 200, 0); 25 | protected static final Color shadowItemColor = new Color(160, 160, 160); 26 | protected static final Color watchedSessionColor = new Color(0, 128, 255); 27 | protected static final Color standardColor = new Color(0, 0, 0); 28 | 29 | protected Server server; 30 | protected UUID clusterId; 31 | 32 | protected Map data = new LinkedHashMap<>(); 33 | 34 | protected Image currentIcon; 35 | 36 | /** 37 | * Добавление этого экземпляра в таблицу. 38 | * 39 | * @param table - Таблица 40 | * @param index - индекс для вставки 41 | */ 42 | public abstract void addToTable(Table table, int index); 43 | 44 | /** 45 | * Добавление этого экземпляра в таблицу на последнюю позицию. 46 | * 47 | * @param table - Таблица 48 | */ 49 | public void addToTable(Table table) { 50 | try { 51 | addToTable(table, -1); 52 | } catch (Exception excp) { 53 | LOGGER.error("Error:", excp); //$NON-NLS-1$ 54 | } 55 | } 56 | 57 | /** 58 | * Получение сервера. 59 | * 60 | * @return Сервер 61 | */ 62 | public Server getServer() { 63 | return server; 64 | } 65 | 66 | /** 67 | * Получение Cluster ID. 68 | * 69 | * @return the clusterId 70 | */ 71 | public UUID getClusterId() { 72 | return clusterId; 73 | } 74 | 75 | /** 76 | * Получение расширенной информации. 77 | * 78 | * @return the sessionData1 79 | */ 80 | public Map getExtendedData() { 81 | // TODO не используется 82 | return data; 83 | } 84 | 85 | /** 86 | * Получение расширенной информации в виде массива строк. 87 | * 88 | * @return расширенная информация в виде массива строк 89 | */ 90 | public String[] getExtendedInfo() { 91 | 92 | ColumnProperties columnProperties = Config.currentConfig.getColumnsProperties(this.getClass()); 93 | 94 | String[] columnsName = columnProperties.getColumnsName(); 95 | 96 | String[] value = new String[columnsName.length]; 97 | int index = 0; 98 | for (String columnName : columnsName) { 99 | try { 100 | value[index] = data.get(columnName).value; 101 | } catch (Exception e) { 102 | value[index] = ""; 103 | } 104 | index++; 105 | } 106 | return value; 107 | } 108 | 109 | /** 110 | * Convert UUID to string. 111 | * 112 | * @param uuid - UUID 113 | * @return string 114 | */ 115 | public String convertUuidToString(UUID uuid) { 116 | // TODO не используется 117 | return uuid.equals(Helper.EMPTY_UUID) ? "" : uuid.toString(); //$NON-NLS-1$ 118 | } 119 | 120 | @Override 121 | public int compareTo(BaseInfoExtended o) { 122 | 123 | ColumnProperties columnProperties = Config.currentConfig.getColumnsProperties(this.getClass()); 124 | 125 | int sortColumn = columnProperties.getSortColumn(); 126 | int sortColumnDirection = columnProperties.getSortDirectionSwt(); 127 | 128 | if (sortColumn < 0) { 129 | return 0; 130 | } 131 | 132 | String sortColumnName = (String) data.keySet().toArray()[sortColumn]; 133 | Object left; 134 | Object right; 135 | switch (sortColumnDirection) { 136 | case SWT.UP: 137 | left = this.data.get(sortColumnName).originalValue; 138 | right = o.data.get(sortColumnName).originalValue; 139 | break; 140 | 141 | case SWT.DOWN: 142 | left = o.data.get(sortColumnName).originalValue; 143 | right = this.data.get(sortColumnName).originalValue; 144 | break; 145 | 146 | case SWT.NONE: 147 | default: 148 | return 0; 149 | } 150 | 151 | int compareResult = 0; 152 | try { 153 | switch (this.data.get(sortColumnName).type) { 154 | case INT: 155 | case SECONDS_INT: 156 | case INT_GROUP: 157 | case DECIMAL_3_CHAR: 158 | // compareResult = Integer.compare((int) left, (int) right); 159 | if (left instanceof Integer) { 160 | compareResult = Integer.compare((int) left, (int) right); 161 | } else if (left instanceof Long) { 162 | compareResult = Long.compare((long) left, (long) right); 163 | } 164 | 165 | break; 166 | 167 | case SECONDS_LONG: 168 | case LONG_GROUP: 169 | compareResult = Long.compare((long) left, (long) right); 170 | break; 171 | 172 | case DECIMAL_6_CHAR: 173 | compareResult = Double.compare((double) left, (double) right); 174 | break; 175 | 176 | case DATE: 177 | compareResult = ((Date) left).compareTo((Date) right); 178 | break; 179 | 180 | case TEXT: 181 | default: 182 | compareResult = 183 | Collator.getInstance(Locale.getDefault()) 184 | .compare(String.valueOf(left), String.valueOf(right)); 185 | } 186 | } catch (NumberFormatException excp) { 187 | compareResult = 188 | Collator.getInstance(Locale.getDefault()) 189 | .compare(String.valueOf(left), String.valueOf(right)); 190 | } 191 | 192 | return compareResult; 193 | } 194 | 195 | protected TableItem createTableItem(Table table, int index, Date startDateItem) { 196 | TableItem item = null; 197 | if (index == -1) { 198 | item = new TableItem(table, SWT.NONE); 199 | } else { 200 | item = new TableItem(table, SWT.NONE, index); 201 | } 202 | 203 | item.setText(getExtendedInfo()); 204 | item.setData(ViewerArea.EXTENDED_INFO, this); 205 | item.setImage(currentIcon); 206 | item.setChecked(false); 207 | 208 | highlightNewItem(item, startDateItem); 209 | 210 | return item; 211 | } 212 | 213 | /** 214 | * Устанавливает подсветку нового эелемента при включенной настройке. 215 | * 216 | * @param item - строка таблицы 217 | * @param startDateItem - дата старта 218 | */ 219 | private void highlightNewItem(TableItem item, Date startDateItem) { 220 | if (startDateItem == null) { 221 | return; 222 | } 223 | 224 | Config commonConfig = Config.currentConfig; 225 | if (commonConfig.isHighlightNewItems() 226 | && (new Date().getTime() - startDateItem.getTime() 227 | < commonConfig.getHighlightNewItemsDuration() * 1000)) { 228 | item.setForeground(newItemColor); 229 | } 230 | } 231 | 232 | protected abstract void computeExtendedInfoData(); 233 | 234 | protected void putData(String title, Object value, CELL_VALUE_TYPE dataType) { 235 | 236 | CellValue column = new CellValue(title, title, value, dataType); 237 | data.put(title, column); 238 | } 239 | 240 | /** Инициализация имен колонок всех подклассов. */ 241 | public static void init() { 242 | 243 | SessionInfoExtended.initColumnsName(); 244 | ConnectionInfoExtended.initColumnsName(); 245 | LockInfoExtended.initColumnsName(); 246 | WorkingProcessInfoExtended.initColumnsName(); 247 | WorkingServerInfoExtended.initColumnsName(); 248 | AssignmentRuleLabelProvider.initColumnsName(); 249 | } 250 | 251 | /** 252 | * Обновление заголовка вкладки с количеством элементов. 253 | * 254 | * @param clazz - класс-наследник BaseInfoExtended 255 | * @param count - количество элементов 256 | */ 257 | public static void updateTabText(Class clazz, int count) { 258 | resetTabsTextCount(); 259 | 260 | if (clazz == SessionInfoExtended.class) { 261 | SessionInfoExtended.updateTabText(count); 262 | } else if (clazz == ConnectionInfoExtended.class) { 263 | ConnectionInfoExtended.updateTabText(count); 264 | } else if (clazz == LockInfoExtended.class) { 265 | LockInfoExtended.updateTabText(count); 266 | } else if (clazz == WorkingProcessInfoExtended.class) { 267 | WorkingProcessInfoExtended.updateTabText(count); 268 | } else if (clazz == WorkingServerInfoExtended.class) { 269 | WorkingServerInfoExtended.updateTabText(count); 270 | } 271 | } 272 | 273 | /** Сброс заголовков вкладок на неизвестное количество элементов. */ 274 | public static void resetTabsTextCount() { 275 | SessionInfoExtended.resetTabTextCount(); 276 | ConnectionInfoExtended.resetTabTextCount(); 277 | LockInfoExtended.resetTabTextCount(); 278 | WorkingProcessInfoExtended.resetTabTextCount(); 279 | WorkingServerInfoExtended.resetTabTextCount(); 280 | } 281 | 282 | /** 283 | * Установка связи таблицы-списка со вкладкой. 284 | * 285 | * @param clazz - класс-наследник BaseInfoExtended 286 | * @param tabitem - вкладка, на которой находится таблица 287 | */ 288 | public static void linkTabItem(Class clazz, TabItem tabitem) { 289 | if (clazz == SessionInfoExtended.class) { 290 | SessionInfoExtended.linkTabItem(tabitem); 291 | } else if (clazz == ConnectionInfoExtended.class) { 292 | ConnectionInfoExtended.linkTabItem(tabitem); 293 | } else if (clazz == LockInfoExtended.class) { 294 | LockInfoExtended.linkTabItem(tabitem); 295 | } else if (clazz == WorkingProcessInfoExtended.class) { 296 | WorkingProcessInfoExtended.linkTabItem(tabitem); 297 | } else if (clazz == WorkingServerInfoExtended.class) { 298 | WorkingServerInfoExtended.linkTabItem(tabitem); 299 | } 300 | } 301 | } 302 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/AssignmentRuleDialog.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibraryUI; 2 | 3 | import com._1c.v8.ibis.admin.AssignmentRuleInfo; 4 | import com._1c.v8.ibis.admin.IAssignmentRuleInfo; 5 | import java.util.UUID; 6 | import org.eclipse.jface.dialogs.Dialog; 7 | import org.eclipse.jface.dialogs.IDialogConstants; 8 | import org.eclipse.swt.SWT; 9 | import org.eclipse.swt.events.SelectionAdapter; 10 | import org.eclipse.swt.events.SelectionEvent; 11 | import org.eclipse.swt.graphics.Point; 12 | import org.eclipse.swt.layout.GridData; 13 | import org.eclipse.swt.layout.GridLayout; 14 | import org.eclipse.swt.layout.RowLayout; 15 | import org.eclipse.swt.widgets.Button; 16 | import org.eclipse.swt.widgets.Combo; 17 | import org.eclipse.swt.widgets.Composite; 18 | import org.eclipse.swt.widgets.Control; 19 | import org.eclipse.swt.widgets.Label; 20 | import org.eclipse.swt.widgets.Shell; 21 | import org.eclipse.swt.widgets.Spinner; 22 | import ru.yanygin.clusterAdminLibrary.AssignmentRuleContentProvider; 23 | import ru.yanygin.clusterAdminLibrary.AssignmentRuleLabelProvider; 24 | import ru.yanygin.clusterAdminLibrary.Messages; 25 | import ru.yanygin.clusterAdminLibrary.Server; 26 | 27 | /** Диалог редактирования ТНФ. */ 28 | public class AssignmentRuleDialog extends Dialog { 29 | 30 | private Server server; 31 | private UUID clusterId; 32 | private UUID wsId; 33 | private IAssignmentRuleInfo ruleInfo; 34 | 35 | private Combo txtObjectType; 36 | private Combo txtInfoBaseName; 37 | private Combo txtApplicationExt; 38 | 39 | private Button btnRuleTypeAuto; 40 | private Button btnRuleTypeAssign; 41 | private Button btnRuleTypeDoNotAssign; 42 | private Spinner spinnerPriority; 43 | private Spinner spinnerNumber; 44 | 45 | /** 46 | * Создание диалога редактирования ТНФ. 47 | * 48 | * @param parentShell - parent shell 49 | * @param server - Сервер 50 | * @param clusterId - ID кластера 51 | * @param ruleInfo - IAssignmentRuleInfo правило ТНФ 52 | * @wbp.parser.constructor 53 | */ 54 | public AssignmentRuleDialog( 55 | Shell parentShell, Server server, UUID clusterId, UUID wsId, IAssignmentRuleInfo ruleInfo) { 56 | super(parentShell); 57 | setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); 58 | 59 | this.server = server; 60 | this.clusterId = clusterId; 61 | this.wsId = wsId; 62 | this.ruleInfo = ruleInfo; 63 | } 64 | 65 | @Override 66 | protected void configureShell(Shell newShell) { 67 | newShell.setMinimumSize(new Point(300, 39)); 68 | super.configureShell(newShell); 69 | 70 | if (ruleInfo == null) { 71 | newShell.setText(Strings.TITLE_NEW_RULE); 72 | } else { 73 | newShell.setText(Strings.TITLE_EDIT_RULE); 74 | } 75 | } 76 | 77 | /** 78 | * Create contents of the dialog. 79 | * 80 | * @param parent - parent composite 81 | */ 82 | @Override 83 | protected Control createDialogArea(Composite parent) { 84 | 85 | Composite container = (Composite) super.createDialogArea(parent); 86 | GridLayout gridLayout = (GridLayout) container.getLayout(); 87 | gridLayout.numColumns = 2; 88 | 89 | Label lblObjectType = new Label(container, SWT.NONE); 90 | lblObjectType.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 91 | lblObjectType.setText(Strings.OBJECT_TYPE); 92 | 93 | txtObjectType = new Combo(container, SWT.READ_ONLY); 94 | txtObjectType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 95 | 96 | Label lblRuleType = new Label(container, SWT.NONE); 97 | lblRuleType.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 98 | lblRuleType.setText(Strings.RULE_TYPE); 99 | 100 | Composite composite = new Composite(container, SWT.NONE); 101 | composite.setLayout(new RowLayout(SWT.HORIZONTAL)); 102 | 103 | btnRuleTypeAuto = new Button(composite, SWT.RADIO); 104 | btnRuleTypeAuto.setText(AssignmentRuleLabelProvider.RULE_TYPE_AUTO); 105 | 106 | btnRuleTypeAssign = new Button(composite, SWT.RADIO); 107 | btnRuleTypeAssign.setText(AssignmentRuleLabelProvider.RULE_TYPE_ASSIGN); 108 | 109 | btnRuleTypeDoNotAssign = new Button(composite, SWT.RADIO); 110 | btnRuleTypeDoNotAssign.setText(AssignmentRuleLabelProvider.RULE_TYPE_DO_NOT_ASSIGN); 111 | 112 | Label lblInfoBaseName = new Label(container, SWT.NONE); 113 | lblInfoBaseName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 114 | lblInfoBaseName.setText(Strings.INFOBASE_NAME); 115 | 116 | txtInfoBaseName = new Combo(container, SWT.BORDER); 117 | txtInfoBaseName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); 118 | 119 | Label lblApplicationExt = new Label(container, SWT.NONE); 120 | lblApplicationExt.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 121 | lblApplicationExt.setText(Strings.APPLICATION_EXT); 122 | 123 | txtApplicationExt = new Combo(container, SWT.BORDER); 124 | GridData gdTxtApplicationExt = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); 125 | gdTxtApplicationExt.widthHint = 100; 126 | txtApplicationExt.setLayoutData(gdTxtApplicationExt); 127 | 128 | Label lblNumber = new Label(container, SWT.NONE); 129 | lblNumber.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 130 | lblNumber.setText(Strings.NUMBER); 131 | 132 | spinnerNumber = new Spinner(container, SWT.BORDER); 133 | spinnerNumber.setMinimum(1); 134 | spinnerNumber.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); 135 | 136 | Label lblPriority = new Label(container, SWT.NONE); 137 | lblPriority.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 138 | lblPriority.setText(Strings.PRIORITY); 139 | 140 | spinnerPriority = new Spinner(container, SWT.BORDER); 141 | spinnerPriority.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); 142 | 143 | fillComboFields(); 144 | initValueFields(); 145 | 146 | parent.pack(); 147 | 148 | return container; 149 | } 150 | 151 | private void fillComboFields() { 152 | // Заполнение выпадающих списков значениями для выбора 153 | AssignmentRuleLabelProvider.getObjectTypes() 154 | .forEach( 155 | (k, v) -> { 156 | txtObjectType.add(v); 157 | txtObjectType.setData(v, k); 158 | }); 159 | 160 | server.getInfoBasesShort(clusterId).forEach(ib -> txtInfoBaseName.add(ib.getName())); 161 | 162 | String[] appExtValues = AssignmentRuleLabelProvider.getApplicationExtValues(); 163 | for (String v : appExtValues) { 164 | txtApplicationExt.add(v); 165 | txtApplicationExt.setData(v); 166 | } 167 | } 168 | 169 | private void initValueFields() { 170 | if (ruleInfo != null) { 171 | this.txtObjectType.setText( 172 | AssignmentRuleLabelProvider.getObjectType(ruleInfo.getObjectType())); 173 | 174 | final int ruleType = ruleInfo.getRuleType(); 175 | this.btnRuleTypeAuto.setSelection(ruleType == 1); 176 | this.btnRuleTypeAssign.setSelection(ruleType == 2); 177 | this.btnRuleTypeDoNotAssign.setSelection(ruleType == 0); 178 | 179 | this.txtInfoBaseName.setText(ruleInfo.getInfoBaseName()); 180 | this.txtApplicationExt.setText(ruleInfo.getApplicationExt()); 181 | 182 | this.spinnerPriority.setSelection(ruleInfo.getPriority()); 183 | this.spinnerNumber.setSelection(AssignmentRuleContentProvider.getRuleNumber(ruleInfo)); 184 | } else { 185 | this.txtObjectType.setText(AssignmentRuleLabelProvider.getObjectType("")); 186 | this.btnRuleTypeAuto.setSelection(true); 187 | } 188 | } 189 | 190 | private boolean regRule() { 191 | 192 | if (ruleInfo == null) { 193 | ruleInfo = new AssignmentRuleInfo(); 194 | } 195 | 196 | String objectType = (String) txtObjectType.getData(txtObjectType.getText()); 197 | ruleInfo.setObjectType(objectType); 198 | 199 | final int ruleType; 200 | if (btnRuleTypeAuto.getSelection()) { 201 | ruleType = 1; 202 | } else if (btnRuleTypeAssign.getSelection()) { 203 | ruleType = 2; 204 | } else { 205 | ruleType = 0; 206 | } 207 | ruleInfo.setRuleType(ruleType); 208 | 209 | ruleInfo.setInfoBaseName(txtInfoBaseName.getText()); 210 | ruleInfo.setApplicationExt(txtApplicationExt.getText()); 211 | 212 | ruleInfo.setPriority(spinnerPriority.getSelection()); 213 | 214 | return server.regAssignmentRule(clusterId, wsId, ruleInfo, spinnerNumber.getSelection() - 1); 215 | } 216 | 217 | /** 218 | * Получает итоговую информацию о правиле ТНФ. 219 | * 220 | * @return IAssignmentRuleInfo правило ТНФ 221 | */ 222 | public IAssignmentRuleInfo getRuleInfo() { 223 | return ruleInfo; 224 | } 225 | 226 | /** 227 | * Create contents of the button bar. 228 | * 229 | * @param parent - parent composite 230 | */ 231 | @Override 232 | protected void createButtonsForButtonBar(Composite parent) { 233 | Button button = 234 | createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.OK_LABEL, true); 235 | button.addSelectionListener( 236 | new SelectionAdapter() { 237 | @Override 238 | public void widgetSelected(SelectionEvent e) { 239 | if (regRule()) { 240 | close(); 241 | } 242 | } 243 | }); 244 | 245 | createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); 246 | } 247 | 248 | private static class Strings { 249 | 250 | static final String TITLE_EDIT_RULE = getString("TitleEditRule"); 251 | static final String TITLE_NEW_RULE = getString("TitleNewRule"); 252 | 253 | static final String NUMBER = getString("Number"); 254 | static final String OBJECT_TYPE = getString("ObjectType"); 255 | static final String RULE_TYPE = getString("RuleType"); 256 | static final String INFOBASE_NAME = getString("InfoBaseName"); 257 | static final String APPLICATION_EXT = getString("ApplicationExt"); 258 | static final String PRIORITY = getString("Priority"); 259 | 260 | static String getString(String key) { 261 | return Messages.getString("AssignmentRule." + key); // $NON-NLS-1$ 262 | } 263 | } 264 | } 265 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/ColumnProperties.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibrary; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | import java.util.LinkedHashMap; 6 | import java.util.Map; 7 | import org.eclipse.swt.SWT; 8 | 9 | /** Свойства столбцов. */ 10 | public class ColumnProperties { 11 | 12 | @SerializedName("Order") 13 | @Expose 14 | private int[] order = null; 15 | 16 | @SerializedName("Width") 17 | @Expose 18 | private int[] width = null; 19 | 20 | @SerializedName("Visible") 21 | @Expose 22 | private boolean[] visible = null; 23 | 24 | @SerializedName("SortColumn") 25 | @Expose 26 | private int sortColumn = -1; // -1 = отсутствие сортировки 27 | 28 | @SerializedName("RowSortDirection") 29 | @Expose 30 | private RowSortDirection rowSortDirection = RowSortDirection.DISABLE; 31 | 32 | private Map columnsMap = new LinkedHashMap<>(); 33 | 34 | /** Направление сортировки строк. */ 35 | public enum RowSortDirection { 36 | /** Выключено/Как у предыдущего столбца. */ 37 | DISABLE, 38 | /** По возрастанию. */ 39 | ASC, 40 | /** По убыванию. */ 41 | DESC 42 | } 43 | 44 | /** Конструктор по-умолчанию. */ 45 | public ColumnProperties() { 46 | // нужен для инициализации полей не найденных в конфиге при десериализации 47 | } 48 | 49 | /** Инициализация параметров после десериализации. */ 50 | public void init() { 51 | // TODO deprecated? 52 | // При чтении конфиг-файла отсутствующие поля, инициализируются значением null 53 | if (this.rowSortDirection == null) { 54 | this.rowSortDirection = RowSortDirection.DISABLE; 55 | } 56 | } 57 | 58 | /** 59 | * Получить порядок столбцов. 60 | * 61 | * @return порядок столбцов 62 | */ 63 | public int[] getOrder() { 64 | return order; 65 | } 66 | 67 | /** 68 | * Установить порядок столбцов. 69 | * 70 | * @param order - новый порядок столбцов 71 | */ 72 | public void setOrder(int[] order) { 73 | this.order = order; 74 | } 75 | 76 | /** 77 | * Получить ширину столбцов. 78 | * 79 | * @return ширина столбцов 80 | */ 81 | public int[] getWidth() { 82 | return width; 83 | } 84 | 85 | /** 86 | * Установить ширину столбца. 87 | * 88 | * @param index - номер столбца 89 | * @param width - новая ширина столбца 90 | */ 91 | public void setWidth(int index, int width) { 92 | this.width[index] = width; 93 | } 94 | 95 | /** 96 | * Получить видимость столбцов. 97 | * 98 | * @return видимость столбцов 99 | */ 100 | public boolean[] getVisible() { 101 | return visible; 102 | } 103 | 104 | /** 105 | * Установить видимость столбца. 106 | * 107 | * @param visible - новое значение видимости столбца 108 | */ 109 | public void setVisible(boolean[] visible) { 110 | this.visible = visible; 111 | } 112 | 113 | /** 114 | * Получить порядок столбцов. 115 | * 116 | * @return орядок столбцов 117 | */ 118 | public int getSortColumn() { 119 | return sortColumn; 120 | } 121 | 122 | /** 123 | * Выполнить сортировку столбца. 124 | * 125 | * @param sortColumn - номер столбца 126 | */ 127 | public void setSortColumn(int sortColumn) { 128 | 129 | RowSortDirection defSortDir = Config.currentConfig.getRowSortDirection(); 130 | 131 | if (this.sortColumn == sortColumn) { // колонка не меняется - переключаем направление 132 | 133 | switch (this.rowSortDirection) { 134 | case ASC: 135 | this.rowSortDirection = RowSortDirection.DESC; 136 | break; 137 | case DESC: 138 | this.rowSortDirection = RowSortDirection.ASC; 139 | break; 140 | 141 | default: 142 | this.rowSortDirection = 143 | (defSortDir == RowSortDirection.DISABLE) ? RowSortDirection.DESC : defSortDir; 144 | break; 145 | } 146 | 147 | } else { // колонка меняется - ставим направление из настроек 148 | 149 | if (defSortDir == RowSortDirection.ASC || defSortDir == RowSortDirection.DESC) { 150 | this.rowSortDirection = defSortDir; 151 | } else if (defSortDir == RowSortDirection.DISABLE 152 | && this.rowSortDirection == RowSortDirection.DISABLE) { 153 | this.rowSortDirection = RowSortDirection.DESC; 154 | } 155 | 156 | // TODO (нужен еще коммент или уже сделал?) 157 | // если по-умолчанию = как предыдущее - то менять не нужно 158 | // (но надо учесть, что предыдущее может быть не ASC и не DESC), тогда ставим DESC 159 | // если по-умолчанию = ASC или DESC - то ставим его принудительно 160 | 161 | } 162 | 163 | this.sortColumn = sortColumn; 164 | } 165 | 166 | /** 167 | * Получить направление сортировки строк. 168 | * 169 | * @return направление сортировки 170 | */ 171 | public RowSortDirection getSortDirection() { 172 | return this.rowSortDirection; 173 | } 174 | 175 | /** 176 | * Получить направление сортировки строк в SWT значениях. 177 | * 178 | * @return направление сортировки 179 | */ 180 | public int getSortDirectionSwt() { 181 | int sortDirectionSwt = 0; 182 | switch (this.rowSortDirection) { 183 | case ASC: 184 | sortDirectionSwt = SWT.UP; 185 | break; 186 | 187 | case DESC: 188 | sortDirectionSwt = SWT.DOWN; 189 | break; 190 | 191 | case DISABLE: 192 | default: 193 | sortDirectionSwt = SWT.NONE; 194 | break; 195 | } 196 | 197 | return sortDirectionSwt; 198 | } 199 | 200 | /** 201 | * Установить направление сортировки строк. 202 | * 203 | * @param sortDirectionSwt направление сортировки строк в SWT значениях 204 | */ 205 | public void setSortDirection(int sortDirectionSwt) { 206 | 207 | switch (sortDirectionSwt) { 208 | case SWT.UP: 209 | this.rowSortDirection = RowSortDirection.ASC; 210 | break; 211 | 212 | case SWT.DOWN: 213 | this.rowSortDirection = RowSortDirection.DESC; 214 | break; 215 | 216 | case SWT.NONE: 217 | default: 218 | this.rowSortDirection = RowSortDirection.DISABLE; 219 | break; 220 | } 221 | 222 | } 223 | 224 | /** 225 | * Get Columns Map. 226 | * 227 | * @return ColumnsMap 228 | */ 229 | // public Map getColumnsMap() { 230 | // return columnsMap; 231 | // } 232 | 233 | /** 234 | * Add column. 235 | * 236 | * @param columnName - column name 237 | */ 238 | // public void addColumnInMap(String columnName) { 239 | // if (columnsMap == null) { 240 | // columnsMap = new LinkedHashMap<>(); 241 | // } 242 | // columnsMap.put(columnName, ""); //$NON-NLS-1$ 243 | // } 244 | 245 | /** 246 | * Добавить столбцы. 247 | * 248 | * @param columnsName - имена столбцов 249 | */ 250 | public void addColumnsInMap(String... columnsName) { 251 | for (int i = 0; i < columnsName.length; i++) { 252 | columnsMap.put(columnsName[i], ""); //$NON-NLS-1$ 253 | } 254 | updateColumnProperties(columnsName.length); 255 | } 256 | 257 | /** 258 | * Подготовка map перед заполнением значениями (устанавливает порядок столбцов). 259 | * 260 | * @param data - будущая map со значениями строк 261 | */ 262 | public void prepareDataMap(Map data) { 263 | columnsMap.forEach((k, v) -> data.put(k, null)); 264 | } 265 | 266 | /** 267 | * Получение имен столбцов. 268 | * 269 | * @return String[] массив имен столбцов 270 | */ 271 | public String[] getColumnsName() { 272 | return columnsMap.keySet().toArray(new String[0]); 273 | } 274 | 275 | /** 276 | * Получение имен столбцов для пользователей. 277 | * 278 | * @return String[] массив имен столбцов 279 | */ 280 | public String[] getColumnsDescription() { 281 | 282 | String[] str = columnsMap.keySet().toArray(new String[0]); 283 | 284 | String[] names = new String[str.length]; 285 | for (int i = 0; i < str.length; i++) { 286 | names[i] = Messages.getString(str[i]); 287 | } 288 | 289 | return names; 290 | } 291 | 292 | /** 293 | * Конструктор, инициализирует свойства столбцов. 294 | * 295 | * @param size - количество колонок 296 | */ 297 | public ColumnProperties(int size) { 298 | 299 | // Порядок столбцов 300 | this.order = new int[size]; 301 | for (int i = 0; i < this.order.length; i++) { 302 | this.order[i] = i; 303 | } 304 | 305 | // Ширина столбцов 306 | this.width = new int[size]; 307 | 308 | // Видимость столбцов 309 | this.visible = new boolean[size]; 310 | for (int i = 0; i < this.visible.length; i++) { 311 | this.visible[i] = true; 312 | } 313 | } 314 | 315 | /** 316 | * Обновление текущего количества столбцов. 317 | * 318 | * @param arraySize - текущее количество столбцов 319 | */ 320 | public void updateColumnProperties(int arraySize) { 321 | 322 | // если после десериализации количество не равно текущему 323 | // (например, поменялся состав колонок), 324 | // нужно переложить в новый массив без потерь 325 | 326 | // Порядок столбцов 327 | if (order.length != arraySize) { 328 | int[] columnOrderTemp = order; 329 | order = new int[arraySize]; 330 | System.arraycopy(columnOrderTemp, 0, order, 0, Math.min(arraySize, columnOrderTemp.length)); 331 | 332 | if (arraySize > columnOrderTemp.length) { 333 | for (int i = columnOrderTemp.length; i < arraySize; i++) { 334 | order[i] = i; 335 | } 336 | } 337 | } 338 | 339 | // Ширина столбцов 340 | if (width.length != arraySize) { 341 | int[] columnWidthTemp = width; 342 | width = new int[arraySize]; 343 | System.arraycopy(columnWidthTemp, 0, width, 0, Math.min(arraySize, columnWidthTemp.length)); 344 | } 345 | 346 | // Видимость столбцов 347 | if (visible.length != arraySize) { 348 | boolean[] columnVisibleTemp = visible; 349 | visible = new boolean[arraySize]; 350 | System.arraycopy( 351 | columnVisibleTemp, 0, visible, 0, Math.min(arraySize, columnVisibleTemp.length)); 352 | if (arraySize > columnVisibleTemp.length) { 353 | for (int i = columnVisibleTemp.length; i < arraySize; i++) { 354 | visible[i] = true; 355 | } 356 | } 357 | } 358 | } 359 | } 360 | -------------------------------------------------------------------------------- /clusterAdminApplication/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 4.0.0 6 | 7 | ru.yanygin 8 | ru.yanygin.clusterAdminApplication 9 | 0.4.0 10 | jar 11 | 12 | 13 | 11 14 | 11 15 | UTF-8 16 | 17 | 18 | 19 | 20 | linux 21 | 22 | 23 | unix 24 | amd64 25 | 26 | 27 | 28 | ru.yanygin.clusterAdminLibrary.linux 29 | org.eclipse.swt.gtk.linux.x86_64 30 | 31 | 32 | OneS_ClusterAdmin-${project.version}-linux 33 | 34 | 35 | 36 | macOS 37 | 38 | 39 | mac 40 | 41 | 42 | 43 | ru.yanygin.clusterAdminLibrary.macOS 44 | org.eclipse.swt.cocoa.macosx.x86_64 45 | 46 | 47 | OneS_ClusterAdmin-${project.version}-macOS 48 | 49 | 50 | 51 | windows-x86_64 52 | 53 | true 54 | 55 | windows 56 | x86_64 57 | 58 | 59 | 60 | ru.yanygin.clusterAdminLibrary.windows_x64 61 | org.eclipse.swt.win32.win32.x86_64 62 | 63 | 64 | OneS_ClusterAdmin-${project.version}-windows-x64 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | ru.yanygin 73 | 74 | ${clusterAdminLibrary.artifactId} 75 | ${project.version}-SNAPSHOT 76 | 77 | 78 | 79 | junit 80 | junit 81 | 3.8.1 82 | test 83 | 84 | 85 | 86 | 87 | org.slf4j 88 | slf4j-api 89 | 2.0.13 90 | 91 | 92 | 93 | 94 | ch.qos.logback 95 | logback-classic 96 | 1.5.6 97 | 98 | 99 | 100 | ch.qos.logback 101 | logback-core 102 | 1.5.6 103 | 104 | 105 | 106 | 107 | 108 | org.eclipse.platform 109 | ${swt.artifactId} 110 | 3.120.0 111 | 112 | 113 | 114 | 115 | org.eclipse.platform 116 | org.eclipse.jface 117 | 3.22.100 118 | 119 | 120 | 121 | 122 | com.google.code.gson 123 | gson 124 | 2.10.1 125 | 126 | 127 | 128 | 129 | org.jboss.netty 130 | netty 131 | 3.2.6.Final 132 | 133 | 134 | 135 | 136 | com._1c.v8 137 | com._1c.v8.core 138 | 1.0.30-SNAPSHOT 139 | 140 | 141 | com._1c.v8 142 | com._1c.v8.ibis.admin 143 | 1.6.7 144 | 145 | 146 | com._1c.v8 147 | com._1c.v8.ibis.swp 148 | 1.1.1-SNAPSHOT 149 | 150 | 151 | com._1c.v8 152 | com._1c.v8.ibis 153 | 1.1.1-SNAPSHOT 154 | 155 | 156 | com._1c.v8 157 | com._1c.v8.swp.netty 158 | 1.0.3-SNAPSHOT 159 | 160 | 161 | com._1c.v8 162 | com._1c.v8.swp 163 | 1.0.3-SNAPSHOT 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | org.apache.maven.plugins 173 | maven-compiler-plugin 174 | 3.8.1 175 | 176 | 11 177 | 11 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 204 | 205 | 206 | org.apache.maven.plugins 207 | maven-jar-plugin 208 | 3.2.0 209 | 210 | 211 | 212 | true 213 | lib/ 214 | ru.yanygin.clusterAdminApplication.ClusterAdmin 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | org.apache.maven.plugins 223 | maven-dependency-plugin 224 | 2.5.1 225 | 226 | 227 | ${project.build.directory}/lib/ 228 | 229 | false 230 | false 231 | true 232 | 233 | 234 | 235 | copy-dependencies 236 | package 237 | 238 | copy-dependencies 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | org.apache.maven.plugins 249 | maven-assembly-plugin 250 | 3.3.0 251 | 252 | 253 | 254 | ru.yanygin.clusterAdminApplication.ClusterAdmin 255 | 256 | 257 | 258 | jar-with-dependencies 259 | 260 | false 261 | 262 | 263 | 264 | make-assembly 265 | package 266 | 267 | single 268 | 269 | 270 | 271 | 272 | 273 | 274 | org.apache.maven.plugins 275 | maven-checkstyle-plugin 276 | 3.1.2 277 | 278 | 279 | 280 | com.puppycrawl.tools 281 | checkstyle 282 | 8.44 283 | 284 | 285 | 286 | google_checks.xml 287 | 288 | 289 | 290 | 291 | validate 292 | validate 293 | 294 | check 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/SessionInfoDialog.java: -------------------------------------------------------------------------------- 1 | package ru.yanygin.clusterAdminLibraryUI; 2 | 3 | import com._1c.v8.ibis.admin.ISessionInfo; 4 | import java.text.DateFormat; 5 | import java.text.SimpleDateFormat; 6 | import java.util.Date; 7 | import org.eclipse.jface.dialogs.Dialog; 8 | import org.eclipse.jface.dialogs.IDialogConstants; 9 | import org.eclipse.swt.SWT; 10 | import org.eclipse.swt.events.SelectionAdapter; 11 | import org.eclipse.swt.events.SelectionEvent; 12 | import org.eclipse.swt.layout.GridData; 13 | import org.eclipse.swt.layout.GridLayout; 14 | import org.eclipse.swt.widgets.Button; 15 | import org.eclipse.swt.widgets.Composite; 16 | import org.eclipse.swt.widgets.Control; 17 | import org.eclipse.swt.widgets.Label; 18 | import org.eclipse.swt.widgets.Shell; 19 | import org.eclipse.swt.widgets.Text; 20 | import ru.yanygin.clusterAdminLibrary.Messages; 21 | import ru.yanygin.clusterAdminLibrary.SessionInfoExtended; 22 | 23 | /** Диалоговое окно с подробной информацией о сессии. */ 24 | public class SessionInfoDialog extends Dialog { 25 | 26 | private SessionInfoExtended sessionExtInfo; 27 | 28 | private Text txtInfobaseName; 29 | private Text txtLastActiveAt; 30 | private Text txtClientIpAddress; 31 | private Text txtUsername; 32 | private Text txtApplication; 33 | private Text txtStartedAt; 34 | private Text txtComputer; 35 | private Text txtServer; 36 | private Text txtPort; 37 | private Text txtPid; 38 | private Text txtConnectionNumber; 39 | private Text txtLicense; 40 | private Text txtSessionNumber; 41 | 42 | /** 43 | * Create the dialog. 44 | * 45 | * @param parentShell - parent shell 46 | * @param sessionExtInfo - session extension info 47 | */ 48 | public SessionInfoDialog(Shell parentShell, SessionInfoExtended sessionExtInfo) { 49 | super(parentShell); 50 | setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); 51 | 52 | this.sessionExtInfo = sessionExtInfo; 53 | } 54 | 55 | @Override 56 | protected void configureShell(Shell newShell) { 57 | super.configureShell(newShell); 58 | newShell.setText(Strings.TITLE_WINDOW); 59 | } 60 | 61 | /** 62 | * Create contents of the dialog. 63 | * 64 | * @param parent - parent composite 65 | */ 66 | @Override 67 | protected Control createDialogArea(Composite parent) { 68 | 69 | Composite container = (Composite) super.createDialogArea(parent); 70 | GridLayout gridLayout = (GridLayout) container.getLayout(); 71 | gridLayout.makeColumnsEqualWidth = true; 72 | gridLayout.numColumns = 2; 73 | 74 | Label lblInfobaseName = new Label(container, SWT.NONE); 75 | lblInfobaseName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 76 | lblInfobaseName.setText(Strings.INFOBASE); 77 | 78 | txtInfobaseName = new Text(container, SWT.BORDER | SWT.READ_ONLY); 79 | txtInfobaseName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 80 | 81 | Label lbSessionNumber = new Label(container, SWT.NONE); 82 | lbSessionNumber.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 83 | lbSessionNumber.setText(Strings.SESSION_N); 84 | 85 | txtSessionNumber = new Text(container, SWT.BORDER | SWT.READ_ONLY); 86 | txtSessionNumber.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 87 | 88 | Label lblStartedAt = new Label(container, SWT.NONE); 89 | lblStartedAt.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 90 | lblStartedAt.setText(Strings.STARTED_AT); 91 | 92 | txtStartedAt = new Text(container, SWT.BORDER | SWT.READ_ONLY); 93 | txtStartedAt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 94 | 95 | Label lblLastActiveAt = new Label(container, SWT.NONE); 96 | lblLastActiveAt.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 97 | lblLastActiveAt.setText(Strings.LAST_ACTIVE_AT); 98 | 99 | txtLastActiveAt = new Text(container, SWT.BORDER | SWT.READ_ONLY); 100 | txtLastActiveAt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 101 | 102 | Label lblComputer = new Label(container, SWT.NONE); 103 | lblComputer.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 104 | lblComputer.setText(Strings.COMPUTER); 105 | 106 | txtComputer = new Text(container, SWT.BORDER | SWT.READ_ONLY); 107 | txtComputer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 108 | 109 | Label lblClientIpAddress = new Label(container, SWT.NONE); 110 | lblClientIpAddress.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 111 | lblClientIpAddress.setText(Strings.CLIENT_IP_ADDRESS); 112 | 113 | txtClientIpAddress = new Text(container, SWT.BORDER | SWT.READ_ONLY); 114 | txtClientIpAddress.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 115 | 116 | Label lblUsername = new Label(container, SWT.NONE); 117 | lblUsername.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 118 | lblUsername.setText(Strings.USERNAME); 119 | 120 | txtUsername = new Text(container, SWT.BORDER | SWT.READ_ONLY); 121 | txtUsername.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 122 | 123 | Label lblApplication = new Label(container, SWT.NONE); 124 | lblApplication.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 125 | lblApplication.setAlignment(SWT.RIGHT); 126 | lblApplication.setText(Strings.APPLICATION); 127 | 128 | txtApplication = new Text(container, SWT.BORDER | SWT.READ_ONLY); 129 | txtApplication.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 130 | 131 | Label lblServer = new Label(container, SWT.NONE); 132 | lblServer.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 133 | lblServer.setText(Strings.SERVER); 134 | lblServer.setAlignment(SWT.RIGHT); 135 | 136 | txtServer = new Text(container, SWT.BORDER | SWT.READ_ONLY); 137 | txtServer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 138 | 139 | Label lblPort = new Label(container, SWT.NONE); 140 | lblPort.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 141 | lblPort.setText(Strings.PORT); 142 | lblPort.setAlignment(SWT.RIGHT); 143 | 144 | txtPort = new Text(container, SWT.BORDER | SWT.READ_ONLY); 145 | txtPort.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 146 | 147 | Label lblPid = new Label(container, SWT.NONE); 148 | lblPid.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 149 | lblPid.setText(Strings.PID); 150 | lblPid.setAlignment(SWT.RIGHT); 151 | 152 | txtPid = new Text(container, SWT.BORDER | SWT.READ_ONLY); 153 | txtPid.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 154 | 155 | Label lblConnectionNumber = new Label(container, SWT.NONE); 156 | lblConnectionNumber.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 157 | lblConnectionNumber.setText(Strings.CONNECTION_N); 158 | lblConnectionNumber.setAlignment(SWT.RIGHT); 159 | 160 | txtConnectionNumber = new Text(container, SWT.BORDER | SWT.READ_ONLY); 161 | txtConnectionNumber.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 162 | 163 | Label lblLicense = new Label(container, SWT.NONE); 164 | lblLicense.setText(Strings.LICENSE); 165 | lblLicense.setAlignment(SWT.RIGHT); 166 | new Label(container, SWT.NONE); 167 | 168 | txtLicense = new Text(container, SWT.BORDER | SWT.READ_ONLY); 169 | txtLicense.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 2)); 170 | 171 | initProperties(); 172 | 173 | return container; 174 | } 175 | 176 | private void initProperties() { 177 | ISessionInfo sessionInfo = sessionExtInfo.getSessionInfo(); 178 | 179 | txtInfobaseName.setText(sessionExtInfo.getInfobaseName()); 180 | txtSessionNumber.setText(Integer.toString(sessionInfo.getSessionId())); 181 | txtStartedAt.setText(dateToString(sessionInfo.getStartedAt())); 182 | txtLastActiveAt.setText(dateToString(sessionInfo.getLastActiveAt())); 183 | 184 | txtComputer.setText(sessionInfo.getHost()); 185 | 186 | txtClientIpAddress.setText(sessionExtInfo.getClientIpAddress()); 187 | txtUsername.setText(sessionInfo.getUserName()); 188 | txtApplication.setText(sessionExtInfo.getApplicationName()); 189 | 190 | txtServer.setText(sessionExtInfo.getWorkingProcessHostName()); 191 | txtPort.setText(sessionExtInfo.getWorkingProcessPort()); 192 | txtPid.setText(sessionExtInfo.getWorkingProcessPid()); 193 | txtConnectionNumber.setText(sessionExtInfo.getConnectionNumber()); 194 | 195 | txtLicense.setText(sessionExtInfo.getLicense()); 196 | } 197 | 198 | /** 199 | * Create contents of the button bar. 200 | * 201 | * @param parent - parent composite 202 | */ 203 | @Override 204 | protected void createButtonsForButtonBar(Composite parent) { 205 | Button button = 206 | createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); 207 | button.addSelectionListener( 208 | new SelectionAdapter() { 209 | @Override 210 | public void widgetSelected(SelectionEvent e) { 211 | close(); 212 | } 213 | }); 214 | } 215 | 216 | private String dateToString(Date date) { 217 | 218 | DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); //$NON-NLS-1$ 219 | Date emptyDate = new Date(0); 220 | 221 | return date.equals(emptyDate) ? "" : dateFormat.format(date); //$NON-NLS-1$ 222 | } 223 | 224 | private static class Strings { 225 | 226 | static final String TITLE_WINDOW = getString("TitleDialog"); 227 | 228 | static final String INFOBASE = getString("Infobase"); 229 | static final String SESSION_N = getString("SessionN"); 230 | static final String STARTED_AT = getString("StartedAt"); 231 | static final String LAST_ACTIVE_AT = getString("LastActiveAt"); 232 | static final String COMPUTER = getString("Computer"); 233 | static final String CLIENT_IP_ADDRESS = getString("ClientIPAddress"); 234 | static final String USERNAME = getString("Username"); 235 | static final String APPLICATION = getString("Application"); 236 | static final String SERVER = getString("Server"); 237 | static final String PORT = getString("Port"); 238 | static final String PID = getString("PID"); 239 | static final String CONNECTION_N = getString("ConnectionN"); 240 | static final String LICENSE = getString("License"); 241 | 242 | static String getString(String key) { 243 | return Messages.getString("SessionInfo." + key); //$NON-NLS-1$ 244 | } 245 | } 246 | } 247 | -------------------------------------------------------------------------------- /clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/messages.properties: -------------------------------------------------------------------------------- 1 | #Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/) 2 | #Eclipse messages class 3 | #Fri Oct 01 13:58:03 MSK 2021 4 | 5 | AssignmentRule.ApplicationExt = Value of additional parameter 6 | AssignmentRule.InfoBaseName = Infobase name 7 | AssignmentRule.Number = Number 8 | AssignmentRule.ObjectType = Requirement object 9 | AssignmentRule.ObjectType.AuxiliaryService = Utility cluster service 10 | AssignmentRule.ObjectType.ClientTestingService = Testing service 11 | AssignmentRule.ObjectType.Connection = Client infobase connection 12 | AssignmentRule.ObjectType.CounterService = Service of resource consumption counters monitoring 13 | AssignmentRule.ObjectType.DataAcceleratorService = Data accelerator service 14 | AssignmentRule.ObjectType.DataBaseConfigurationUpdateService = Database configuration update service 15 | AssignmentRule.ObjectType.DataEditLockService = Object locking service 16 | AssignmentRule.ObjectType.DatabaseTableNumberingService = Table name and database field numbering service 17 | AssignmentRule.ObjectType.DbCopiesService = Database copy service 18 | AssignmentRule.ObjectType.DbCopiesTimeService = Database copy time service 19 | AssignmentRule.ObjectType.EventLogService = Event logging service 20 | AssignmentRule.ObjectType.ExternalDataSourceODBCService = ODBC external data source access service 21 | AssignmentRule.ObjectType.ExternalDataSourceXMLAService = XMLA external data source access service 22 | AssignmentRule.ObjectType.ExternalSessionManagerService = External session management service 23 | AssignmentRule.ObjectType.ForAll = For all 24 | AssignmentRule.ObjectType.FulltextSearchService = Full-text search service 25 | AssignmentRule.ObjectType.GetSessionsService = Service for getting a session list 26 | AssignmentRule.ObjectType.IntegrationDataService = Integration data service 27 | AssignmentRule.ObjectType.JobService = Job service 28 | AssignmentRule.ObjectType.LicenseService = Licensing service 29 | AssignmentRule.ObjectType.NumerationService = Numbering service 30 | AssignmentRule.ObjectType.OpenID2ProviderContextService = OpenID2 service provider 31 | AssignmentRule.ObjectType.SessionDataService = Session data service 32 | AssignmentRule.ObjectType.SessionReuseService = Session reuse service 33 | AssignmentRule.ObjectType.SettingsService = User-defined settings service 34 | AssignmentRule.ObjectType.TimestampService = Time service 35 | AssignmentRule.ObjectType.TransactionLockService = Transaction lock service 36 | AssignmentRule.Priority = Priority 37 | AssignmentRule.RuleType = Requirement type 38 | AssignmentRule.RuleType.Assign = Assign 39 | AssignmentRule.RuleType.Auto = Auto 40 | AssignmentRule.RuleType.DoNotAssign = Do not assign 41 | AssignmentRule.TitleEditRule = Assignment rule 42 | AssignmentRule.TitleNewRule = New assignment rule 43 | 44 | ConnectionInfo.ConnectedAt = Connected at 45 | ConnectionInfo.Connection = Connection 46 | ConnectionInfo.Hostname = Hostname 47 | ConnectionInfo.InfobaseConnectionID = Infobase connection ID 48 | ConnectionInfo.RpHostPort = Server port 49 | ConnectionInfo.Session = Session 50 | 51 | InfoTables.Description = Description 52 | 53 | LockInfo.LockedAt = Locked at 54 | 55 | Server.AdministrationServer = Administration Server 56 | Server.AuthenticationOfCentralServerAdministrator = Authentication of the Central server administrator <%s:%s> 57 | Server.AuthenticationOfClusterAdminnistrator = Authentication of the cluster administrator on the <%s/%s> 58 | Server.AuthenticationOfInfobase = Authentication of the infobase 59 | Server.BackgroundJob = Background job 60 | Server.ClusterConsole = Cluster Console 61 | Server.Designer = Designer 62 | Server.JobScheduler = Job scheduler 63 | Server.LocalRasNotFound = Local RAS not found 64 | Server.LocalRasParamsIsEmpty = Local RAS path or port for Server %s is empty 65 | Server.LocalRasParamsIsInvalid = To run RAS, you need to specify the platform version in the server connection settings.\r\nThe full version must be specified with the completed assembly number (the fourth block of digits).\r\nFor example, 8.3.13 is incorrect, 8.3.13.1690 is correct.\r\nThe current specified version is %s 66 | Server.NotConnect = not connect 67 | Server.TerminateSessionMessage = Your session was interrupted by the administrator 68 | Server.TheClusterAuthenticationError = The cluster autentication error. 69 | Server.TheConnectionAClusterIsNotEstablished = The connection a cluster is not established. 70 | Server.ThickClient = Thick client 71 | Server.ThinClient = Thin client 72 | Server.UnknownAgentVersion = Unknown 73 | Server.UnknownClient = Unknown client (%s) 74 | Server.UnresolvedAddress = Unresolved server address 75 | Server.WebClient = Web client 76 | 77 | SessionInfo.Application = Application 78 | SessionInfo.BlockedByDbms = Blocked by Dbms 79 | SessionInfo.BlockedByLs = Blocked by Ls 80 | SessionInfo.BytesAll = Data (all) 81 | SessionInfo.BytesLast5Min = Data (last 5 min) 82 | SessionInfo.CallsAll = Calls (all) 83 | SessionInfo.CallsLast5Min = Calls (last 5 min) 84 | SessionInfo.ClientIPAddress = Client IP Address 85 | SessionInfo.Computer = Computer 86 | SessionInfo.ConnectionN = Connection N 87 | SessionInfo.CpuTimeAll = Cpu time (all) 88 | SessionInfo.CpuTimeCurrent = Cpu time (current) 89 | SessionInfo.CpuTimeLast5Min = Cpu time (last 5 min) 90 | SessionInfo.CurrentServiceName = Current service 91 | SessionInfo.DataSeparation = Data separation 92 | SessionInfo.DbProcInfo = DB connection 93 | SessionInfo.DbProcTook = DB took 94 | SessionInfo.DbProcTookAt = DB took at 95 | SessionInfo.DbmsBytesAll = Dbms data (all) 96 | SessionInfo.DbmsBytesLast5Min = Dbms data (last 5 min) 97 | SessionInfo.DurationAll = Call duration (all) 98 | SessionInfo.DurationAllDbms = Call Dbms duration (all) 99 | SessionInfo.DurationAllService = Service duration (all) 100 | SessionInfo.DurationCurrent = Call duration (current) 101 | SessionInfo.DurationCurrentDbms = Call Dbms duration (current) 102 | SessionInfo.DurationCurrentService = Service duration (current) 103 | SessionInfo.DurationLast5Min = Call duration (last 5 min) 104 | SessionInfo.DurationLast5MinDbms = Call Dbms duration (last 5 min) 105 | SessionInfo.DurationLast5MinService = Call service duration (last 5 min) 106 | SessionInfo.Infobase = Infobase 107 | SessionInfo.IsSleep = Is sleep 108 | SessionInfo.KillAfter = Kill after 109 | SessionInfo.LastActiveAt = Last active at 110 | SessionInfo.License = License 111 | SessionInfo.MemoryCurrent = Memory (current) 112 | SessionInfo.MemoryLast5Min = Memory (last 5 min) 113 | SessionInfo.MemoryTotal = Memory (total) 114 | SessionInfo.PID = PID 115 | SessionInfo.Port = Port 116 | SessionInfo.ReadBytesCurrent = Read (current) 117 | SessionInfo.ReadBytesLast5Min = Read (last 5 min) 118 | SessionInfo.ReadBytesTotal = Read (total) 119 | SessionInfo.Server = Server 120 | SessionInfo.SessionN = Session N 121 | SessionInfo.SleepAfter = Sleep after 122 | SessionInfo.StartedAt = Started At 123 | SessionInfo.TitleDialog = Session info 124 | SessionInfo.Username = Username 125 | SessionInfo.WriteBytesCurrent = Write (current) 126 | SessionInfo.WriteBytesLast5Min = Write (last 5 min) 127 | SessionInfo.WriteBytesTotal = Write (total) 128 | 129 | TabText.ConnectionsCount = Connections (%s) 130 | TabText.LocksCount = Locks (%s) 131 | TabText.SessionsCount = Sessions (%s) 132 | TabText.WorkingProcessesCount = Working processes (%s) 133 | TabText.WorkingServersCount = Working servers (%s) 134 | 135 | WPInfo.Active = Active 136 | WPInfo.AvailablePerformance = Available performance 137 | WPInfo.BackCallTime = Back call time 138 | WPInfo.CallTime = Call time 139 | WPInfo.ClientThreads = Client threads 140 | WPInfo.ConnectionsCount = Connections 141 | WPInfo.DBCallTime = DB call time 142 | WPInfo.Enabled = Enabled 143 | WPInfo.LockCallTime = Lock call time 144 | WPInfo.Memory = Memory, Kb 145 | WPInfo.MemoryExceeded = Memory exceeded, sec 146 | WPInfo.NotUsed = No 147 | WPInfo.ProcessIsRunning = Yes 148 | WPInfo.ProcessIsStopped = No 149 | WPInfo.ServerCallTime = Server call time 150 | WPInfo.Used = Yes 151 | WPInfo.UsedAsReserve = As reserve 152 | WPInfo.Using = Using 153 | 154 | WSInfo.ConnPerProcessLimit = Connections per process limit 155 | WSInfo.CriticalProcessesTotalMemory = Critical processes\r\ntotal memory (byte) 156 | WSInfo.DedicatedManagers = Dedicated managers 157 | WSInfo.IBPerProcessLimit = IB per process limit 158 | WSInfo.IPPort = IP Port 159 | WSInfo.IPPortMainManager = IP Port main manager 160 | WSInfo.MainServer = Main server 161 | WSInfo.RangeIPPorts = Range IP ports 162 | WSInfo.SafeCallMemoryLimit = Safe call memory limit (byte) 163 | WSInfo.SafeWorkingProcessesMemoryLimit = Safe working processes memory limit (byte) 164 | WSInfo.TemporaryAllowedProcessesTotalMemory = Temporary allowed processes\r\ntotal memory (byte) 165 | WSInfo.TemporaryAllowedProcessesTotalMemoryTimeLimit = Temporary allowed processes\r\ntotal memory time limit (second) 166 | WSInfo.WorkingProcessMemoryLimit = Working process\r\nmemory limit (byte) 167 | --------------------------------------------------------------------------------