Save
Showing
70 changed files
with
226 additions
and
759 deletions
| ... | @@ -129,35 +129,34 @@ | ... | @@ -129,35 +129,34 @@ |
| 129 | <version>2.1</version> | 129 | <version>2.1</version> |
| 130 | <scope>provided</scope> | 130 | <scope>provided</scope> |
| 131 | </dependency> | 131 | </dependency> |
| 132 | <dependency> | 132 | <dependency> |
| 133 | <groupId>javax.servlet</groupId> | 133 | <groupId>javax.servlet</groupId> |
| 134 | <artifactId>jstl</artifactId> | 134 | <artifactId>jstl</artifactId> |
| 135 | <version>1.2</version> | 135 | <version>1.2</version> |
| 136 | </dependency> | 136 | </dependency> |
| 137 | 137 | ||
| 138 | 138 | ||
| 139 | <!-- Test --> | 139 | <!-- Test --> |
| 140 | <dependency> | 140 | <dependency> |
| 141 | <groupId>junit</groupId> | 141 | <groupId>junit</groupId> |
| 142 | <artifactId>junit</artifactId> | 142 | <artifactId>junit</artifactId> |
| 143 | <version>4.7</version> | 143 | <version>4.7</version> |
| 144 | <scope>test</scope> | 144 | <scope>test</scope> |
| 145 | </dependency> | 145 | </dependency> |
| 146 | 146 | ||
| 147 | |||
| 148 | <dependency> | 147 | <dependency> |
| 149 | <groupId>org.emercit</groupId> | 148 | <groupId>org.emercit</groupId> |
| 150 | <artifactId>utilstools</artifactId> | 149 | <artifactId>utilstools</artifactId> |
| 151 | <version>1.31</version> | 150 | <version>1.45</version> |
| 152 | </dependency> | 151 | </dependency> |
| 153 | 152 | ||
| 154 | <dependency> | 153 | <dependency> |
| 155 | <groupId>log4j</groupId> | 154 | <groupId>log4j</groupId> |
| 156 | <artifactId>log4j</artifactId> | 155 | <artifactId>log4j</artifactId> |
| 157 | <version>1.2.14</version> | 156 | <version>1.2.14</version> |
| 158 | <type>jar</type> | 157 | <type>jar</type> |
| 159 | <scope>compile</scope> | 158 | <scope>compile</scope> |
| 160 | </dependency> | 159 | </dependency> |
| 161 | 160 | ||
| 162 | 161 | ||
| 163 | </dependencies> | 162 | </dependencies> | ... | ... |
No preview for this file type
| 1 | 391650b476d0bde1224640b76f5a7622 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 4bd444371ee6b32a96e4c07a62ecac97dabe4238 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>utilstools</artifactId> | ||
| 7 | <version>1.37</version> | ||
| 8 | </project> |
| 1 | 797d1a192c1ddd5f1bd7312d281ec179 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | b34800578a39f4f1d61fafce7f63c481037c43bd | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | 683b081a011b55a0e20feeea445c8205 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 3da196bee3c728176ded668347e4c0fa544a721e | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>utilstools</artifactId> | ||
| 7 | <version>1.38</version> | ||
| 8 | </project> |
| 1 | 3258394054c57faf212d6c10debb239a | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 7de1953ec4041c05baf8c06472d35c4934071120 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | 69a4a04599977f7f3c057bedf3cac960 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 44954156ec33fa56489f6cc38d21a91d8097f7ee | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>utilstools</artifactId> | ||
| 7 | <version>1.39</version> | ||
| 8 | </project> |
| 1 | fa25319280078b7b977ca2e82ef41343 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | a2c8fba735d34c4799822e777f8509d6575ee98a | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | b8a424099e961fcdf28b16c81384e4b1 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 12c2d76ddf54db9582b7c6934a57fd618633dc02 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>utilstools</artifactId> | ||
| 7 | <version>1.40</version> | ||
| 8 | </project> |
| 1 | 58db6e9779356078de40cdba9a727881 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 04f4e1b3b4e91f3cc02455cb1e97c14c34b42b5f | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | 7bf6e4f082aacf05c97c440821bf1f80 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 46a9cf9971443a55d78e677cba7bba0fb0ad8803 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>utilstools</artifactId> | ||
| 7 | <version>1.41</version> | ||
| 8 | </project> |
| 1 | e5d847876d86da58033dc510f1442189 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | f296f9a9991e08f52cddb41ca00abca00620f120 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | db6a41e9a811bd43265e7e85864781aa | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 579a4e261dbc22ddce2a7effea5ca9afca10e437 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>utilstools</artifactId> | ||
| 7 | <version>1.42</version> | ||
| 8 | </project> |
| 1 | 3b7539b79092b604a38496529d5e8a7a | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 86b7ad0c55294ee65e2730c4b1737e331556561a | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | 7879f7b7e9fa12c6d38e02448689bb24 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 5fa041999fef685b156663188c7132a3d00161fd | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | <modelVersion>4.0.0</modelVersion> | ||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>utilstools</artifactId> | ||
| 7 | <version>1.45</version> | ||
| 8 | </project> |
| 1 | 1f369015de038ed3800bd30fcfa66ffd | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | c1fd442932616437d6c617e4dd3368ae36da9267 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
| 3 | <groupId>org.emercit</groupId> | 3 | <groupId>org.emercit</groupId> |
| 4 | <artifactId>utilstools</artifactId> | 4 | <artifactId>utilstools</artifactId> |
| 5 | <versioning> | 5 | <versioning> |
| 6 | <release>1.36</release> | 6 | <release>1.45</release> |
| 7 | <versions> | 7 | <versions> |
| 8 | <version>1.0</version> | 8 | <version>1.0</version> |
| 9 | <version>1.1</version> | 9 | <version>1.1</version> |
| ... | @@ -42,7 +42,14 @@ | ... | @@ -42,7 +42,14 @@ |
| 42 | <version>1.34</version> | 42 | <version>1.34</version> |
| 43 | <version>1.35</version> | 43 | <version>1.35</version> |
| 44 | <version>1.36</version> | 44 | <version>1.36</version> |
| 45 | <version>1.37</version> | ||
| 46 | <version>1.38</version> | ||
| 47 | <version>1.39</version> | ||
| 48 | <version>1.40</version> | ||
| 49 | <version>1.41</version> | ||
| 50 | <version>1.42</version> | ||
| 51 | <version>1.45</version> | ||
| 45 | </versions> | 52 | </versions> |
| 46 | <lastUpdated>20150808085500</lastUpdated> | 53 | <lastUpdated>20150811122648</lastUpdated> |
| 47 | </versioning> | 54 | </versioning> |
| 48 | </metadata> | 55 | </metadata> | ... | ... |
| ... | @@ -6,7 +6,7 @@ import org.emercit.model.IPAddressValidator; | ... | @@ -6,7 +6,7 @@ import org.emercit.model.IPAddressValidator; |
| 6 | 6 | ||
| 7 | import java.util.Vector; | 7 | import java.util.Vector; |
| 8 | 8 | ||
| 9 | 9 | import org.emercit.utilstools.config.Msg; | |
| 10 | import org.emercit.utilstools.servers.model.ServerBean; | 10 | import org.emercit.utilstools.servers.model.ServerBean; |
| 11 | import org.emercit.utilstools.servers.service.Servers; | 11 | import org.emercit.utilstools.servers.service.Servers; |
| 12 | public enum RemoteServerManager { | 12 | public enum RemoteServerManager { |
| ... | @@ -41,9 +41,10 @@ public enum RemoteServerManager { | ... | @@ -41,9 +41,10 @@ public enum RemoteServerManager { |
| 41 | public int Update(ServerBean b) { | 41 | public int Update(ServerBean b) { |
| 42 | 42 | ||
| 43 | beans=store.get(); | 43 | beans=store.get(); |
| 44 | 44 | ||
| 45 | int code=Msg.RemoteUpdateError.getCode(); | ||
| 45 | 46 | ||
| 46 | for (ServerBean bean:beans) { | 47 | for (ServerBean bean:beans) { |
| 47 | 48 | ||
| 48 | 49 | ||
| 49 | if (bean.getId()==b.getId()) { | 50 | if (bean.getId()==b.getId()) { |
| ... | @@ -53,11 +54,13 @@ public enum RemoteServerManager { | ... | @@ -53,11 +54,13 @@ public enum RemoteServerManager { |
| 53 | bean.setIp(b.getIp()); | 54 | bean.setIp(b.getIp()); |
| 54 | bean.setPort(b.getPort()); | 55 | bean.setPort(b.getPort()); |
| 55 | 56 | ||
| 56 | return store.set(beans); | 57 | code=store.set(beans); |
| 57 | 58 | ||
| 58 | } | 59 | } |
| 60 | |||
| 59 | } | 61 | } |
| 60 | return 2; | 62 | return code; |
| 63 | |||
| 61 | } | 64 | } |
| 62 | } | 65 | } |
| 63 | 66 | ... | ... |
| ... | @@ -43,18 +43,8 @@ public enum SvService { | ... | @@ -43,18 +43,8 @@ public enum SvService { |
| 43 | svbeans=sv.get(); | 43 | svbeans=sv.get(); |
| 44 | 44 | ||
| 45 | for (SvBean s:svbeans) { // проверяем запущен или остановлен | 45 | for (SvBean s:svbeans) { // проверяем запущен или остановлен |
| 46 | try { | 46 | try { s.setIsrun(st.IsRun(s.getProcess())); } catch (Exception e) { log.error(e.getMessage());}; |
| 47 | boolean status=st.IsRun(s.getProcess()); | ||
| 48 | |||
| 49 | log.info("Процесс:"+status); | ||
| 50 | |||
| 51 | } catch (Exception e) { | ||
| 52 | |||
| 53 | } | ||
| 54 | |||
| 55 | try { s.setIsrun(st.IsRun(s.getProcess())); } catch (Exception e) {}; | ||
| 56 | } | 47 | } |
| 57 | |||
| 58 | return svbeans; | 48 | return svbeans; |
| 59 | } | 49 | } |
| 60 | 50 | ... | ... |
| ... | @@ -59,11 +59,13 @@ Ext.define('App.controller.Dns', { | ... | @@ -59,11 +59,13 @@ Ext.define('App.controller.Dns', { |
| 59 | success: function(response, opts) { | 59 | success: function(response, opts) { |
| 60 | 60 | ||
| 61 | 61 | ||
| 62 | 62 | var result = Ext.JSON.decode(response.responseText); | |
| 63 | }, failure: function(response, opts) { | 63 | |
| 64 | 64 | Ext.Msg.alert(result.type+" "+"Код-"+result.code,result.message); | |
| 65 | Ext.Msg.alert('Failure', 'Ошибка сохранения'); | 65 | |
| 66 | } | 66 | }, failure: function(response, opts) { |
| 67 | Ext.Msg.alert('Ошибка', 'Сервер недоступен'); | ||
| 68 | } | ||
| 67 | }); | 69 | }); |
| 68 | 70 | ||
| 69 | 71 | ... | ... |
| ... | @@ -66,7 +66,7 @@ Ext.define('App.controller.MainConfig', { | ... | @@ -66,7 +66,7 @@ Ext.define('App.controller.MainConfig', { |
| 66 | 66 | ||
| 67 | var result = Ext.JSON.decode(response.responseText); | 67 | var result = Ext.JSON.decode(response.responseText); |
| 68 | 68 | ||
| 69 | // Ext.Msg.alert(result.type+" "+"Код-"+result.code,result.message); | 69 | Ext.Msg.alert(result.type+" "+"Код-"+result.code,result.message); |
| 70 | 70 | ||
| 71 | }, failure: function(response, opts) { | 71 | }, failure: function(response, opts) { |
| 72 | Ext.Msg.alert('Ошибка', 'Сервер недоступен'); | 72 | Ext.Msg.alert('Ошибка', 'Сервер недоступен'); | ... | ... |
| ... | @@ -65,11 +65,11 @@ Ext.define('App.controller.RemoteServer', { | ... | @@ -65,11 +65,11 @@ Ext.define('App.controller.RemoteServer', { |
| 65 | 65 | ||
| 66 | 66 | ||
| 67 | remoteserver = { | 67 | remoteserver = { |
| 68 | id:1, | 68 | id:0, |
| 69 | name:NameRemoteServer, | 69 | name:NameRemoteServer, |
| 70 | ip:IpRemoteServer, | 70 | ip:IpRemoteServer, |
| 71 | port:parseInt(PortRemoteServer), | 71 | port:parseInt(PortRemoteServer), |
| 72 | type:"", | 72 | type:"szs", |
| 73 | title:TitleRemoteServer, | 73 | title:TitleRemoteServer, |
| 74 | }; | 74 | }; |
| 75 | 75 | ... | ... |
| ... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
| 3 | <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> | 3 | <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
| 4 | 4 | ||
| 5 | <!-- Appenders --> | 5 | <!-- Appenders --> |
| 6 | <appender name="console" class="org.apache.log4j.ConsoleAppender"> | 6 | <appender name="consoleappender" class="org.apache.log4j.ConsoleAppender"> |
| 7 | <param name="Target" value="System.out" /> | 7 | <param name="Target" value="System.out" /> |
| 8 | <layout class="org.apache.log4j.PatternLayout"> | 8 | <layout class="org.apache.log4j.PatternLayout"> |
| 9 | <param name="ConversionPattern" value="%-5p: %c - %m%n" /> | 9 | <param name="ConversionPattern" value="%-5p: %c - %m%n" /> |
| ... | @@ -11,60 +11,60 @@ | ... | @@ -11,60 +11,60 @@ |
| 11 | </appender> | 11 | </appender> |
| 12 | 12 | ||
| 13 | <!-- LOG FILE --> | 13 | <!-- LOG FILE --> |
| 14 | <appender name="file" class="org.apache.log4j.FileAppender"> | 14 | <appender name="fileappender" class="org.apache.log4j.FileAppender"> |
| 15 | <param name="File" value="/var/log/devtools.log" /> | 15 | <param name="File" value="/var/log/devtools.log" /> |
| 16 | <param name="MaxFileSize" value="10KB"/> | 16 | <param name="MaxFileSize" value="10KB"/> |
| 17 | <layout class="org.apache.log4j.PatternLayout"> | 17 | <layout class="org.apache.log4j.PatternLayout"> |
| 18 | <param name="ConversionPattern" value="%-7p %d [%t] %c %x - %m%n"/> | 18 | <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSSS} %p %t %c \u2013 %m%n"/> |
| 19 | </layout> | 19 | </layout> |
| 20 | </appender> | 20 | </appender> |
| 21 | |||
| 22 | |||
| 23 | <appender name="socketappender" class="org.apache.log4j.net.SocketAppender"> | ||
| 24 | <param name="RemoteHost" value="localhost"/> | ||
| 25 | <param name="Port" value="4560"/> | ||
| 26 | <param name="LocationInfo" value="true"/> | ||
| 27 | <layout class="org.apache.log4j.PatternLayout"> | ||
| 28 | <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSSS} %p %t %c \u2013 %m%n"/> | ||
| 29 | </layout> | ||
| 30 | </appender> | ||
| 21 | 31 | ||
| 22 | 32 | ||
| 23 | <!-- Application Loggers --> | ||
| 24 | <logger name="org.emercit.app"> | ||
| 25 | 33 | ||
| 26 | <level value="info" /> | 34 | <logger name="org.emercit.utilstools"> |
| 27 | <appender-ref ref="console" /> | 35 | <level value="all" /> |
| 28 | <!--<appender-ref ref="file" />--> | 36 | <appender-ref ref="socketappender" /> |
| 29 | </logger> | 37 | </logger> |
| 30 | 38 | ||
| 31 | 39 | ||
| 32 | <logger name="org.emercit"> | ||
| 33 | <level value="info" /> | ||
| 34 | <appender-ref ref="console" /> | ||
| 35 | <!-- <appender-ref ref="file" />--> | ||
| 36 | </logger> | ||
| 37 | |||
| 38 | 40 | ||
| 39 | <!-- rdparty Loggers --> | 41 | |
| 40 | <logger name="org.springframework.core"> | 42 | <logger name="org.springframework.core"> |
| 41 | <level value="info" /> | 43 | <level value="info" /> |
| 42 | <appender-ref ref="console" /> | 44 | <appender-ref ref="consoleappender" /> |
| 43 | <!-- <appender-ref ref="file" /> --> | 45 | |
| 44 | </logger> | 46 | </logger> |
| 45 | 47 | ||
| 46 | <logger name="org.springframework.beans"> | 48 | <logger name="org.springframework.beans"> |
| 47 | <level value="info" /> | 49 | <level value="info" /> |
| 48 | <appender-ref ref="console" /> | 50 | <appender-ref ref="consoleappender" /> |
| 49 | <!-- <appender-ref ref="file" /> --> | 51 | |
| 50 | </logger> | 52 | </logger> |
| 51 | 53 | ||
| 52 | <logger name="org.springframework.context"> | 54 | <logger name="org.springframework.context"> |
| 53 | <level value="info" /> | 55 | <level value="info" /> |
| 54 | <appender-ref ref="console" /> | 56 | <appender-ref ref="consoleappender" /> |
| 55 | <!--<appender-ref ref="file" />--> | 57 | |
| 56 | </logger> | 58 | </logger> |
| 57 | 59 | ||
| 58 | <logger name="org.springframework.web"> | 60 | <logger name="org.springframework.web"> |
| 59 | <level value="info" /> | 61 | <level value="info" /> |
| 60 | <appender-ref ref="console" /> | 62 | <appender-ref ref="consoleappender" /> |
| 61 | <!-- <appender-ref ref="file" /> --> | ||
| 62 | </logger> | 63 | </logger> |
| 63 | 64 | ||
| 64 | <!-- Root Logger --> | ||
| 65 | <root> | 65 | <root> |
| 66 | <priority value="warn" /> | 66 | <priority value="warn" /> |
| 67 | <appender-ref ref="console" /> | 67 | <appender-ref ref="consoleappender" /> |
| 68 | </root> | 68 | </root> |
| 69 | 69 | ||
| 70 | </log4j:configuration> | 70 | </log4j:configuration> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -14,16 +14,6 @@ public class App | ... | @@ -14,16 +14,6 @@ public class App |
| 14 | 14 | ||
| 15 | public static void main( String[] args ) | 15 | public static void main( String[] args ) |
| 16 | { | 16 | { |
| 17 | /* | ||
| 18 | Settings settings=new Settings(); | ||
| 19 | 17 | ||
| 20 | settings.init(); | ||
| 21 | |||
| 22 | SettingsBean settingsbean=settings.make(); | ||
| 23 | |||
| 24 | settings.set(settingsbean); | ||
| 25 | |||
| 26 | System.out.println(""); | ||
| 27 | */ | ||
| 28 | } | 18 | } |
| 29 | } | 19 | } | ... | ... |
| ... | @@ -30,7 +30,7 @@ public class DefSettings { | ... | @@ -30,7 +30,7 @@ public class DefSettings { |
| 30 | public static final boolean Eth1_dhcp=false; | 30 | public static final boolean Eth1_dhcp=false; |
| 31 | public static final String Eth1_ip="192.168.99.1"; | 31 | public static final String Eth1_ip="192.168.99.1"; |
| 32 | public static final String Eth1_netmask="255.255.255.0"; | 32 | public static final String Eth1_netmask="255.255.255.0"; |
| 33 | public static final String Eth1_gateway="192.168.99.2"; | 33 | public static final String Eth1_gateway="192.168.99.1"; |
| 34 | public static final String Eth1_broadcast=""; | 34 | public static final String Eth1_broadcast=""; |
| 35 | public static final String Eth1_extinfo=""; | 35 | public static final String Eth1_extinfo=""; |
| 36 | //GSM | 36 | //GSM | ... | ... |
| 1 | package org.emercit.utilstools.config; | 1 | package org.emercit.utilstools.config; |
| 2 | 2 | ||
| 3 | import org.apache.log4j.Logger; | ||
| 3 | import org.emercit.utilstools.config.TypeMsg; | 4 | import org.emercit.utilstools.config.TypeMsg; |
| 4 | |||
| 5 | import org.emercit.utilstools.config.MsgResult; | 5 | import org.emercit.utilstools.config.MsgResult; |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | public enum Msg { | 8 | public enum Msg { |
| 9 | 9 | ||
| 10 | |||
| 11 | |||
| 10 | SaveFileSucc(1,TypeMsg.INFO,"Сохранение успешно выполнено"), | 12 | SaveFileSucc(1,TypeMsg.INFO,"Сохранение успешно выполнено"), |
| 11 | SaveFileError(2,TypeMsg.ERROR,"Ошибка при сохранении"), | 13 | SaveFileError(2,TypeMsg.ERROR,"Ошибка при сохранении"), |
| 12 | 14 | ||
| ... | @@ -54,7 +56,26 @@ public enum Msg { | ... | @@ -54,7 +56,26 @@ public enum Msg { |
| 54 | NTPUpdateError(27,TypeMsg.ERROR,"Конфигурация NTP не выполнена"), | 56 | NTPUpdateError(27,TypeMsg.ERROR,"Конфигурация NTP не выполнена"), |
| 55 | 57 | ||
| 56 | ProxyUpdateSucc(28,TypeMsg.INFO,"Конфигурация Proxy выполнена успешно"), | 58 | ProxyUpdateSucc(28,TypeMsg.INFO,"Конфигурация Proxy выполнена успешно"), |
| 57 | ProxyUpdateError(29,TypeMsg.ERROR,"Конфигурация Proxy не выполнена"); | 59 | ProxyUpdateError(29,TypeMsg.ERROR,"Конфигурация Proxy не выполнена"), |
| 60 | |||
| 61 | |||
| 62 | DescriptionUpdateSucc(30,TypeMsg.INFO,"Конфигурация описания устройства выполнена успешно"), | ||
| 63 | DescriptionUpdateError(31,TypeMsg.ERROR,"Конфигурация описания устройства не выполнена"), | ||
| 64 | |||
| 65 | |||
| 66 | RemoteServerUpdateSucc(32,TypeMsg.INFO,"Конфигурация удаленного сервера выполнена успешно"), | ||
| 67 | RemoteUpdateError(33,TypeMsg.ERROR,"Конфигурация удаленного сервера не выполнена"), | ||
| 68 | |||
| 69 | |||
| 70 | EthUpdateSucc(33,TypeMsg.INFO,"Конфигурация сетевого интерфейса eth0 выполнена успешно"), | ||
| 71 | EthError(34,TypeMsg.ERROR,"Конфигурация сетевого интерфейса eth0 не выполнена"), | ||
| 72 | |||
| 73 | |||
| 74 | GsmUpdateSucc(35,TypeMsg.INFO,"Конфигурация GSM выполнена успешно"), | ||
| 75 | GsmUpdateError(36,TypeMsg.ERROR,"Конфигурация GSM не выполнена"); | ||
| 76 | |||
| 77 | |||
| 78 | private static final Logger log = Logger.getLogger(Msg.class); | ||
| 58 | 79 | ||
| 59 | 80 | ||
| 60 | private int code; | 81 | private int code; |
| ... | @@ -89,22 +110,23 @@ public enum Msg { | ... | @@ -89,22 +110,23 @@ public enum Msg { |
| 89 | return this.description; | 110 | return this.description; |
| 90 | } | 111 | } |
| 91 | 112 | ||
| 92 | |||
| 93 | static public MsgResult getMsgResultByCode(int code) { | 113 | static public MsgResult getMsgResultByCode(int code) { |
| 94 | 114 | ||
| 95 | |||
| 96 | for (Msg v: Msg.values()) { | 115 | for (Msg v: Msg.values()) { |
| 97 | if (v.getCode()==code) { | 116 | if (v.getCode()==code) { |
| 98 | MsgResult result=new MsgResult(); | 117 | MsgResult result=new MsgResult(); |
| 99 | result.code=v.getCode(); | 118 | result.code=v.getCode(); |
| 100 | result.type=v.getTypeVariable().getDescription(); | 119 | result.type=v.getTypeVariable().getDescription(); |
| 101 | result.message=v.getDescription(); | 120 | result.message=v.getDescription(); |
| 121 | |||
| 122 | if (v.getTypeVariable().getCode()==0) { | ||
| 123 | log.info("Код:"+result.code+", "+"Тип:"+result.type+", "+"Текст:"+result.message); | ||
| 124 | }else { | ||
| 125 | log.error("Код:"+result.code+", "+"Тип:"+result.type+", "+"Текст:"+result.message); | ||
| 126 | } | ||
| 102 | return result; | 127 | return result; |
| 103 | } | 128 | } |
| 104 | } | 129 | } |
| 105 | return null; | 130 | return null; |
| 106 | |||
| 107 | } | 131 | } |
| 108 | |||
| 109 | |||
| 110 | } | 132 | } | ... | ... |
| ... | @@ -23,6 +23,6 @@ public class Paths { | ... | @@ -23,6 +23,6 @@ public class Paths { |
| 23 | public static final String JETTY="jetty"; | 23 | public static final String JETTY="jetty"; |
| 24 | public static final String CTRLPNL="ctrlpnl"; | 24 | public static final String CTRLPNL="ctrlpnl"; |
| 25 | 25 | ||
| 26 | public static final String UTILSTOOLS_LOGFILE="/var/log/devtools.log"; | 26 | public static final String UTILSTOOLS_LOGFILE="/var/log/device.log"; |
| 27 | 27 | ||
| 28 | } | 28 | } | ... | ... |
UtilsTools/src/main/java/org/emercit/utilstools/controldevtools/bean/ControlDeviceBean.java
deleted
100644 → 0
| 1 | package org.emercit.utilstools.controldevtools.bean; | ||
| 2 | |||
| 3 | import java.awt.Color; | ||
| 4 | import java.awt.Dimension; | ||
| 5 | import java.awt.EventQueue; | ||
| 6 | import java.awt.Font; | ||
| 7 | import java.awt.Graphics; | ||
| 8 | import java.awt.event.ActionEvent; | ||
| 9 | import java.awt.event.ActionListener; | ||
| 10 | import java.beans.PropertyChangeListener; | ||
| 11 | import java.beans.PropertyVetoException; | ||
| 12 | import java.beans.VetoableChangeListener; | ||
| 13 | import java.beans.VetoableChangeSupport; | ||
| 14 | import java.io.Externalizable; | ||
| 15 | import java.io.IOException; | ||
| 16 | import java.io.ObjectInput; | ||
| 17 | import java.io.ObjectOutput; | ||
| 18 | import java.util.Timer; | ||
| 19 | import java.util.TimerTask; | ||
| 20 | |||
| 21 | import javax.swing.ImageIcon; | ||
| 22 | import javax.swing.JButton; | ||
| 23 | import javax.swing.JComponent; | ||
| 24 | import javax.swing.JFrame; | ||
| 25 | import javax.swing.JLabel; | ||
| 26 | import javax.swing.SwingWorker; | ||
| 27 | import javax.swing.event.ChangeEvent; | ||
| 28 | import javax.swing.event.ChangeListener; | ||
| 29 | import javax.swing.event.EventListenerList; | ||
| 30 | import javax.swing.event.SwingPropertyChangeSupport; | ||
| 31 | |||
| 32 | import org.apache.log4j.Logger; | ||
| 33 | import org.emercit.utilstools.config.DefSettings; | ||
| 34 | import org.emercit.utilstools.pckutils.checkservice.STService; | ||
| 35 | import org.emercit.utilstools.service.Settings; | ||
| 36 | import org.emercit.utilstools.svmanager.model.SvBean; | ||
| 37 | import org.emercit.utilstools.svmanager.service.Sv; | ||
| 38 | import org.emercit.utilstools.svmanager.service.SvControl; | ||
| 39 | import org.emercit.utilstools.sshexec.SSHExec; | ||
| 40 | |||
| 41 | public class ControlDeviceBean extends RoundPanel implements Externalizable { | ||
| 42 | |||
| 43 | private static final Logger log = Logger.getLogger(DevToolsBean.class); | ||
| 44 | |||
| 45 | private Dimension beanDimension; // simple | ||
| 46 | |||
| 47 | protected EventListenerList listenerList = new EventListenerList(); | ||
| 48 | |||
| 49 | private JLabel lblStatus=new JLabel(); | ||
| 50 | private JButton btnOffStart=new JButton(); | ||
| 51 | private JButton btnRebootStart=new JButton(); | ||
| 52 | |||
| 53 | private SSHExec sshecex=new SSHExec(); | ||
| 54 | |||
| 55 | private Font font = new Font(null, Font.ITALIC, 13); | ||
| 56 | |||
| 57 | public ControlDeviceBean() { | ||
| 58 | |||
| 59 | this.setLayout(null); | ||
| 60 | this.setBackground(new Color(168, 181, 224)); // blue | ||
| 61 | |||
| 62 | beanDimension = new Dimension(600, 130); | ||
| 63 | |||
| 64 | // BUTTON OFF | ||
| 65 | btnOffStart.setIcon(new ImageIcon(DevToolsBean.class.getResource("/offDevice.png"))); | ||
| 66 | btnOffStart.setBounds(10,30,190,55); | ||
| 67 | btnOffStart.setFont(font); | ||
| 68 | btnOffStart.setText("Выключить"); | ||
| 69 | btnOffStart.setSelected(false); | ||
| 70 | btnOffStart.addActionListener(new Off()); | ||
| 71 | add(btnOffStart); | ||
| 72 | |||
| 73 | // BUTTON REBOOT | ||
| 74 | btnRebootStart.setIcon(new ImageIcon(DevToolsBean.class.getResource("/reloadDevice.png"))); | ||
| 75 | btnRebootStart.setBounds(220,30,190,55); | ||
| 76 | btnRebootStart.setFont(font); | ||
| 77 | btnRebootStart.setText("Перезагрузить"); | ||
| 78 | btnRebootStart.setSelected(false); | ||
| 79 | btnRebootStart.addActionListener(new Reboot()); | ||
| 80 | add(btnRebootStart); | ||
| 81 | |||
| 82 | // STATUS | ||
| 83 | font = new Font(null, Font.ITALIC, 18); | ||
| 84 | lblStatus.setBounds(10,80,600,55); | ||
| 85 | lblStatus.setForeground(Color.YELLOW); | ||
| 86 | lblStatus.setText(""); | ||
| 87 | lblStatus.setVisible(true); | ||
| 88 | lblStatus.setFont(font); | ||
| 89 | add(lblStatus); | ||
| 90 | |||
| 91 | } | ||
| 92 | |||
| 93 | public class Off implements ActionListener | ||
| 94 | { | ||
| 95 | public void actionPerformed(ActionEvent e) | ||
| 96 | { | ||
| 97 | new SwingWorker<Void, Void>() | ||
| 98 | { | ||
| 99 | protected Void doInBackground() throws Exception | ||
| 100 | { | ||
| 101 | lblStatus.setText("выполняется выключение..."); | ||
| 102 | sshecex.setCmd("shutdown -h now"); | ||
| 103 | sshecex.Exec(); | ||
| 104 | return null; | ||
| 105 | } | ||
| 106 | }.execute(); | ||
| 107 | } | ||
| 108 | } | ||
| 109 | |||
| 110 | public class Reboot implements ActionListener | ||
| 111 | { | ||
| 112 | public void actionPerformed(ActionEvent e) | ||
| 113 | { | ||
| 114 | |||
| 115 | new SwingWorker<Void, Void>() | ||
| 116 | { | ||
| 117 | protected Void doInBackground() throws Exception | ||
| 118 | { | ||
| 119 | lblStatus.setText("выполняется перезагрузка..."); | ||
| 120 | sshecex.setCmd("reboot"); | ||
| 121 | sshecex.Exec(); | ||
| 122 | return null; | ||
| 123 | } | ||
| 124 | |||
| 125 | }.execute(); | ||
| 126 | |||
| 127 | } | ||
| 128 | } | ||
| 129 | |||
| 130 | |||
| 131 | public void paintComponent(Graphics g) { | ||
| 132 | super.paintComponent(g); | ||
| 133 | } | ||
| 134 | |||
| 135 | public void setPreferredSize(Dimension dim) { | ||
| 136 | beanDimension = dim; | ||
| 137 | } | ||
| 138 | |||
| 139 | public Dimension getPreferredSize() { | ||
| 140 | return beanDimension; | ||
| 141 | } | ||
| 142 | |||
| 143 | public void setMinimumSize(Dimension dim) { | ||
| 144 | beanDimension = dim; | ||
| 145 | } | ||
| 146 | |||
| 147 | public Dimension getMinimumSize() { | ||
| 148 | return beanDimension; | ||
| 149 | } | ||
| 150 | |||
| 151 | public void addChangeListener(ChangeListener l) { | ||
| 152 | listenerList.add(ChangeListener.class, l); | ||
| 153 | } | ||
| 154 | |||
| 155 | public void removeChangeListener(ChangeListener l) { | ||
| 156 | listenerList.remove(ChangeListener.class, l); | ||
| 157 | } | ||
| 158 | |||
| 159 | public void writeExternal(ObjectOutput out) throws IOException { | ||
| 160 | out.writeObject(beanDimension); | ||
| 161 | } | ||
| 162 | |||
| 163 | public void readExternal(ObjectInput in) throws IOException, | ||
| 164 | ClassNotFoundException { | ||
| 165 | setPreferredSize((Dimension) in.readObject()); | ||
| 166 | setMinimumSize(getPreferredSize()); | ||
| 167 | } | ||
| 168 | |||
| 169 | public static void main(String[] args) { | ||
| 170 | JFrame frame = new JFrame(""); | ||
| 171 | frame.getContentPane().add(new ControlDeviceBean()); | ||
| 172 | frame.setVisible(true); | ||
| 173 | frame.pack(); | ||
| 174 | } | ||
| 175 | } |
UtilsTools/src/main/java/org/emercit/utilstools/controldevtools/bean/DevToolsBean.java
deleted
100644 → 0
| 1 | package org.emercit.utilstools.controldevtools.bean; | ||
| 2 | |||
| 3 | import java.awt.Color; | ||
| 4 | import java.awt.Dimension; | ||
| 5 | import java.awt.EventQueue; | ||
| 6 | import java.awt.Font; | ||
| 7 | import java.awt.Graphics; | ||
| 8 | import java.awt.event.ActionEvent; | ||
| 9 | import java.awt.event.ActionListener; | ||
| 10 | import java.beans.PropertyChangeListener; | ||
| 11 | import java.beans.PropertyVetoException; | ||
| 12 | import java.beans.VetoableChangeListener; | ||
| 13 | import java.beans.VetoableChangeSupport; | ||
| 14 | import java.io.Externalizable; | ||
| 15 | import java.io.IOException; | ||
| 16 | import java.io.ObjectInput; | ||
| 17 | import java.io.ObjectOutput; | ||
| 18 | import java.util.Timer; | ||
| 19 | import java.util.TimerTask; | ||
| 20 | |||
| 21 | import javax.swing.ImageIcon; | ||
| 22 | import javax.swing.JButton; | ||
| 23 | import javax.swing.JComponent; | ||
| 24 | import javax.swing.JFrame; | ||
| 25 | import javax.swing.JLabel; | ||
| 26 | import javax.swing.SwingWorker; | ||
| 27 | import javax.swing.event.ChangeEvent; | ||
| 28 | import javax.swing.event.ChangeListener; | ||
| 29 | import javax.swing.event.EventListenerList; | ||
| 30 | import javax.swing.event.SwingPropertyChangeSupport; | ||
| 31 | |||
| 32 | import org.apache.log4j.Logger; | ||
| 33 | import org.emercit.utilstools.config.DefSettings; | ||
| 34 | import org.emercit.utilstools.pckutils.checkservice.STService; | ||
| 35 | import org.emercit.utilstools.service.Settings; | ||
| 36 | import org.emercit.utilstools.svmanager.model.SvBean; | ||
| 37 | import org.emercit.utilstools.svmanager.service.Sv; | ||
| 38 | import org.emercit.utilstools.svmanager.service.SvControl; | ||
| 39 | |||
| 40 | public class DevToolsBean extends RoundPanel implements Externalizable { | ||
| 41 | |||
| 42 | private static final Logger log = Logger.getLogger(DevToolsBean.class); | ||
| 43 | |||
| 44 | private Dimension beanDimension; // simple | ||
| 45 | |||
| 46 | private JLabel lblTitle=new JLabel(); | ||
| 47 | |||
| 48 | private JLabel lblStatus=new JLabel(); | ||
| 49 | |||
| 50 | private JButton btnStart=new JButton("ЗАПУСТИТЬ"); | ||
| 51 | |||
| 52 | private JButton btnStop=new JButton("ОСТАНОВИТЬ"); | ||
| 53 | |||
| 54 | private JButton btnDefaults=new JButton("СБРОС НАСТРОЕК"); | ||
| 55 | |||
| 56 | private STService stservice=new STService(); | ||
| 57 | |||
| 58 | private Timer timerAnimate=new Timer(); | ||
| 59 | |||
| 60 | private Settings settings=new Settings(); | ||
| 61 | |||
| 62 | protected transient ChangeEvent changeEvent = null; | ||
| 63 | |||
| 64 | public Update update=null; | ||
| 65 | |||
| 66 | public boolean block=false; | ||
| 67 | |||
| 68 | public SvBean svbean; | ||
| 69 | |||
| 70 | public SvControl svcontrol; | ||
| 71 | |||
| 72 | public Sv sv; | ||
| 73 | |||
| 74 | |||
| 75 | |||
| 76 | |||
| 77 | protected EventListenerList listenerList = new EventListenerList(); | ||
| 78 | |||
| 79 | |||
| 80 | public DevToolsBean() { | ||
| 81 | |||
| 82 | this.setLayout(null); | ||
| 83 | this.setBackground(new Color(168, 181, 224)); // blue | ||
| 84 | |||
| 85 | beanDimension = new Dimension(600, 130); | ||
| 86 | |||
| 87 | Font font = new Font(null, Font.ITALIC, 13); | ||
| 88 | lblTitle.setBounds(10, 2, 600, 30); | ||
| 89 | |||
| 90 | lblTitle.setText(DefSettings.devtools_title); | ||
| 91 | lblTitle.setFont(font); | ||
| 92 | lblTitle.setForeground(Color.BLUE); | ||
| 93 | add(lblTitle); | ||
| 94 | |||
| 95 | // BUTTON START | ||
| 96 | btnStart.setIcon(new ImageIcon(DevToolsBean.class.getResource("/start.png"))); | ||
| 97 | btnStart.setBounds(10,30,150,40); | ||
| 98 | btnStart.setFont(font); | ||
| 99 | btnStart.setSelected(false); | ||
| 100 | btnStart.addActionListener(new Start()); | ||
| 101 | add(btnStart); | ||
| 102 | |||
| 103 | |||
| 104 | |||
| 105 | // BUTTON STOP | ||
| 106 | btnStop.setIcon(new ImageIcon(DevToolsBean.class.getResource("/stop.png"))); | ||
| 107 | btnStop.setBounds(170,30,180,40); | ||
| 108 | btnStop.setFont(font); | ||
| 109 | btnStop.setSelected(false); | ||
| 110 | btnStop.addActionListener(new Stop()); | ||
| 111 | add(btnStop); | ||
| 112 | |||
| 113 | |||
| 114 | // BUTTON DEFAULTS | ||
| 115 | btnDefaults.setIcon(new ImageIcon(DevToolsBean.class.getResource("/replay.png"))); | ||
| 116 | btnDefaults.setBounds(360,30,230,40); | ||
| 117 | btnDefaults.setFont(font); | ||
| 118 | btnDefaults.setSelected(false); | ||
| 119 | btnDefaults.addActionListener(new Defaults()); | ||
| 120 | add(btnDefaults); | ||
| 121 | |||
| 122 | |||
| 123 | // STATUS | ||
| 124 | font = new Font(null, Font.ITALIC, 18); | ||
| 125 | lblStatus.setIcon(new ImageIcon(DevToolsBean.class.getResource("/running.png"))); | ||
| 126 | lblStatus.setBounds(10,80,600,55); | ||
| 127 | lblStatus.setForeground(Color.YELLOW); | ||
| 128 | lblStatus.setText(""); | ||
| 129 | lblStatus.setVisible(true); | ||
| 130 | lblStatus.setFont(font); | ||
| 131 | add(lblStatus); | ||
| 132 | |||
| 133 | sv=new Sv(); | ||
| 134 | |||
| 135 | for (SvBean bean:sv.get()) { | ||
| 136 | |||
| 137 | if (bean.getProcess().equals("jetty")) { | ||
| 138 | |||
| 139 | svcontrol=new SvControl(bean); | ||
| 140 | } | ||
| 141 | } | ||
| 142 | |||
| 143 | timerAnimate.schedule(new Task(),0,10000); | ||
| 144 | } | ||
| 145 | |||
| 146 | |||
| 147 | public void initCmpEnabled() { | ||
| 148 | |||
| 149 | try { | ||
| 150 | boolean jattyrun=stservice.IsRun(DefSettings.jetty_process); | ||
| 151 | |||
| 152 | if(jattyrun){ | ||
| 153 | |||
| 154 | btnStop.setEnabled(true); | ||
| 155 | btnStart.setEnabled(false); | ||
| 156 | |||
| 157 | lblStatus.setIcon(new ImageIcon(DevToolsBean.class.getResource("/up.png"))); | ||
| 158 | lblStatus.setForeground(Color.GREEN); | ||
| 159 | lblStatus.setText("- Web конфигуратор запущен"); | ||
| 160 | |||
| 161 | }else { | ||
| 162 | |||
| 163 | btnStop.setEnabled(false); | ||
| 164 | btnStart.setEnabled(true); | ||
| 165 | |||
| 166 | lblStatus.setIcon(new ImageIcon(DevToolsBean.class.getResource("/down.png"))); | ||
| 167 | lblStatus.setForeground(Color.WHITE); | ||
| 168 | lblStatus.setText("- Web конфигуратор не запущен"); | ||
| 169 | } | ||
| 170 | }catch(Exception e){ | ||
| 171 | log.error(e.getMessage()); | ||
| 172 | } | ||
| 173 | |||
| 174 | } | ||
| 175 | |||
| 176 | |||
| 177 | public class Start implements ActionListener | ||
| 178 | { | ||
| 179 | public void actionPerformed(ActionEvent e) | ||
| 180 | { | ||
| 181 | new SwingWorker<Void, Void>() | ||
| 182 | { | ||
| 183 | protected Void doInBackground() throws Exception | ||
| 184 | { | ||
| 185 | |||
| 186 | btnStart.setEnabled(false); | ||
| 187 | btnStop.setEnabled(false); | ||
| 188 | lblStatus.setForeground(Color.YELLOW); | ||
| 189 | lblStatus.setText(" - выполняется запуск Web конфигуратора ..."); | ||
| 190 | |||
| 191 | block=true; | ||
| 192 | |||
| 193 | svcontrol.start(); | ||
| 194 | |||
| 195 | block=false; | ||
| 196 | |||
| 197 | return null; | ||
| 198 | |||
| 199 | } | ||
| 200 | |||
| 201 | }.execute(); | ||
| 202 | |||
| 203 | } | ||
| 204 | } | ||
| 205 | |||
| 206 | |||
| 207 | public class Stop implements ActionListener | ||
| 208 | { | ||
| 209 | public void actionPerformed(ActionEvent e) | ||
| 210 | { | ||
| 211 | |||
| 212 | new SwingWorker<Void, Void>() | ||
| 213 | { | ||
| 214 | protected Void doInBackground() throws Exception | ||
| 215 | { | ||
| 216 | |||
| 217 | btnStart.setEnabled(false); | ||
| 218 | btnStop.setEnabled(false); | ||
| 219 | lblStatus.setForeground(Color.YELLOW); | ||
| 220 | lblStatus.setText(" - выполняется остановка Web конфигуратора ..."); | ||
| 221 | |||
| 222 | block=true; | ||
| 223 | |||
| 224 | svcontrol.stop(); | ||
| 225 | |||
| 226 | block=false; | ||
| 227 | |||
| 228 | return null; | ||
| 229 | } | ||
| 230 | |||
| 231 | }.execute(); | ||
| 232 | |||
| 233 | |||
| 234 | |||
| 235 | |||
| 236 | |||
| 237 | } | ||
| 238 | } | ||
| 239 | |||
| 240 | |||
| 241 | public class Defaults implements ActionListener | ||
| 242 | { | ||
| 243 | public void actionPerformed(ActionEvent e) | ||
| 244 | { | ||
| 245 | |||
| 246 | new SwingWorker<Void, Void>() | ||
| 247 | { | ||
| 248 | protected Void doInBackground() throws Exception | ||
| 249 | { | ||
| 250 | block=true; | ||
| 251 | lblStatus.setForeground(Color.YELLOW); | ||
| 252 | lblStatus.setText(" - выполняется сброс настроек ..."); | ||
| 253 | |||
| 254 | btnDefaults.setEnabled(false); | ||
| 255 | btnStart.setEnabled(false); | ||
| 256 | btnStop.setEnabled(false); | ||
| 257 | |||
| 258 | try { | ||
| 259 | settings.init(); | ||
| 260 | |||
| 261 | Thread.sleep(5000); | ||
| 262 | |||
| 263 | }catch(Exception er) { | ||
| 264 | log.error(er.getMessage()); | ||
| 265 | } | ||
| 266 | btnDefaults.setEnabled(true); | ||
| 267 | block=false; | ||
| 268 | return null; | ||
| 269 | |||
| 270 | } | ||
| 271 | |||
| 272 | }.execute(); | ||
| 273 | |||
| 274 | } | ||
| 275 | } | ||
| 276 | |||
| 277 | |||
| 278 | |||
| 279 | |||
| 280 | |||
| 281 | |||
| 282 | public void paintComponent(Graphics g) { | ||
| 283 | super.paintComponent(g); | ||
| 284 | } | ||
| 285 | |||
| 286 | |||
| 287 | public void setPreferredSize(Dimension dim) { | ||
| 288 | beanDimension = dim; | ||
| 289 | } | ||
| 290 | |||
| 291 | public Dimension getPreferredSize() { | ||
| 292 | return beanDimension; | ||
| 293 | } | ||
| 294 | |||
| 295 | public void setMinimumSize(Dimension dim) { | ||
| 296 | beanDimension = dim; | ||
| 297 | } | ||
| 298 | |||
| 299 | public Dimension getMinimumSize() { | ||
| 300 | return beanDimension; | ||
| 301 | } | ||
| 302 | |||
| 303 | |||
| 304 | |||
| 305 | public void addChangeListener(ChangeListener l) { | ||
| 306 | listenerList.add(ChangeListener.class, l); | ||
| 307 | } | ||
| 308 | |||
| 309 | public void removeChangeListener(ChangeListener l) { | ||
| 310 | listenerList.remove(ChangeListener.class, l); | ||
| 311 | } | ||
| 312 | |||
| 313 | |||
| 314 | protected void fireStateChanged() { | ||
| 315 | Object[] listeners = listenerList.getListenerList(); | ||
| 316 | |||
| 317 | for (int i = listeners.length - 2; i >= 0; i -= 2) { | ||
| 318 | if (listeners[i] == ChangeListener.class) { | ||
| 319 | if (changeEvent == null) | ||
| 320 | changeEvent = new ChangeEvent(this); | ||
| 321 | ((ChangeListener) listeners[i + 1]).stateChanged(changeEvent); | ||
| 322 | } | ||
| 323 | } | ||
| 324 | } | ||
| 325 | |||
| 326 | public void writeExternal(ObjectOutput out) throws IOException { | ||
| 327 | |||
| 328 | out.writeObject(beanDimension); | ||
| 329 | |||
| 330 | } | ||
| 331 | |||
| 332 | public void readExternal(ObjectInput in) throws IOException, | ||
| 333 | ClassNotFoundException { | ||
| 334 | |||
| 335 | setPreferredSize((Dimension) in.readObject()); | ||
| 336 | |||
| 337 | setMinimumSize(getPreferredSize()); | ||
| 338 | |||
| 339 | } | ||
| 340 | |||
| 341 | |||
| 342 | |||
| 343 | |||
| 344 | public class Update extends SwingWorker<Void, Void> { | ||
| 345 | @Override | ||
| 346 | public Void doInBackground() | ||
| 347 | { | ||
| 348 | // Если выполняется запуск или остановка, то не проверяем | ||
| 349 | if (!block){ | ||
| 350 | initCmpEnabled(); | ||
| 351 | } | ||
| 352 | |||
| 353 | return null; | ||
| 354 | } | ||
| 355 | |||
| 356 | @Override | ||
| 357 | public void done(){ | ||
| 358 | |||
| 359 | |||
| 360 | } | ||
| 361 | } | ||
| 362 | |||
| 363 | |||
| 364 | |||
| 365 | private class Task extends TimerTask { | ||
| 366 | |||
| 367 | @Override | ||
| 368 | public void run() { | ||
| 369 | EventQueue.invokeLater(new Runnable() { | ||
| 370 | // @Override | ||
| 371 | public void run() { | ||
| 372 | |||
| 373 | update=new Update(); | ||
| 374 | update.execute(); | ||
| 375 | |||
| 376 | |||
| 377 | |||
| 378 | } | ||
| 379 | |||
| 380 | }); | ||
| 381 | } | ||
| 382 | } | ||
| 383 | |||
| 384 | |||
| 385 | |||
| 386 | public static void main(String[] args) { | ||
| 387 | JFrame frame = new JFrame("Управление Web конфигуратором"); | ||
| 388 | frame.getContentPane().add(new DevToolsBean()); | ||
| 389 | frame.setVisible(true); | ||
| 390 | frame.pack(); | ||
| 391 | } | ||
| 392 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
UtilsTools/src/main/java/org/emercit/utilstools/controldevtools/bean/RoundPanel.java
deleted
100644 → 0
| 1 | package org.emercit.utilstools.controldevtools.bean; | ||
| 2 | |||
| 3 | |||
| 4 | import java.awt.BasicStroke; | ||
| 5 | import java.awt.Color; | ||
| 6 | import java.awt.Dimension; | ||
| 7 | import java.awt.Graphics; | ||
| 8 | import java.awt.Graphics2D; | ||
| 9 | import java.awt.RenderingHints; | ||
| 10 | import javax.swing.JPanel; | ||
| 11 | |||
| 12 | public class RoundPanel extends JPanel | ||
| 13 | { | ||
| 14 | protected int _strokeSize = 1; | ||
| 15 | protected Color _shadowColor = Color.BLACK; | ||
| 16 | protected boolean _shadowed = true; | ||
| 17 | protected boolean _highQuality = true; | ||
| 18 | protected Dimension _arcs = new Dimension(15, 15); | ||
| 19 | protected int _shadowGap = 3; | ||
| 20 | protected int _shadowOffset = 4; | ||
| 21 | protected int _shadowAlpha = 100; | ||
| 22 | |||
| 23 | public Color _backgroundColor = Color.WHITE; | ||
| 24 | |||
| 25 | public RoundPanel() | ||
| 26 | { | ||
| 27 | super(); | ||
| 28 | setOpaque(false); | ||
| 29 | } | ||
| 30 | |||
| 31 | |||
| 32 | @Override | ||
| 33 | public void setBackground(Color c) | ||
| 34 | { | ||
| 35 | _backgroundColor = c; | ||
| 36 | } | ||
| 37 | |||
| 38 | @Override | ||
| 39 | protected void paintComponent(Graphics g) | ||
| 40 | { | ||
| 41 | super.paintComponent(g); | ||
| 42 | |||
| 43 | int width = getWidth(); | ||
| 44 | int height = getHeight(); | ||
| 45 | int shadowGap = this._shadowGap; | ||
| 46 | Color shadowColorA = new Color(_shadowColor.getRed(), _shadowColor.getGreen(), _shadowColor.getBlue(), _shadowAlpha); | ||
| 47 | Graphics2D graphics = (Graphics2D) g; | ||
| 48 | |||
| 49 | if(_highQuality) | ||
| 50 | { | ||
| 51 | graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); | ||
| 52 | } | ||
| 53 | |||
| 54 | if(_shadowed) | ||
| 55 | { | ||
| 56 | graphics.setColor(shadowColorA); | ||
| 57 | graphics.fillRoundRect(_shadowOffset, _shadowOffset, width - _strokeSize - _shadowOffset, | ||
| 58 | height - _strokeSize - _shadowOffset, _arcs.width, _arcs.height); | ||
| 59 | } | ||
| 60 | else | ||
| 61 | { | ||
| 62 | _shadowGap = 1; | ||
| 63 | } | ||
| 64 | |||
| 65 | graphics.setColor(_backgroundColor); | ||
| 66 | graphics.fillRoundRect(0, 0, width - shadowGap, height - shadowGap, _arcs.width, _arcs.height); | ||
| 67 | graphics.setStroke(new BasicStroke(_strokeSize)); | ||
| 68 | graphics.setColor(getForeground()); | ||
| 69 | graphics.drawRoundRect(0, 0, width - shadowGap, height - shadowGap, _arcs.width, _arcs.height); | ||
| 70 | graphics.setStroke(new BasicStroke()); | ||
| 71 | } | ||
| 72 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -23,15 +23,20 @@ public class DevInfo implements IDevInfo { | ... | @@ -23,15 +23,20 @@ public class DevInfo implements IDevInfo { |
| 23 | private DevInfoBean devinfobean; | 23 | private DevInfoBean devinfobean; |
| 24 | 24 | ||
| 25 | public int set(DevInfoBean m) { | 25 | public int set(DevInfoBean m) { |
| 26 | return db.create(m); | 26 | |
| 27 | Msg res=Msg.getByCode(db.create(m)); | ||
| 28 | |||
| 29 | if (res.getTypeVariable().getCode()==0) { | ||
| 30 | |||
| 31 | return Msg.DescriptionUpdateSucc.getCode(); | ||
| 32 | } | ||
| 33 | return Msg.DescriptionUpdateError.getCode(); | ||
| 27 | } | 34 | } |
| 28 | 35 | ||
| 29 | |||
| 30 | public DevInfoBean get() { | 36 | public DevInfoBean get() { |
| 31 | return (DevInfoBean)db.select(); | 37 | return (DevInfoBean)db.select(); |
| 32 | } | 38 | } |
| 33 | 39 | ||
| 34 | |||
| 35 | public int init() { | 40 | public int init() { |
| 36 | 41 | ||
| 37 | devinfobean=new DevInfoBean(); | 42 | devinfobean=new DevInfoBean(); | ... | ... |
| ... | @@ -3,8 +3,6 @@ package org.emercit.utilstools.displaycalibrator.service; | ... | @@ -3,8 +3,6 @@ package org.emercit.utilstools.displaycalibrator.service; |
| 3 | import org.emercit.utilstools.config.Msg; | 3 | import org.emercit.utilstools.config.Msg; |
| 4 | 4 | ||
| 5 | public interface DCalibrator { | 5 | public interface DCalibrator { |
| 6 | |||
| 7 | |||
| 8 | public int Run(String cmd); | ||
| 9 | 6 | ||
| 7 | public int Run(String cmd); | ||
| 10 | } | 8 | } | ... | ... |
| ... | @@ -44,7 +44,6 @@ public class DCalibratorBB implements DCalibrator { | ... | @@ -44,7 +44,6 @@ public class DCalibratorBB implements DCalibrator { |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | bw.close(); | 46 | bw.close(); |
| 47 | log.info(Msg.CalibrSucc.getDescription()); | ||
| 48 | return Msg.CalibrSucc.getCode(); | 47 | return Msg.CalibrSucc.getCode(); |
| 49 | 48 | ||
| 50 | }catch(Exception e) { | 49 | }catch(Exception e) { | ... | ... |
| ... | @@ -61,15 +61,12 @@ public class DnsLinux implements IDns{ | ... | @@ -61,15 +61,12 @@ public class DnsLinux implements IDns{ |
| 61 | 61 | ||
| 62 | int i=0; | 62 | int i=0; |
| 63 | for (String ip:v) { | 63 | for (String ip:v) { |
| 64 | |||
| 65 | |||
| 66 | db=new DnsBean(); | 64 | db=new DnsBean(); |
| 67 | db.setIp(ip); | 65 | db.setIp(ip); |
| 68 | db.setId(i); | 66 | db.setId(i); |
| 69 | dbs.add(db); | 67 | dbs.add(db); |
| 70 | i++; | 68 | i++; |
| 71 | } | 69 | } |
| 72 | //log.info(Msg.LoadFileSucc.getDescription()); | ||
| 73 | } catch(Exception e) { | 70 | } catch(Exception e) { |
| 74 | log.error(e.getMessage()); | 71 | log.error(e.getMessage()); |
| 75 | } | 72 | } |
| ... | @@ -98,12 +95,10 @@ public class DnsLinux implements IDns{ | ... | @@ -98,12 +95,10 @@ public class DnsLinux implements IDns{ |
| 98 | } | 95 | } |
| 99 | 96 | ||
| 100 | bw.close(); | 97 | bw.close(); |
| 101 | log.info(Msg.DnsUpdateSucc.getDescription()); | ||
| 102 | return Msg.DnsUpdateSucc.getCode(); | 98 | return Msg.DnsUpdateSucc.getCode(); |
| 103 | 99 | ||
| 104 | } catch (IOException e) { | 100 | } catch (IOException e) { |
| 105 | log.error(e.getMessage()); | 101 | log.error(e.getMessage()); |
| 106 | log.error(Msg.DnsUpdateError.getDescription()); | ||
| 107 | return Msg.DnsUpdateError.getCode(); | 102 | return Msg.DnsUpdateError.getCode(); |
| 108 | } | 103 | } |
| 109 | 104 | ||
| ... | @@ -114,7 +109,6 @@ public class DnsLinux implements IDns{ | ... | @@ -114,7 +109,6 @@ public class DnsLinux implements IDns{ |
| 114 | db=new DnsBean(); | 109 | db=new DnsBean(); |
| 115 | db.setIp(DefSettings.Dns_host); | 110 | db.setIp(DefSettings.Dns_host); |
| 116 | dbs.add(db); | 111 | dbs.add(db); |
| 117 | |||
| 118 | return Config(dbs); | 112 | return Config(dbs); |
| 119 | } | 113 | } |
| 120 | 114 | ... | ... |
| ... | @@ -62,10 +62,8 @@ public class NtpLinux implements INtp { | ... | @@ -62,10 +62,8 @@ public class NtpLinux implements INtp { |
| 62 | 62 | ||
| 63 | bw.close(); | 63 | bw.close(); |
| 64 | 64 | ||
| 65 | log.info(Msg.NTPUpdateSucc.getDescription()); | ||
| 66 | } catch (IOException e) { | 65 | } catch (IOException e) { |
| 67 | log.error(e.getMessage()); | 66 | log.error(e.getMessage()); |
| 68 | log.error(Msg.NTPUpdateError.getDescription()); | ||
| 69 | return Msg.NTPUpdateError.getCode(); | 67 | return Msg.NTPUpdateError.getCode(); |
| 70 | } | 68 | } |
| 71 | return Msg.NTPUpdateSucc.getCode(); | 69 | return Msg.NTPUpdateSucc.getCode(); | ... | ... |
| ... | @@ -37,13 +37,14 @@ public class EthLinux implements IEth { | ... | @@ -37,13 +37,14 @@ public class EthLinux implements IEth { |
| 37 | 37 | ||
| 38 | public int reload(String name) { | 38 | public int reload(String name) { |
| 39 | try { | 39 | try { |
| 40 | /* | ||
| 40 | Vector<String> buff=cmdexec.Run("ifdown"+" "+name); | 41 | Vector<String> buff=cmdexec.Run("ifdown"+" "+name); |
| 41 | Thread.sleep(5000); | 42 | Thread.sleep(2000); |
| 42 | buff=cmdexec.Run("ifup"+" "+name); | 43 | buff=cmdexec.Run("ifup"+" "+name); |
| 43 | Thread.sleep(5000); | 44 | Thread.sleep(3000); |
| 45 | */ | ||
| 46 | Vector<String> buff=cmdexec.Run("/etc/init.d/networking restart"); | ||
| 44 | Msg msg=Msg.RestartEthSucc; | 47 | Msg msg=Msg.RestartEthSucc; |
| 45 | |||
| 46 | log.info(msg.getDescription()); | ||
| 47 | return msg.getCode(); | 48 | return msg.getCode(); |
| 48 | }catch(Exception e) { | 49 | }catch(Exception e) { |
| 49 | 50 | ||
| ... | @@ -193,11 +194,20 @@ public class EthLinux implements IEth { | ... | @@ -193,11 +194,20 @@ public class EthLinux implements IEth { |
| 193 | 194 | ||
| 194 | bw.close(); | 195 | bw.close(); |
| 195 | 196 | ||
| 196 | return db.create(ebs); | 197 | |
| 198 | |||
| 199 | Msg res=Msg.getByCode(db.create(ebs)); | ||
| 200 | |||
| 201 | if (res.getTypeVariable().getCode()==0) { | ||
| 202 | return Msg.EthUpdateSucc.getCode(); | ||
| 203 | } | ||
| 204 | return Msg.EthError.getCode(); | ||
| 205 | |||
| 206 | |||
| 197 | 207 | ||
| 198 | } catch (IOException e) { | 208 | } catch (IOException e) { |
| 199 | log.error(e.getMessage()); | 209 | log.error(e.getMessage()); |
| 200 | return Msg.SaveFileError.getCode(); | 210 | return Msg.EthError.getCode(); |
| 201 | } | 211 | } |
| 202 | 212 | ||
| 203 | } | 213 | } | ... | ... |
| ... | @@ -18,7 +18,14 @@ public class Gsm implements IGsm { | ... | @@ -18,7 +18,14 @@ public class Gsm implements IGsm { |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | public int set(GSMBean m) { | 20 | public int set(GSMBean m) { |
| 21 | return db.create(m); | 21 | |
| 22 | Msg res=Msg.getByCode(db.create(m)); | ||
| 23 | |||
| 24 | if (res.getTypeVariable().getCode()==0) { | ||
| 25 | return Msg.GsmUpdateSucc.getCode(); | ||
| 26 | } | ||
| 27 | return Msg.GsmUpdateError.getCode(); | ||
| 28 | |||
| 22 | } | 29 | } |
| 23 | 30 | ||
| 24 | /* | 31 | /* |
| ... | @@ -29,7 +36,7 @@ public class Gsm implements IGsm { | ... | @@ -29,7 +36,7 @@ public class Gsm implements IGsm { |
| 29 | 36 | ||
| 30 | m=new GSMBean(); | 37 | m=new GSMBean(); |
| 31 | m.setOperator("megafon"); | 38 | m.setOperator("megafon"); |
| 32 | return db.create(m); | 39 | return set(m); |
| 33 | } | 40 | } |
| 34 | 41 | ||
| 35 | 42 | ... | ... |
| ... | @@ -77,7 +77,6 @@ public class ProxyLinux implements IProxy { | ... | @@ -77,7 +77,6 @@ public class ProxyLinux implements IProxy { |
| 77 | return Msg.ProxyUpdateSucc.getCode(); | 77 | return Msg.ProxyUpdateSucc.getCode(); |
| 78 | } catch (IOException e) { | 78 | } catch (IOException e) { |
| 79 | log.error(e.getMessage()); | 79 | log.error(e.getMessage()); |
| 80 | log.error(Msg.ProxyUpdateError.getDescription()); | ||
| 81 | return Msg.ProxyUpdateError.getCode(); | 80 | return Msg.ProxyUpdateError.getCode(); |
| 82 | } | 81 | } |
| 83 | } | 82 | } | ... | ... |
| ... | @@ -9,6 +9,7 @@ import java.io.FileOutputStream; | ... | @@ -9,6 +9,7 @@ import java.io.FileOutputStream; |
| 9 | import java.io.FileInputStream; | 9 | import java.io.FileInputStream; |
| 10 | 10 | ||
| 11 | import org.apache.log4j.Logger; | 11 | import org.apache.log4j.Logger; |
| 12 | import org.emercit.utilstools.config.Msg; | ||
| 12 | import org.emercit.utilstools.config.Paths; | 13 | import org.emercit.utilstools.config.Paths; |
| 13 | import org.emercit.utilstools.config.DefSettings; | 14 | import org.emercit.utilstools.config.DefSettings; |
| 14 | import org.emercit.utilstools.servers.model.ServerBean; | 15 | import org.emercit.utilstools.servers.model.ServerBean; |
| ... | @@ -23,7 +24,13 @@ public class Servers implements IServers { | ... | @@ -23,7 +24,13 @@ public class Servers implements IServers { |
| 23 | 24 | ||
| 24 | public int set(Vector<ServerBean> beans) { | 25 | public int set(Vector<ServerBean> beans) { |
| 25 | 26 | ||
| 26 | return db.create(beans); | 27 | Msg res=Msg.getByCode(db.create(beans)); |
| 28 | |||
| 29 | if (res.getTypeVariable().getCode()==0) { | ||
| 30 | return Msg.RemoteServerUpdateSucc.getCode(); | ||
| 31 | } | ||
| 32 | |||
| 33 | return Msg.RemoteUpdateError.getCode(); | ||
| 27 | } | 34 | } |
| 28 | 35 | ||
| 29 | public Vector<ServerBean> get() { | 36 | public Vector<ServerBean> get() { | ... | ... |
-
Please register or sign in to post a comment