Commit 64baf84c 64baf84c45d59f04a51fa51964089d25e34fe47d by root

save

1 parent c08edf5c
...@@ -19,6 +19,8 @@ public class DevInfo implements IDevInfo { ...@@ -19,6 +19,8 @@ public class DevInfo implements IDevInfo {
19 19
20 private Db db=new Db(Paths.BEAN_DEVINFO); 20 private Db db=new Db(Paths.BEAN_DEVINFO);
21 21
22 private DevInfoBean devinfobean;
23
22 public boolean set(DevInfoBean m) { 24 public boolean set(DevInfoBean m) {
23 return db.create(m); 25 return db.create(m);
24 } 26 }
...@@ -27,4 +29,14 @@ public class DevInfo implements IDevInfo { ...@@ -27,4 +29,14 @@ public class DevInfo implements IDevInfo {
27 return (DevInfoBean)db.select(); 29 return (DevInfoBean)db.select();
28 } 30 }
29 31
32
33 public void init() {
34
35 devinfobean=new DevInfoBean();
36 devinfobean.setDescription("Описание устройства");
37 devinfobean.setGuid("00000000-0000-0000-0000-000000000000");
38
39 set(devinfobean);
40 }
41
30 } 42 }
......
...@@ -15,4 +15,6 @@ public interface IDevInfo { ...@@ -15,4 +15,6 @@ public interface IDevInfo {
15 15
16 public DevInfoBean get(); 16 public DevInfoBean get();
17 17
18 public void init();
19
18 } 20 }
......
...@@ -51,7 +51,6 @@ public class DnsLinux implements IDns{ ...@@ -51,7 +51,6 @@ public class DnsLinux implements IDns{
51 51
52 public boolean Update(Vector<DnsBean> beans) { 52 public boolean Update(Vector<DnsBean> beans) {
53 53
54
55 return Config(beans); 54 return Config(beans);
56 55
57 } 56 }
...@@ -119,6 +118,18 @@ public class DnsLinux implements IDns{ ...@@ -119,6 +118,18 @@ public class DnsLinux implements IDns{
119 return false; 118 return false;
120 } 119 }
121 120
121 public void init() {
122 dbs=new Vector<DnsBean>();
123 db=new DnsBean();
124
125 db.setIp("8.8.8.8");
126
127 dbs.add(db);
128
129 Config(dbs);
130
131 }
132
122 133
123 134
124 } 135 }
......
...@@ -15,6 +15,8 @@ public interface IDns { ...@@ -15,6 +15,8 @@ public interface IDns {
15 15
16 public Vector<DnsBean> getAllDns(); 16 public Vector<DnsBean> getAllDns();
17 17
18 public void init();
19
18 } 20 }
19 21
20 22
......
...@@ -6,5 +6,7 @@ public interface INtp { ...@@ -6,5 +6,7 @@ public interface INtp {
6 6
7 public boolean setUsNtpServer(String value); 7 public boolean setUsNtpServer(String value);
8 8
9 public void init();
10
9 11
10 } 12 }
......
...@@ -64,6 +64,12 @@ public class NtpLinux implements INtp { ...@@ -64,6 +64,12 @@ public class NtpLinux implements INtp {
64 return true; 64 return true;
65 } 65 }
66 66
67 public void init() {
68
69 setUsNtpServer("127.0.0.1");
70
71 }
72
67 73
68 74
69 } 75 }
......
...@@ -15,7 +15,7 @@ public class Paths { ...@@ -15,7 +15,7 @@ public class Paths {
15 public static final String BEAN_DEVINFO=dirBeans+"DevInfo.xml"; 15 public static final String BEAN_DEVINFO=dirBeans+"DevInfo.xml";
16 public static final String BEAN_DNS=dirBeans+"DnsBeans.xml"; 16 public static final String BEAN_DNS=dirBeans+"DnsBeans.xml";
17 public static final String BEAN_PROXY=dirBeans+"ProxyBeans.xml"; 17 public static final String BEAN_PROXY=dirBeans+"ProxyBeans.xml";
18 public static final String BEAN_REMOTESERVER=dirBeans+"RemoteServerBeans.xml"; 18 public static final String BEAN_REMOTESERVER=dirBeans+"ServersBeans.xml";
19 public static final String BEAN_SV=dirBeans+"SvBeans.xml"; 19 public static final String BEAN_SV=dirBeans+"SvBeans.xml";
20 public static final String BEAN_SETTINGS=dirBeans+"SettingsBeans.xml"; 20 public static final String BEAN_SETTINGS=dirBeans+"SettingsBeans.xml";
21 21
......
...@@ -28,7 +28,6 @@ public class Servers implements IServers { ...@@ -28,7 +28,6 @@ public class Servers implements IServers {
28 public Vector<ServerBean> get() { 28 public Vector<ServerBean> get() {
29 29
30 return (Vector<ServerBean>)db.select(); 30 return (Vector<ServerBean>)db.select();
31
32 } 31 }
33 32
34 33
...@@ -49,8 +48,6 @@ public void init() { ...@@ -49,8 +48,6 @@ public void init() {
49 beans.add(rsb); 48 beans.add(rsb);
50 49
51 set(beans); 50 set(beans);
52
53
54 } 51 }
55 52
56 } 53 }
......
...@@ -3,6 +3,8 @@ package org.emercit.utilstools; ...@@ -3,6 +3,8 @@ package org.emercit.utilstools;
3 import org.emercit.utilstools.model.SettingsBean; 3 import org.emercit.utilstools.model.SettingsBean;
4 import org.emercit.utilstools.service.Settings; 4 import org.emercit.utilstools.service.Settings;
5 5
6 import org.emercit.devinfo.model.DevInfoBean;
7
6 8
7 public class App 9 public class App
8 { 10 {
...@@ -14,9 +16,11 @@ public class App ...@@ -14,9 +16,11 @@ public class App
14 16
15 Settings settings=new Settings(); 17 Settings settings=new Settings();
16 18
17 SettingsBean sb=settings.make(); 19 settings.init();
20
21
22
18 23
19 settings.set(sb);
20 24
21 25
22 } 26 }
......
...@@ -6,12 +6,14 @@ import org.emercit.utilstools.model.SettingsBean; ...@@ -6,12 +6,14 @@ import org.emercit.utilstools.model.SettingsBean;
6 6
7 public interface ISettings { 7 public interface ISettings {
8 8
9 public SettingsBean get(); 9 //public SettingsBean get();
10 10
11 public boolean set(SettingsBean bean); 11 public boolean set(SettingsBean bean);
12 12
13 public boolean configuring(); 13 public boolean configuring(SettingsBean model);
14 14
15 public SettingsBean make(); 15 public SettingsBean make();
16 16
17 public void init();
18
17 } 19 }
......
...@@ -3,9 +3,14 @@ package org.emercit.utilstools.service; ...@@ -3,9 +3,14 @@ package org.emercit.utilstools.service;
3 import java.util.Vector; 3 import java.util.Vector;
4 4
5 import org.emercit.utilstools.model.SettingsBean; 5 import org.emercit.utilstools.model.SettingsBean;
6
7
6 import org.emercit.xmldbmanager.service.Db; 8 import org.emercit.xmldbmanager.service.Db;
7 import org.emercit.projecttools.constants.Paths; 9 import org.emercit.projecttools.constants.Paths;
10
8 import org.emercit.dtmanager.model.DateInfo; 11 import org.emercit.dtmanager.model.DateInfo;
12 import org.emercit.ethmanager.model.EthBean;
13
9 import org.emercit.devinfo.service.DevInfo; 14 import org.emercit.devinfo.service.DevInfo;
10 import org.emercit.dnsmanager.service.DnsLinux; 15 import org.emercit.dnsmanager.service.DnsLinux;
11 import org.emercit.dtmanager.service.NtpLinux; 16 import org.emercit.dtmanager.service.NtpLinux;
...@@ -39,20 +44,43 @@ public class Settings implements ISettings { ...@@ -39,20 +44,43 @@ public class Settings implements ISettings {
39 private Sv sv=new Sv(); 44 private Sv sv=new Sv();
40 45
41 46
42
43 private SettingsBean sb; 47 private SettingsBean sb;
44 48
49 /*
45 public SettingsBean get() { 50 public SettingsBean get() {
46 51
47 return (SettingsBean)db.select(); 52 return (SettingsBean)db.select();
48 } 53 }
54 */
49 55
50 public boolean set(SettingsBean bean) { 56 public boolean set(SettingsBean bean) {
51 57
52 return db.create(bean); 58 return db.create(bean);
53 } 59 }
54 60
55 public boolean configuring() { 61 /*
62 * Применение конфигурации из карты настроек
63 * @see org.emercit.utilstools.service.ISettings#configuring()
64 */
65 public boolean configuring(SettingsBean model) {
66
67 devinfo.set(model.getDevInfoBean());
68 dnslinux.Config(model.getDnsbeans());
69
70 DateInfo dateinfo=model.getDateInfo();
71 ntplinux.setUsNtpServer(dateinfo.getNtp());
72
73 gsm.set(model.getGSMBean());
74
75 for (EthBean eb:model.getEthBeans()) {
76
77 ethlinux.Update(eb);
78 }
79
80 proxylinux.Config(model.getProxyBeans());
81
82 remserv.set(model.getRserverbeans());
83
56 84
57 return true; 85 return true;
58 } 86 }
...@@ -81,6 +109,26 @@ public class Settings implements ISettings { ...@@ -81,6 +109,26 @@ public class Settings implements ISettings {
81 } 109 }
82 110
83 111
112 public void init(){
113
114 devinfo.init();
115 dnslinux.init();
116 ntplinux.init();
117 gsm.init();
118 ethlinux.setDefaults();
119 proxylinux.init();
120 remserv.init();
121
122 sb=new SettingsBean();
123
124 sb=make();
125
126 set(sb);
127
128
129 }
130
131
84 132
85 133
86 134
......