Commit d27f4cd8 d27f4cd89508b48c58c231764a74c4429fe88293 by root

save

1 parent f386613f
Showing 46 changed files with 356 additions and 325 deletions
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
30 <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> 30 <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
31 <attributes> 31 <attributes>
32 <attribute name="maven.pomderived" value="true"/> 32 <attribute name="maven.pomderived" value="true"/>
33 <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
34 </attributes> 33 </attributes>
35 </classpathentry> 34 </classpathentry>
36 <classpathentry kind="output" path="target/classes"/> 35 <classpathentry kind="output" path="target/classes"/>
......
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
136 <dependency> 136 <dependency>
137 <groupId>org.emercit</groupId> 137 <groupId>org.emercit</groupId>
138 <artifactId>utilstools</artifactId> 138 <artifactId>utilstools</artifactId>
139 <version>1.2</version> 139 <version>1.3</version>
140 </dependency> 140 </dependency>
141 141
142 </dependencies> 142 </dependencies>
......
1 74c6c5b63f8da617444229f8115ec1bd
...\ No newline at end of file ...\ No newline at end of file
1 adffdb38630255374c6e833e66beb25472a984fe
...\ 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.3</version>
8 </project>
1 322188dde72994362c060bd891722a5f
...\ No newline at end of file ...\ No newline at end of file
1 3af39bb14b1b7340a0a316a5f8f7168b8e114b6b
...\ No newline at end of file ...\ No newline at end of file
...@@ -3,12 +3,13 @@ ...@@ -3,12 +3,13 @@
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.2</release> 6 <release>1.3</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>
10 <version>1.2</version> 10 <version>1.2</version>
11 <version>1.3</version>
11 </versions> 12 </versions>
12 <lastUpdated>20150729141622</lastUpdated> 13 <lastUpdated>20150730083754</lastUpdated>
13 </versioning> 14 </versioning>
14 </metadata> 15 </metadata>
......
1 257acae17b94e3780bb730b4a34a7be6
...\ No newline at end of file ...\ No newline at end of file
1 f694c82e4fbd3e4132fed50768c031e6
...\ No newline at end of file ...\ No newline at end of file
......
1 a822e807f8f47856f57c62d6d43e7213053d06d9
...\ No newline at end of file ...\ No newline at end of file
1 500d42766cac423c8bf0bbead4ea70c1483b96f8
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
11 </appender> 11 </appender>
12 12
13 <appender name="file" class="org.apache.log4j.FileAppender"> 13 <appender name="file" class="org.apache.log4j.FileAppender">
14 <param name="File" value="/var/log/devtools.log" /> 14
15 <param name="File" value="/var/log/devtools.log" />
16 <param name="MaxFileSize" value="10KB"/>
15 <layout class="org.apache.log4j.PatternLayout"> 17 <layout class="org.apache.log4j.PatternLayout">
16 <param name="ConversionPattern" value="%-7p %d [%t] %c %x - %m%n"/> 18 <param name="ConversionPattern" value="%-7p %d [%t] %c %x - %m%n"/>
17 </layout> 19 </layout>
......
...@@ -9,10 +9,10 @@ import java.io.FileOutputStream; ...@@ -9,10 +9,10 @@ import java.io.FileOutputStream;
9 9
10 import org.apache.log4j.Logger; 10 import org.apache.log4j.Logger;
11 import org.emercit.devinfo.model.DevInfoBean; 11 import org.emercit.devinfo.model.DevInfoBean;
12 12 import org.emercit.utilstools.config.DefSettings;
13 import org.emercit.utilstools.config.Msg;
14 import org.emercit.utilstools.config.Paths;
13 import org.emercit.xmldbmanager.service.Db; 15 import org.emercit.xmldbmanager.service.Db;
14 import org.emercit.projecttools.constants.Paths;
15 import org.emercit.projecttools.constants.Msg;
16 16
17 public class DevInfo implements IDevInfo { 17 public class DevInfo implements IDevInfo {
18 18
...@@ -22,7 +22,7 @@ public class DevInfo implements IDevInfo { ...@@ -22,7 +22,7 @@ public class DevInfo implements IDevInfo {
22 22
23 private DevInfoBean devinfobean; 23 private DevInfoBean devinfobean;
24 24
25 public Msg set(DevInfoBean m) { 25 public int set(DevInfoBean m) {
26 return db.create(m); 26 return db.create(m);
27 } 27 }
28 28
...@@ -32,11 +32,11 @@ public class DevInfo implements IDevInfo { ...@@ -32,11 +32,11 @@ public class DevInfo implements IDevInfo {
32 } 32 }
33 33
34 34
35 public Msg init() { 35 public int init() {
36 36
37 devinfobean=new DevInfoBean(); 37 devinfobean=new DevInfoBean();
38 devinfobean.setDescription("Описание устройства"); 38 devinfobean.setDescription(DefSettings.DevInfo_Description);
39 devinfobean.setGuid("00000000-0000-0000-0000-000000000000"); 39 devinfobean.setGuid(DefSettings.DevInfo_Guid);
40 40
41 return set(devinfobean); 41 return set(devinfobean);
42 42
......
...@@ -7,16 +7,15 @@ import java.io.BufferedOutputStream; ...@@ -7,16 +7,15 @@ import java.io.BufferedOutputStream;
7 import java.io.FileInputStream; 7 import java.io.FileInputStream;
8 import java.io.FileOutputStream; 8 import java.io.FileOutputStream;
9 9
10 import org.emercit.projecttools.constants.Msg; 10 import org.emercit.utilstools.config.Msg;
11
12 import org.emercit.devinfo.model.DevInfoBean; 11 import org.emercit.devinfo.model.DevInfoBean;
13 12
14 public interface IDevInfo { 13 public interface IDevInfo {
15 14
16 public Msg set(DevInfoBean m); 15 public int set(DevInfoBean m);
17 16
18 public DevInfoBean get(); 17 public DevInfoBean get();
19 18
20 public Msg init(); 19 public int init();
21 20
22 } 21 }
......
1 package org.emercit.displaycalibrator.service; 1 package org.emercit.displaycalibrator.service;
2 2
3 import org.emercit.projecttools.constants.Msg; 3 import org.emercit.utilstools.config.Msg;
4 4
5 public interface DCalibrator { 5 public interface DCalibrator {
6 6
7 7
8 public Msg Run(String cmd); 8 public int Run(String cmd);
9 9
10 } 10 }
......
...@@ -10,7 +10,7 @@ import java.util.Vector; ...@@ -10,7 +10,7 @@ import java.util.Vector;
10 import org.apache.log4j.Logger; 10 import org.apache.log4j.Logger;
11 import org.emercit.devinfo.service.DevInfo; 11 import org.emercit.devinfo.service.DevInfo;
12 import org.emercit.pckutils.cmd.CmdExec; 12 import org.emercit.pckutils.cmd.CmdExec;
13 import org.emercit.projecttools.constants.Msg; 13 import org.emercit.utilstools.config.Msg;
14 14
15 15
16 public class DCalibratorBB implements DCalibrator { 16 public class DCalibratorBB implements DCalibrator {
...@@ -21,7 +21,7 @@ public class DCalibratorBB implements DCalibrator { ...@@ -21,7 +21,7 @@ public class DCalibratorBB implements DCalibrator {
21 21
22 //Run("/home/debian/start-xinput-config.sh"); 22 //Run("/home/debian/start-xinput-config.sh");
23 23
24 public Msg Run(String cmd) { 24 public int Run(String cmd) {
25 try { 25 try {
26 Vector<String> params=cmdExec.Run(cmd); 26 Vector<String> params=cmdExec.Run(cmd);
27 27
...@@ -44,12 +44,12 @@ public class DCalibratorBB implements DCalibrator { ...@@ -44,12 +44,12 @@ public class DCalibratorBB implements DCalibrator {
44 } 44 }
45 45
46 bw.close(); 46 bw.close();
47 log.info(Msg.CalibrSucc); 47 log.info(Msg.CalibrSucc.getDescription());
48 return Msg.CalibrSucc; 48 return Msg.CalibrSucc.getCode();
49 49
50 }catch(Exception e) { 50 }catch(Exception e) {
51 log.error(Msg.CalibrError); 51 log.error(e.getMessage());
52 return Msg.CalibrError; 52 return Msg.CalibrError.getCode();
53 } 53 }
54 } 54 }
55 55
......
...@@ -8,8 +8,9 @@ import java.util.Vector; ...@@ -8,8 +8,9 @@ import java.util.Vector;
8 8
9 import org.apache.log4j.Logger; 9 import org.apache.log4j.Logger;
10 import org.emercit.dnsmanager.model.DnsBean; 10 import org.emercit.dnsmanager.model.DnsBean;
11
12 import org.emercit.pckutils.cmd.CmdExec; 11 import org.emercit.pckutils.cmd.CmdExec;
12 import org.emercit.utilstools.config.DefSettings;
13 import org.emercit.utilstools.config.Msg;
13 14
14 public class DnsLinux implements IDns{ 15 public class DnsLinux implements IDns{
15 16
...@@ -22,21 +23,17 @@ public class DnsLinux implements IDns{ ...@@ -22,21 +23,17 @@ public class DnsLinux implements IDns{
22 private DnsBean db; 23 private DnsBean db;
23 24
24 25
25 public void Add (String value){ 26 public int Add (String value){
26 27
27 dbs=getAllDns(); 28 dbs=getAllDns();
28
29 db=new DnsBean(); 29 db=new DnsBean();
30
31 db.setIp(value); 30 db.setIp(value);
32
33 dbs.add(db); 31 dbs.add(db);
34 32
35 Config(dbs); 33 return Config(dbs);
36
37 } 34 }
38 35
39 public void Delete(String value) { 36 public int Delete(String value) {
40 37
41 dbs=getAllDns(); 38 dbs=getAllDns();
42 for (DnsBean db:dbs) { 39 for (DnsBean db:dbs) {
...@@ -46,21 +43,16 @@ public class DnsLinux implements IDns{ ...@@ -46,21 +43,16 @@ public class DnsLinux implements IDns{
46 break; 43 break;
47 } 44 }
48 } 45 }
49 Config(dbs); 46 return Config(dbs);
50 } 47 }
51 48
52 public boolean Update(Vector<DnsBean> beans) { 49 public int Update(Vector<DnsBean> beans) {
53 50
54 return Config(beans); 51 return Config(beans);
55 52
56 } 53 }
57 54
58 55
59
60
61
62
63
64 public Vector<DnsBean> getAllDns() { 56 public Vector<DnsBean> getAllDns() {
65 57
66 dbs=new Vector<DnsBean>(); 58 dbs=new Vector<DnsBean>();
...@@ -77,16 +69,14 @@ public class DnsLinux implements IDns{ ...@@ -77,16 +69,14 @@ public class DnsLinux implements IDns{
77 dbs.add(db); 69 dbs.add(db);
78 i++; 70 i++;
79 } 71 }
80 72 log.info(Msg.LoadFileSucc);
81 } catch(Exception e) { 73 } catch(Exception e) {
82 log.error(e.getMessage()); 74 log.error(e.getMessage());
83 } 75 }
84 return dbs; 76 return dbs;
85 } 77 }
86 78
87 79 public int Config(Vector<DnsBean> dbs) {
88
89 public boolean Config(Vector<DnsBean> dbs) {
90 80
91 try { 81 try {
92 File file = new File("/etc/resolv.conf"); 82 File file = new File("/etc/resolv.conf");
...@@ -108,26 +98,23 @@ public class DnsLinux implements IDns{ ...@@ -108,26 +98,23 @@ public class DnsLinux implements IDns{
108 } 98 }
109 99
110 bw.close(); 100 bw.close();
111 return true; 101 log.info(Msg.SaveFileSucc.getDescription());
102 return Msg.SaveFileSucc.getCode();
112 103
113 } catch (IOException e) { 104 } catch (IOException e) {
114
115 log.error(e.getMessage()); 105 log.error(e.getMessage());
116 106 return Msg.SaveFileError.getCode();
117 } 107 }
118 return false; 108
119 } 109 }
120 110
121 public void init() { 111 public int init() {
122 dbs=new Vector<DnsBean>(); 112 dbs=new Vector<DnsBean>();
123 db=new DnsBean(); 113 db=new DnsBean();
124 114 db.setIp(DefSettings.Dns_host);
125 db.setIp("8.8.8.8");
126
127 dbs.add(db); 115 dbs.add(db);
128 116
129 Config(dbs); 117 return Config(dbs);
130
131 } 118 }
132 119
133 120
......
...@@ -6,16 +6,11 @@ import java.util.Vector; ...@@ -6,16 +6,11 @@ import java.util.Vector;
6 6
7 public interface IDns { 7 public interface IDns {
8 8
9 public void Add (String value); 9 public int Add (String value);
10 10 public int Delete(String value);
11 11 public int Config(Vector<DnsBean> dbs);
12 public void Delete(String value);
13
14 public boolean Config(Vector<DnsBean> dbs);
15
16 public Vector<DnsBean> getAllDns(); 12 public Vector<DnsBean> getAllDns();
17 13 public int init();
18 public void init();
19 14
20 } 15 }
21 16
......
1 package org.emercit.dtmanager.service; 1 package org.emercit.dtmanager.service;
2 2
3 public interface INtp { 3 public interface INtp {
4
5 public String getUseNtpServer();
6
7 public boolean setUsNtpServer(String value);
8
9 public void init();
10
11 4
5 public String getUseNtpServer();
6 public int setUsNtpServer(String value);
7 public int init();
12 } 8 }
......
...@@ -5,27 +5,30 @@ import java.io.File; ...@@ -5,27 +5,30 @@ import java.io.File;
5 import java.io.FileWriter; 5 import java.io.FileWriter;
6 import java.io.IOException; 6 import java.io.IOException;
7 7
8 import org.apache.log4j.Logger;
8 import org.emercit.pckutils.cmd.CmdExec; 9 import org.emercit.pckutils.cmd.CmdExec;
9 10 import org.emercit.utilstools.config.Msg;
11 import org.emercit.utilstools.config.DefSettings;
10 12
11 public class NtpLinux implements INtp { 13 public class NtpLinux implements INtp {
12 14
15
16 private static final Logger log = Logger.getLogger(NtpLinux.class);
17
13 private CmdExec cmdexec=new CmdExec(); 18 private CmdExec cmdexec=new CmdExec();
14 19
15 public String getUseNtpServer() { 20 public String getUseNtpServer() {
16 21
17 try { 22 try {
18 23 return cmdexec.Run("cat /etc/ntp.conf | grep server | awk '{print $2}'").firstElement();
19 return cmdexec.Run("cat /etc/ntp.conf | grep server | awk '{print $2}'").firstElement();
20 24
21 }catch(Exception e) { 25 }catch(Exception e) {
22 26 log.error(e.getMessage());
23 return null; 27 return null;
24 } 28 }
25
26 } 29 }
27 30
28 public boolean setUsNtpServer(String value) { 31 public int setUsNtpServer(String value) {
29 32
30 try { 33 try {
31 File file = new File("/etc/ntp.conf"); 34 File file = new File("/etc/ntp.conf");
...@@ -58,16 +61,17 @@ public class NtpLinux implements INtp { ...@@ -58,16 +61,17 @@ public class NtpLinux implements INtp {
58 bw.write("\n"); 61 bw.write("\n");
59 62
60 bw.close(); 63 bw.close();
64
65 log.info(Msg.SaveFileSucc.getDescription());
61 } catch (IOException e) { 66 } catch (IOException e) {
62 return false; 67 log.error(e.getMessage());
68 return Msg.SaveFileError.getCode();
63 } 69 }
64 return true; 70 return Msg.SaveFileError.getCode();
65 } 71 }
66 72
67 public void init() { 73 public int init() {
68 74 return setUsNtpServer(DefSettings.Ntp_host);
69 setUsNtpServer("127.0.0.1");
70
71 } 75 }
72 76
73 77
......
...@@ -2,18 +2,15 @@ package org.emercit.ethmanager.service; ...@@ -2,18 +2,15 @@ package org.emercit.ethmanager.service;
2 2
3 import org.apache.log4j.Logger; 3 import org.apache.log4j.Logger;
4 import org.emercit.ethmanager.model.EthBean; 4 import org.emercit.ethmanager.model.EthBean;
5
6
7
8 import java.util.Vector; 5 import java.util.Vector;
9 import java.io.File; 6 import java.io.File;
10 import java.io.FileWriter; 7 import java.io.FileWriter;
11 import java.io.BufferedWriter; 8 import java.io.BufferedWriter;
12 import java.io.IOException; 9 import java.io.IOException;
13 10 import org.emercit.utilstools.config.Paths;
11 import org.emercit.utilstools.config.DefSettings;
12 import org.emercit.utilstools.config.Msg;
14 import org.emercit.xmldbmanager.service.Db; 13 import org.emercit.xmldbmanager.service.Db;
15 import org.emercit.projecttools.constants.Paths;
16
17 import org.emercit.pckutils.cmd.CmdExec; 14 import org.emercit.pckutils.cmd.CmdExec;
18 15
19 public class EthLinux implements IEth { 16 public class EthLinux implements IEth {
...@@ -22,7 +19,6 @@ public class EthLinux implements IEth { ...@@ -22,7 +19,6 @@ public class EthLinux implements IEth {
22 19
23 private CmdExec cmdexec=new CmdExec(); 20 private CmdExec cmdexec=new CmdExec();
24 21
25
26 private Vector<EthBean> ebs=new Vector<EthBean>(); 22 private Vector<EthBean> ebs=new Vector<EthBean>();
27 23
28 private Db db=new Db(Paths.BEAN_ETH); 24 private Db db=new Db(Paths.BEAN_ETH);
...@@ -31,8 +27,6 @@ public class EthLinux implements IEth { ...@@ -31,8 +27,6 @@ public class EthLinux implements IEth {
31 27
32 private String mac; 28 private String mac;
33 29
34
35
36 private EthBean emp; 30 private EthBean emp;
37 31
38 public EthLinux() { 32 public EthLinux() {
...@@ -66,18 +60,13 @@ public class EthLinux implements IEth { ...@@ -66,18 +60,13 @@ public class EthLinux implements IEth {
66 } 60 }
67 61
68 } 62 }
69 63
70 }catch(Exception e) { 64 }catch(Exception e) {
71 log.error(e.getMessage()); 65 log.error(e.getMessage());
72 } 66 }
73 return result; 67 return result;
74 } 68 }
75
76
77 69
78
79
80
81 public EthBean getEthByName(String name) { 70 public EthBean getEthByName(String name) {
82 71
83 ebs=(Vector<EthBean>)db.select(); 72 ebs=(Vector<EthBean>)db.select();
...@@ -106,20 +95,17 @@ public class EthLinux implements IEth { ...@@ -106,20 +95,17 @@ public class EthLinux implements IEth {
106 } 95 }
107 96
108 return eb; 97 return eb;
109 98
110 }catch(Exception e) { 99 }catch(Exception e) {
111 log.error(e.getMessage()); 100 log.error(e.getMessage());
112 } 101 }
113
114 102
115 } 103 }
116 } 104 }
117 return null; 105 return null;
118 } 106 }
119 107
120 108 public int Update(EthBean m) {
121
122 public boolean Update(EthBean m) {
123 109
124 ebs=(Vector<EthBean>)db.select(); 110 ebs=(Vector<EthBean>)db.select();
125 111
...@@ -136,17 +122,12 @@ public class EthLinux implements IEth { ...@@ -136,17 +122,12 @@ public class EthLinux implements IEth {
136 122
137 break; 123 break;
138 } 124 }
139
140 } 125 }
141 Config(ebs); 126 return Config(ebs);
142
143 return true;
144 }
145
146
147 127
128 }
148 129
149 private void Config(Vector<EthBean> ebs) { 130 private int Config(Vector<EthBean> ebs) {
150 131
151 try { 132 try {
152 File file = new File("/etc/network/interfaces"); 133 File file = new File("/etc/network/interfaces");
...@@ -199,16 +180,16 @@ public class EthLinux implements IEth { ...@@ -199,16 +180,16 @@ public class EthLinux implements IEth {
199 180
200 bw.close(); 181 bw.close();
201 182
202 db.create(ebs); 183 return db.create(ebs);
203 184
204 } catch (IOException e) { 185 } catch (IOException e) {
205 log.error(e.getMessage()); 186 log.error(e.getMessage());
187 return Msg.SaveFileError.getCode();
206 } 188 }
207 189
208 } 190 }
209 191
210 public void setDefaults() { 192 public int setDefaults() {
211
212 193
213 ebs=(Vector<EthBean>)db.select(); 194 ebs=(Vector<EthBean>)db.select();
214 195
...@@ -218,38 +199,35 @@ public class EthLinux implements IEth { ...@@ -218,38 +199,35 @@ public class EthLinux implements IEth {
218 ebs=new Vector<EthBean>(); 199 ebs=new Vector<EthBean>();
219 200
220 EthBean NewEb=new EthBean(); 201 EthBean NewEb=new EthBean();
221
222 //Eth0 202 //Eth0
223 NewEb.setName("eth0"); 203 NewEb.setName(DefSettings.Eth0_name);
224 NewEb.setBroadcast(""); 204 NewEb.setBroadcast(DefSettings.Eth0_broadcast);
225 NewEb.setDhcp(false); 205 NewEb.setDhcp(DefSettings.Eth1_dhcp);
226 NewEb.setIp("192.168.99.1"); 206 NewEb.setIp(DefSettings.Eth0_ip);
227 NewEb.setNetmask("255.255.255.0"); 207 NewEb.setNetmask(DefSettings.Eth0_netmask);
228 NewEb.setGateway("192.168.99.2"); 208 NewEb.setGateway(DefSettings.Eth0_gateway);
229 NewEb.setInfo(v); 209 NewEb.setInfo(v);
230 NewEb.setId(0); 210 NewEb.setId(DefSettings.Eth0_id);
231 211
232 ebs.add(NewEb); 212 ebs.add(NewEb);
233 213
234 //Eth1 214 //Eth1
235 NewEb=new EthBean(); 215 NewEb=new EthBean();
236 216
237 NewEb.setName("eth1"); 217 NewEb.setName(DefSettings.Eth1_name);
238 NewEb.setDhcp(true); 218 NewEb.setDhcp(DefSettings.Eth1_dhcp);
239 NewEb.setIp(""); 219 NewEb.setIp(DefSettings.Eth1_ip);
240 NewEb.setNetmask(""); 220 NewEb.setNetmask(DefSettings.Eth1_netmask);
241 NewEb.setGateway(""); 221 NewEb.setGateway(DefSettings.Eth1_gateway);
242 NewEb.setBroadcast(""); 222 NewEb.setBroadcast(DefSettings.Eth1_broadcast);
243 NewEb.setMac(""); 223 NewEb.setMac(DefSettings.Eth1_mac);
244 NewEb.setId(1); 224 NewEb.setId(DefSettings.Eth1_id);
245 NewEb.setInfo(v); 225 NewEb.setInfo(v);
246 226
247
248
249 ebs.add(NewEb); 227 ebs.add(NewEb);
250 228
251 } 229 }
252 Config(ebs); 230 return Config(ebs);
253 } 231 }
254 232
255 } 233 }
......
...@@ -6,14 +6,10 @@ import java.util.Vector; ...@@ -6,14 +6,10 @@ import java.util.Vector;
6 import org.emercit.ethmanager.model.*; 6 import org.emercit.ethmanager.model.*;
7 7
8 public interface IEth { 8 public interface IEth {
9
10
11 public void setDefaults();
12
13 public boolean Update(EthBean m);
14 9
10 public int setDefaults();
11 public int Update(EthBean m);
15 public EthBean getEthByName(String name); 12 public EthBean getEthByName(String name);
16
17 public Vector<String> getListEth(); 13 public Vector<String> getListEth();
18 14
19 } 15 }
......
1 package org.emercit.gsmmanager.service; 1 package org.emercit.gsmmanager.service;
2 2
3 import org.emercit.gsmmanager.model.GSMBean; 3 import org.emercit.gsmmanager.model.GSMBean;
4 import org.emercit.utilstools.config.Paths;
4 import org.emercit.xmldbmanager.service.Db; 5 import org.emercit.xmldbmanager.service.Db;
5 6 import org.emercit.utilstools.config.DefSettings;
6 import org.emercit.projecttools.constants.Paths; 7 import org.emercit.utilstools.config.Paths;
8 import org.emercit.utilstools.config.Msg;
7 9
8 public class Gsm implements IGsm { 10 public class Gsm implements IGsm {
9 11
...@@ -15,19 +17,19 @@ public class Gsm implements IGsm { ...@@ -15,19 +17,19 @@ public class Gsm implements IGsm {
15 return (GSMBean)db.select(); 17 return (GSMBean)db.select();
16 } 18 }
17 19
18 public boolean set(GSMBean m) { 20 public int set(GSMBean m) {
19 return db.create(m); 21 return db.create(m);
20 } 22 }
21 23
22 /* 24 /*
23 * Создание нового файла с параметрами - defaults 25 * Создание нового файла с параметрами - defaults
24 * @see org.emercit.gsmmanager.service.IGsm#init() 26 * @see org.emercit.gsmmanager.service.IGsm#init()
25 */ 27 */
26 public void init() { 28 public int init() {
27 29
28 m=new GSMBean(); 30 m=new GSMBean();
29 m.setOperator("megafon"); 31 m.setOperator("megafon");
30 db.create(m); 32 return db.create(m);
31 } 33 }
32 34
33 35
......
...@@ -5,12 +5,6 @@ import org.emercit.gsmmanager.model.GSMBean; ...@@ -5,12 +5,6 @@ import org.emercit.gsmmanager.model.GSMBean;
5 public interface IGsm { 5 public interface IGsm {
6 6
7 public GSMBean get(); 7 public GSMBean get();
8 8 public int set(GSMBean m);
9 public boolean set(GSMBean m); 9 public int init();
10
11 public void init();
12
13
14
15
16 } 10 }
......
1 package org.emercit.logreader;
2
3 import java.io.BufferedReader;
4 import java.io.FileInputStream;
5 import java.io.FileNotFoundException;
6 import java.io.IOException;
7 import java.io.InputStreamReader;
8 import java.util.logging.Level;
9 import java.util.logging.Logger;
10 import java.util.Vector;
11
12 import org.emercit.utilstools.config.Paths;
13 public class Reader {
14
15 public Vector<String> read() {
16
17 Vector<String> result=new Vector<String>();
18
19 FileInputStream fis = null;
20 BufferedReader reader = null;
21
22 try {
23 fis = new FileInputStream(Paths.UTILSTOOLS_LOGFILE);
24 reader = new BufferedReader(new InputStreamReader(fis));
25 String line = reader.readLine();
26 while(line != null){
27 System.out.println(line);
28 line = reader.readLine();
29 }
30
31 } catch (FileNotFoundException ex) {
32 Logger.getLogger(Reader.class.getName()).log(Level.SEVERE, null, ex);
33 } catch (IOException ex) {
34 Logger.getLogger(Reader.class.getName()).log(Level.SEVERE, null, ex);
35
36 } finally {
37 try {
38 reader.close();
39 fis.close();
40 } catch (IOException ex) {
41 Logger.getLogger(Reader.class.getName()).log(Level.SEVERE, null, ex);
42 }
43 }
44 return result;
45 }
46
47
48 }
49
1 /**
2 *
3 */
4 /**
5 * @author root
6 *
7 */
8 package org.emercit.logreader;
...\ No newline at end of file ...\ No newline at end of file
1 package org.emercit.pckutils.checkservice; 1 package org.emercit.pckutils.checkservice;
2 2
3 import org.emercit.pckutils.cmd.CmdExec; 3 import org.emercit.pckutils.cmd.CmdExec;
4 4 import org.emercit.utilstools.config.Paths;
5 import org.emercit.projecttools.constants.Paths;
6 5
7 import java.util.Vector; 6 import java.util.Vector;
8 7
...@@ -14,9 +13,7 @@ public class STService { ...@@ -14,9 +13,7 @@ public class STService {
14 public boolean IsRun(String service) throws Exception { 13 public boolean IsRun(String service) throws Exception {
15 14
16 Vector<String> values=cmd.Run(Paths.FINDPROCESS_SCRIPT+" "+service); 15 Vector<String> values=cmd.Run(Paths.FINDPROCESS_SCRIPT+" "+service);
17
18 return Boolean.valueOf(values.firstElement()); 16 return Boolean.valueOf(values.firstElement());
19
20 } 17 }
21 18
22 } 19 }
......
...@@ -26,13 +26,11 @@ public class CmdExec { ...@@ -26,13 +26,11 @@ public class CmdExec {
26 Process proc = run.exec(new String[]{"/bin/sh", "-c",cmd}); 26 Process proc = run.exec(new String[]{"/bin/sh", "-c",cmd});
27 proc.waitFor(); 27 proc.waitFor();
28 BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream())); 28 BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
29 while(br.ready()) { 29 while(br.ready()) {
30
31 String message=br.readLine(); 30 String message=br.readLine();
32 v.add(message); 31 v.add(message);
33 log.info(message); 32 log.info(message);
34 } 33 }
35
36 return v; 34 return v;
37 } 35 }
38 } 36 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -2,11 +2,7 @@ package org.emercit.proxymanager.service; ...@@ -2,11 +2,7 @@ package org.emercit.proxymanager.service;
2 2
3 public interface IProxy { 3 public interface IProxy {
4 4
5 public void ApplyConfig (String p, Object v); 5 public int init();
6
7 public void InfoByName(String name);
8
9 public void init();
10 6
11 7
12 8
......
...@@ -5,16 +5,16 @@ import java.io.File; ...@@ -5,16 +5,16 @@ import java.io.File;
5 import java.io.FileWriter; 5 import java.io.FileWriter;
6 import java.io.IOException; 6 import java.io.IOException;
7 import java.util.Vector; 7 import java.util.Vector;
8
9 import org.apache.log4j.Logger; 8 import org.apache.log4j.Logger;
10 import org.emercit.proxymanager.model.ProxyBean; 9 import org.emercit.proxymanager.model.ProxyBean;
11 10 import org.emercit.utilstools.config.Paths;
12 11 import org.emercit.utilstools.config.Msg;
12 import org.emercit.utilstools.config.DefSettings;
13 13
14 import org.emercit.xmldbmanager.service.Db; 14 import org.emercit.xmldbmanager.service.Db;
15 import org.emercit.projecttools.constants.Paths;
16 15
17 public class ProxyLinux { 16
17 public class ProxyLinux implements IProxy {
18 18
19 private static final Logger log = Logger.getLogger(ProxyLinux.class); 19 private static final Logger log = Logger.getLogger(ProxyLinux.class);
20 20
...@@ -24,8 +24,6 @@ public class ProxyLinux { ...@@ -24,8 +24,6 @@ public class ProxyLinux {
24 24
25 private boolean found; 25 private boolean found;
26 26
27
28
29 private Object obj; 27 private Object obj;
30 28
31 private ProxyBean pmp; 29 private ProxyBean pmp;
...@@ -43,9 +41,8 @@ public class ProxyLinux { ...@@ -43,9 +41,8 @@ public class ProxyLinux {
43 public Vector<ProxyBean> getProxyBeans() { 41 public Vector<ProxyBean> getProxyBeans() {
44 return (Vector<ProxyBean>)db.select(); 42 return (Vector<ProxyBean>)db.select();
45 } 43 }
46
47 44
48 public void Config(Vector<ProxyBean> pbs) { 45 public int Config(Vector<ProxyBean> pbs) {
49 try { 46 try {
50 File file = new File("/etc/environment"); 47 File file = new File("/etc/environment");
51 48
...@@ -71,67 +68,52 @@ public class ProxyLinux { ...@@ -71,67 +68,52 @@ public class ProxyLinux {
71 } 68 }
72 bw.write("\n"); 69 bw.write("\n");
73 bw.close(); 70 bw.close();
74 db.create(pbs); 71 return db.create(pbs);
75 72
76 } catch (IOException e) { 73 } catch (IOException e) {
77 log.error(e.getMessage()); 74 log.error(e.getMessage());
75 return Msg.SaveFileError.getCode();
78 } 76 }
79 } 77 }
80 78
81 79
82 80
83 81
84 public void init() { 82 public int init() {
85 pbs= new Vector<ProxyBean>(); 83 pbs= new Vector<ProxyBean>();
86 84
87
88
89
90 //HTTP PROXY 85 //HTTP PROXY
91 pmp=new ProxyBean(); 86 pmp=new ProxyBean();
92 87 pmp.setEnabled(DefSettings.Proxy_http_enabled);
93 pmp.setEnabled(false); 88 pmp.setProtocol(DefSettings.Proxy_http_protocol);
94 pmp.setProtocol("http"); 89 pmp.setHost(DefSettings.Proxy_http_host);
95 pmp.setHost("127.0.0.1"); 90 pmp.setPort(DefSettings.Proxy_http_port);
96 pmp.setPort(3632); 91 pmp.setLogin(DefSettings.Proxy_http_login);
97 pmp.setLogin("root"); 92 pmp.setPass(DefSettings.Proxy_http_pass);
98 pmp.setPass("root"); 93 pmp.setUseAuth(DefSettings.Proxy_http_useauth);
99 pmp.setUseAuth(false);
100
101 pbs.add(pmp); 94 pbs.add(pmp);
102
103
104 //HTTPS PROXY 95 //HTTPS PROXY
105 pmp=new ProxyBean(); 96 pmp=new ProxyBean();
106 97 pmp.setEnabled(DefSettings.Proxy_https_enabled);
107 pmp.setEnabled(false); 98 pmp.setProtocol(DefSettings.Proxy_https_protocol);
108 pmp.setProtocol("https"); 99 pmp.setHost(DefSettings.Proxy_https_host);
109 pmp.setHost("127.0.0.1"); 100 pmp.setPort(DefSettings.Proxy_https_port);
110 pmp.setPort(3632); 101 pmp.setLogin(DefSettings.Proxy_https_login);
111 pmp.setLogin("root"); 102 pmp.setPass(DefSettings.Proxy_https_pass);
112 pmp.setPass("root"); 103 pmp.setUseAuth(DefSettings.Proxy_https_useauth);
113 pmp.setUseAuth(false);
114
115 pbs.add(pmp); 104 pbs.add(pmp);
116
117 //FTP PROXY 105 //FTP PROXY
118 pmp=new ProxyBean(); 106 pmp=new ProxyBean();
119 107 pmp.setEnabled(DefSettings.Proxy_ftp_enabled);
120 pmp.setEnabled(false); 108 pmp.setProtocol(DefSettings.Proxy_ftp_protocol);
121 pmp.setProtocol("ftp"); 109 pmp.setHost(DefSettings.Proxy_ftp_host);
122 pmp.setHost("127.0.0.1"); 110 pmp.setPort(DefSettings.Proxy_ftp_port);
123 pmp.setPort(3632); 111 pmp.setLogin(DefSettings.Proxy_ftp_login);
124 pmp.setLogin("root"); 112 pmp.setPass(DefSettings.Proxy_ftp_pass);
125 pmp.setPass("root"); 113 pmp.setUseAuth(DefSettings.Proxy_ftp_useauth);
126 pmp.setUseAuth(false);
127
128 pbs.add(pmp); 114 pbs.add(pmp);
129 115
130 Config(pbs); 116 return Config(pbs);
131
132
133
134
135 117
136 } 118 }
137 119
......
...@@ -6,13 +6,10 @@ import java.util.Vector; ...@@ -6,13 +6,10 @@ import java.util.Vector;
6 import org.emercit.servers.model.ServerBean; 6 import org.emercit.servers.model.ServerBean;
7 7
8 public interface IServers { 8 public interface IServers {
9
10 9
11 public Vector<ServerBean> get(); 10 public Vector<ServerBean> get();
12 11 public int set(Vector<ServerBean> beans);
13 public boolean set(Vector<ServerBean> beans); 12 public int init();
14
15 public void init();
16 13
17 14
18 } 15 }
......
...@@ -11,8 +11,9 @@ import java.io.FileInputStream; ...@@ -11,8 +11,9 @@ import java.io.FileInputStream;
11 import org.apache.log4j.Logger; 11 import org.apache.log4j.Logger;
12 import org.emercit.servers.model.ServerBean; 12 import org.emercit.servers.model.ServerBean;
13 import org.emercit.servers.service.IServers; 13 import org.emercit.servers.service.IServers;
14 import org.emercit.utilstools.config.Paths;
15 import org.emercit.utilstools.config.DefSettings;
14 import org.emercit.xmldbmanager.service.Db; 16 import org.emercit.xmldbmanager.service.Db;
15 import org.emercit.projecttools.constants.Paths;
16 17
17 public class Servers implements IServers { 18 public class Servers implements IServers {
18 19
...@@ -20,35 +21,32 @@ public class Servers implements IServers { ...@@ -20,35 +21,32 @@ public class Servers implements IServers {
20 21
21 private Db db=new Db(Paths.BEAN_REMOTESERVER); 22 private Db db=new Db(Paths.BEAN_REMOTESERVER);
22 23
23 public boolean set(Vector<ServerBean> beans) { 24 public int set(Vector<ServerBean> beans) {
24 25
25 return db.create(beans); 26 return db.create(beans);
26 } 27 }
27 28
28 public Vector<ServerBean> get() { 29 public Vector<ServerBean> get() {
29
30 return (Vector<ServerBean>)db.select(); 30 return (Vector<ServerBean>)db.select();
31 } 31 }
32 32
33 33 public int init() {
34
35 public void init() {
36
37 Vector<ServerBean> beans=new Vector<ServerBean>();
38
39 ServerBean rsb=new ServerBean();
40 34
41 rsb.setId(1); 35 Vector<ServerBean> beans=new Vector<ServerBean>();
42 rsb.setIp("127.0.0.1"); 36
43 rsb.setPort(80); 37 ServerBean rsb=new ServerBean();
44 rsb.setName(""); 38
45 rsb.setType("szs"); 39 rsb.setId(DefSettings.Server_id);
46 rsb.setTitle(""); 40 rsb.setIp(DefSettings.Server_ip);
47 41 rsb.setPort(DefSettings.Server_port);
48 beans.add(rsb); 42 rsb.setName(DefSettings.Server_name);
49 43 rsb.setType(DefSettings.Server_type);
50 set(beans); 44 rsb.setTitle(DefSettings.Server_title);
51 } 45
46 beans.add(rsb);
47
48 return set(beans);
49 }
52 50
53 } 51 }
54 52
......
...@@ -6,11 +6,11 @@ import java.util.Vector; ...@@ -6,11 +6,11 @@ import java.util.Vector;
6 6
7 public interface ISv { 7 public interface ISv {
8 8
9 public void set(Vector<SvBean> m); 9 public int set(Vector<SvBean> m);
10 10
11 public Vector<SvBean> get(); 11 public Vector<SvBean> get();
12 12
13 public void init(); 13 public int init();
14 14
15 15
16 } 16 }
......
...@@ -2,15 +2,10 @@ package org.emercit.svmanager.service; ...@@ -2,15 +2,10 @@ package org.emercit.svmanager.service;
2 2
3 public interface ISvControl { 3 public interface ISvControl {
4 4
5 public boolean start(); 5 public int start();
6 6 public int stop();
7 public boolean stop(); 7 public int restart();
8 8 public int addAutoRun();
9 public boolean restart(); 9 public int delAutoRun();
10
11
12 public boolean addAutoRun();
13
14 public boolean delAutoRun();
15 10
16 } 11 }
......
...@@ -4,9 +4,8 @@ import java.util.Vector; ...@@ -4,9 +4,8 @@ import java.util.Vector;
4 4
5 import org.emercit.svmanager.model.SvBean; 5 import org.emercit.svmanager.model.SvBean;
6 import org.emercit.xmldbmanager.service.Db; 6 import org.emercit.xmldbmanager.service.Db;
7 import org.emercit.projecttools.constants.Paths;
8
9 import org.emercit.svmanager.service.SvControl; 7 import org.emercit.svmanager.service.SvControl;
8 import org.emercit.utilstools.config.Paths;
10 9
11 10
12 public class Sv { 11 public class Sv {
...@@ -19,9 +18,9 @@ public class Sv { ...@@ -19,9 +18,9 @@ public class Sv {
19 18
20 private SvControl svcontrol; 19 private SvControl svcontrol;
21 20
22 public void set(Vector<SvBean> m) { 21 public int set(Vector<SvBean> m) {
23 22
24 db.create(m); 23 return db.create(m);
25 } 24 }
26 25
27 public Vector<SvBean> get() { 26 public Vector<SvBean> get() {
...@@ -29,7 +28,7 @@ public class Sv { ...@@ -29,7 +28,7 @@ public class Sv {
29 return (Vector<SvBean>)db.select(); 28 return (Vector<SvBean>)db.select();
30 } 29 }
31 30
32 public void init() { 31 public int init() {
33 32
34 svbeans=new Vector<SvBean>(); 33 svbeans=new Vector<SvBean>();
35 34
...@@ -49,7 +48,7 @@ public class Sv { ...@@ -49,7 +48,7 @@ public class Sv {
49 svbean.setIsrun(true); 48 svbean.setIsrun(true);
50 svbeans.add(svbean); 49 svbeans.add(svbean);
51 50
52 set(svbeans); 51 int res=set(svbeans);
53 52
54 for (SvBean sv:svbeans ) { 53 for (SvBean sv:svbeans ) {
55 54
...@@ -61,5 +60,6 @@ public class Sv { ...@@ -61,5 +60,6 @@ public class Sv {
61 svcontrol.delAutoRun(); 60 svcontrol.delAutoRun();
62 } 61 }
63 } 62 }
63 return res;
64 } 64 }
65 } 65 }
......
...@@ -2,8 +2,8 @@ package org.emercit.svmanager.service; ...@@ -2,8 +2,8 @@ package org.emercit.svmanager.service;
2 2
3 3
4 import org.emercit.pckutils.cmd.CmdExec; 4 import org.emercit.pckutils.cmd.CmdExec;
5 5 import org.emercit.utilstools.config.Paths;
6 import org.emercit.projecttools.constants.Paths; 6 import org.emercit.utilstools.config.Msg;
7 7
8 public class SvControl implements ISvControl { 8 public class SvControl implements ISvControl {
9 9
...@@ -16,39 +16,39 @@ public class SvControl implements ISvControl { ...@@ -16,39 +16,39 @@ public class SvControl implements ISvControl {
16 this.process=process; 16 this.process=process;
17 } 17 }
18 18
19 public boolean stop() { 19 public int stop() {
20 20
21 try { cmdexec.Run(Paths.dirInit_d+" "+process+" "+"stop"); }catch(Exception e) { return false; }; 21 try { cmdexec.Run(Paths.dirInit_d+" "+process+" "+"stop"); }catch(Exception e) { return Msg.ProcessStopError.getCode(); };
22 22
23 return true; 23 return Msg.ProcessStopSucc.getCode();
24 } 24 }
25 25
26 public boolean start() { 26 public int start() {
27 27
28 try { cmdexec.Run(Paths.dirInit_d+process+" "+"start"); }catch(Exception e) { return false; }; 28 try { cmdexec.Run(Paths.dirInit_d+process+" "+"start"); }catch(Exception e) { return Msg.ProcessStartError.getCode(); };
29 29
30 return true; 30 return Msg.ProcessStartSucc.getCode();
31 } 31 }
32 32
33 public boolean restart() { 33 public int restart() {
34 34
35 try { cmdexec.Run(Paths.dirInit_d+process+" "+"restart"); }catch(Exception e) { return false; }; 35 try { cmdexec.Run(Paths.dirInit_d+process+" "+"restart"); }catch(Exception e) { return Msg.ProcessRestartError.getCode(); };
36 36
37 return true; 37 return Msg.ProcessRestartSucc.getCode();
38 } 38 }
39 39
40 public boolean addAutoRun() { 40 public int addAutoRun() {
41 41
42 try { cmdexec.Run("update-rc.d "+process+" default"); }catch(Exception e) { return false; }; 42 try { cmdexec.Run("update-rc.d "+process+" default"); }catch(Exception e) { return Msg.ProcessAddAutoRunError.getCode(); };
43 43
44 return true; 44 return Msg.ProcessAddAutoRunSucc.getCode();
45 } 45 }
46 46
47 public boolean delAutoRun() { 47 public int delAutoRun() {
48 48
49 try { cmdexec.Run("update-rc.d -f "+process+" remove"); }catch(Exception e) { return false; }; 49 try { cmdexec.Run("update-rc.d -f "+process+" remove"); }catch(Exception e) { return Msg.ProcessDelAutoRunError.getCode(); };
50 50
51 return true; 51 return Msg.ProcessDelAutoRunSucc.getCode();
52 } 52 }
53 53
54 54
......
1 package org.emercit.projecttools.constants; 1 package org.emercit.utilstools.config;
2 2
3 import java.util.Vector; 3 import java.util.Vector;
4 4
5 import org.emercit.proxymanager.model.ProxyBean;
6
5 public class DefSettings { 7 public class DefSettings {
6 8
7 //DevInfo 9 //DevInfo
...@@ -33,11 +35,38 @@ public class DefSettings { ...@@ -33,11 +35,38 @@ public class DefSettings {
33 public static final String Eth1_extinfo=""; 35 public static final String Eth1_extinfo="";
34 //GSM 36 //GSM
35 public static final String gsm_operator="megafon"; 37 public static final String gsm_operator="megafon";
38 //PROXY HTTP
39 public static final String Proxy_http_protocol="http";
40 public static final String Proxy_http_host="127.0.0.1";
41 public static final int Proxy_http_port=3612;
42 public static final String Proxy_http_login="user";
43 public static final String Proxy_http_pass="user";
44 public static final boolean Proxy_http_enabled=false;
45 public static final boolean Proxy_http_useauth=false;
46 //PROXY HTTPS
47 public static final String Proxy_https_protocol="https";
48 public static final String Proxy_https_host="127.0.0.1";
49 public static final int Proxy_https_port=3612;
50 public static final String Proxy_https_login="user";
51 public static final String Proxy_https_pass="user";
52 public static final boolean Proxy_https_enabled=false;
53 public static final boolean Proxy_https_useauth=false;
54 //PROXY FTP
55 public static final String Proxy_ftp_protocol="ftp";
56 public static final String Proxy_ftp_host="127.0.0.1";
57 public static final int Proxy_ftp_port=3612;
58 public static final String Proxy_ftp_login="user";
59 public static final String Proxy_ftp_pass="user";
60 public static final boolean Proxy_ftp_enabled=false;
61 public static final boolean Proxy_ftp_useauth=false;
62 //REMOTE SERVERS
63 public static final int Server_id=0;
64 public static final String Server_name="Локальный сервер";
65 public static final String Server_ip="127.0.0.1";
66 public static final int Server_port=80;
67 public static final String Server_type="СЗС";
68 public static final String Server_title="";
36 69
37 70
38 71
39
40
41
42
43 } 72 }
......
1 package org.emercit.projecttools.constants; 1 package org.emercit.utilstools.config;
2 2
3 import org.emercit.projecttools.constants.TypeMsg; 3 import org.emercit.utilstools.config.TypeMsg;
4 4
5 public enum Msg { 5 public enum Msg {
6 6
...@@ -16,11 +16,24 @@ public enum Msg { ...@@ -16,11 +16,24 @@ public enum Msg {
16 CalibrSucc(7,TypeMsg.INFO,"Выполнена калибровка экрана"), 16 CalibrSucc(7,TypeMsg.INFO,"Выполнена калибровка экрана"),
17 CalibrError(8,TypeMsg.ERROR,"Калибровка экрана не выполнена"), 17 CalibrError(8,TypeMsg.ERROR,"Калибровка экрана не выполнена"),
18 18
19
20 InitSucc(9,TypeMsg.INFO,"Выполнена инициализация"), 19 InitSucc(9,TypeMsg.INFO,"Выполнена инициализация"),
21 InitError(10,TypeMsg.ERROR,"Инициализация не выполнена"); 20 InitError(10,TypeMsg.ERROR,"Инициализация не выполнена"),
21
22 ProcessStopSucc(11,TypeMsg.INFO,"Выполнена остановка процесса"),
23 ProcessStopError(12,TypeMsg.ERROR,"Ошибка при выполнении остановки процесса"),
24
25 ProcessStartSucc(13,TypeMsg.INFO,"Выполнена остановка процесса"),
26 ProcessStartError(14,TypeMsg.ERROR,"Ошибка при выполнеии запуска процесса"),
22 27
28 ProcessRestartSucc(15,TypeMsg.INFO,"Выполнена перезагрузка процесса"),
29 ProcessRestartError(16,TypeMsg.ERROR,"Ошибка при перезагрузки процесса"),
23 30
31 ProcessAddAutoRunSucc(17,TypeMsg.INFO,"Процесс успешно добалвен в автозагрузку"),
32 ProcessDelAutoRunSucc(18,TypeMsg.INFO,"Процесс удален из автозагрузки"),
33
34 ProcessAddAutoRunError(19,TypeMsg.INFO,"Ошибка при добавлении процесса в автозагрузку"),
35 ProcessDelAutoRunError(20,TypeMsg.INFO,"Ошибка при удалении процесса из автозагрузки");
36
24 37
25 private int code; 38 private int code;
26 39
...@@ -50,8 +63,8 @@ public enum Msg { ...@@ -50,8 +63,8 @@ public enum Msg {
50 public TypeMsg getTypeVariable() { 63 public TypeMsg getTypeVariable() {
51 return this.type; 64 return this.type;
52 } 65 }
53 public TypeMsg getDescription() { 66 public String getDescription() {
54 return this.type; 67 return this.description;
55 } 68 }
56 69
57 70
......
1 package org.emercit.projecttools.constants; 1 package org.emercit.utilstools.config;
2 2
3 public class Paths { 3 public class Paths {
4 4
...@@ -22,5 +22,7 @@ public class Paths { ...@@ -22,5 +22,7 @@ public class Paths {
22 //PROCESS 22 //PROCESS
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
26 public static final String UTILSTOOLS_LOGFILE="/var/log/devtools.log";
25 27
26 } 28 }
......
1 package org.emercit.projecttools.constants; 1 package org.emercit.utilstools.config;
2 2
3 3
4 public enum TypeMsg implements TypeVariable { 4 public enum TypeMsg implements TypeVariable {
......
1 package org.emercit.projecttools.constants; 1 package org.emercit.utilstools.config;
2 2
3 public interface TypeVariable {}; 3 public interface TypeVariable {};
...\ No newline at end of file ...\ No newline at end of file
......
1 /**
2 *
3 */
4 /**
5 * @author root
6 *
7 */
8 package org.emercit.utilstools.config;
...\ No newline at end of file ...\ No newline at end of file
...@@ -2,20 +2,14 @@ package org.emercit.utilstools.service; ...@@ -2,20 +2,14 @@ package org.emercit.utilstools.service;
2 2
3 import java.util.Vector; 3 import java.util.Vector;
4 4
5 import org.emercit.utilstools.config.Msg;
5 import org.emercit.utilstools.model.SettingsBean; 6 import org.emercit.utilstools.model.SettingsBean;
6 7
7 import org.emercit.projecttools.constants.Msg;
8
9 public interface ISettings { 8 public interface ISettings {
10 9
11 //public SettingsBean get(); 10 public int set(SettingsBean bean);
12 11 public void configuring(SettingsBean model);
13 public Msg set(SettingsBean bean);
14
15 public boolean configuring(SettingsBean model);
16
17 public SettingsBean make(); 12 public SettingsBean make();
18 13 public int init();
19 public void init();
20 14
21 } 15 }
......
...@@ -2,15 +2,12 @@ package org.emercit.utilstools.service; ...@@ -2,15 +2,12 @@ package org.emercit.utilstools.service;
2 2
3 import java.util.Vector; 3 import java.util.Vector;
4 4
5 import org.emercit.utilstools.config.Msg;
6 import org.emercit.utilstools.config.Paths;
5 import org.emercit.utilstools.model.SettingsBean; 7 import org.emercit.utilstools.model.SettingsBean;
6
7
8 import org.emercit.xmldbmanager.service.Db; 8 import org.emercit.xmldbmanager.service.Db;
9 import org.emercit.projecttools.constants.Paths;
10
11 import org.emercit.dtmanager.model.DateInfo; 9 import org.emercit.dtmanager.model.DateInfo;
12 import org.emercit.ethmanager.model.EthBean; 10 import org.emercit.ethmanager.model.EthBean;
13
14 import org.emercit.devinfo.service.DevInfo; 11 import org.emercit.devinfo.service.DevInfo;
15 import org.emercit.dnsmanager.service.DnsLinux; 12 import org.emercit.dnsmanager.service.DnsLinux;
16 import org.emercit.dtmanager.service.NtpLinux; 13 import org.emercit.dtmanager.service.NtpLinux;
...@@ -20,7 +17,8 @@ import org.emercit.proxymanager.service.ProxyLinux; ...@@ -20,7 +17,8 @@ import org.emercit.proxymanager.service.ProxyLinux;
20 import org.emercit.servers.service.Servers; 17 import org.emercit.servers.service.Servers;
21 import org.emercit.svmanager.service.Sv; 18 import org.emercit.svmanager.service.Sv;
22 19
23 import org.emercit.projecttools.constants.Msg; 20 import org.emercit.utilstools.config.Msg;
21
24 22
25 public class Settings implements ISettings { 23 public class Settings implements ISettings {
26 24
...@@ -54,7 +52,7 @@ public class Settings implements ISettings { ...@@ -54,7 +52,7 @@ public class Settings implements ISettings {
54 } 52 }
55 */ 53 */
56 54
57 public Msg set(SettingsBean bean) { 55 public int set(SettingsBean bean) {
58 56
59 return db.create(bean); 57 return db.create(bean);
60 } 58 }
...@@ -63,7 +61,7 @@ public class Settings implements ISettings { ...@@ -63,7 +61,7 @@ public class Settings implements ISettings {
63 * Применение конфигурации из карты настроек 61 * Применение конфигурации из карты настроек
64 * @see org.emercit.utilstools.service.ISettings#configuring() 62 * @see org.emercit.utilstools.service.ISettings#configuring()
65 */ 63 */
66 public boolean configuring(SettingsBean model) { 64 public void configuring(SettingsBean model) {
67 65
68 devinfo.set(model.getDevInfoBean()); 66 devinfo.set(model.getDevInfoBean());
69 dnslinux.Config(model.getDnsbeans()); 67 dnslinux.Config(model.getDnsbeans());
...@@ -80,10 +78,11 @@ public class Settings implements ISettings { ...@@ -80,10 +78,11 @@ public class Settings implements ISettings {
80 78
81 proxylinux.Config(model.getProxyBeans()); 79 proxylinux.Config(model.getProxyBeans());
82 80
81
83 remserv.set(model.getRserverbeans()); 82 remserv.set(model.getRserverbeans());
84 83
85 84
86 return true; 85
87 } 86 }
88 87
89 public SettingsBean make() { 88 public SettingsBean make() {
...@@ -110,7 +109,7 @@ public class Settings implements ISettings { ...@@ -110,7 +109,7 @@ public class Settings implements ISettings {
110 } 109 }
111 110
112 111
113 public void init(){ 112 public int init(){
114 113
115 devinfo.init(); 114 devinfo.init();
116 dnslinux.init(); 115 dnslinux.init();
...@@ -124,9 +123,8 @@ public class Settings implements ISettings { ...@@ -124,9 +123,8 @@ public class Settings implements ISettings {
124 123
125 sb=make(); 124 sb=make();
126 125
127 set(sb); 126 return set(sb);
128 127
129
130 } 128 }
131 129
132 130
......
...@@ -9,8 +9,8 @@ import java.io.FileOutputStream; ...@@ -9,8 +9,8 @@ import java.io.FileOutputStream;
9 9
10 import org.apache.log4j.Logger; 10 import org.apache.log4j.Logger;
11 import org.emercit.devinfo.service.DevInfo; 11 import org.emercit.devinfo.service.DevInfo;
12 import org.emercit.projecttools.constants.Paths; 12 import org.emercit.utilstools.config.Msg;
13 import org.emercit.projecttools.constants.Msg; 13 import org.emercit.utilstools.config.Paths;
14 14
15 public class Db implements IDb { 15 public class Db implements IDb {
16 16
...@@ -26,7 +26,7 @@ public class Db implements IDb { ...@@ -26,7 +26,7 @@ public class Db implements IDb {
26 * Создает или перезаписывает сущетсвующий файл 26 * Создает или перезаписывает сущетсвующий файл
27 * @see org.emercit.xmldbmanager.service.IDb#create(java.lang.Object) 27 * @see org.emercit.xmldbmanager.service.IDb#create(java.lang.Object)
28 */ 28 */
29 public Msg create(Object o) { 29 public int create(Object o) {
30 30
31 boolean result=true; 31 boolean result=true;
32 try { 32 try {
...@@ -35,10 +35,12 @@ public class Db implements IDb { ...@@ -35,10 +35,12 @@ public class Db implements IDb {
35 XMLEncoder xmlEncoder = new XMLEncoder(bos); 35 XMLEncoder xmlEncoder = new XMLEncoder(bos);
36 xmlEncoder.writeObject(o); 36 xmlEncoder.writeObject(o);
37 xmlEncoder.close(); 37 xmlEncoder.close();
38 log.error(Msg.SaveFileSucc.getDescription());
38 }catch(Exception e) { 39 }catch(Exception e) {
39 return Msg.SaveFileError; 40 log.error(e.getMessage());
41 return Msg.SaveFileError.getCode();
40 } 42 }
41 return Msg.SaveFileSucc; 43 return Msg.SaveFileSucc.getCode();
42 44
43 } 45 }
44 46
...@@ -53,10 +55,10 @@ public class Db implements IDb { ...@@ -53,10 +55,10 @@ public class Db implements IDb {
53 new FileInputStream(pathfile))); 55 new FileInputStream(pathfile)));
54 Object result=(Object)d.readObject(); 56 Object result=(Object)d.readObject();
55 d.close(); 57 d.close();
56 log.error(Msg.LoadFileSucc); 58 log.info(Msg.LoadFileSucc.getDescription());
57 return result; 59 return result;
58 }catch(Exception e) { 60 }catch(Exception e) {
59 log.error(Msg.LoadFileError); 61 log.error(e.getMessage());
60 return null; 62 return null;
61 } 63 }
62 } 64 }
......
1 package org.emercit.xmldbmanager.service; 1 package org.emercit.xmldbmanager.service;
2 2
3 import org.emercit.projecttools.constants.Msg; 3 import org.emercit.utilstools.config.Msg;
4 4
5 public interface IDb { 5 public interface IDb {
6 6
7 public Msg create(Object obj); 7 public int create(Object obj);
8 8
9 public Object select(); 9 public Object select();
10 10
......