save
Showing
45 changed files
with
455 additions
and
414 deletions
| ... | @@ -132,64 +132,11 @@ | ... | @@ -132,64 +132,11 @@ |
| 132 | <scope>test</scope> | 132 | <scope>test</scope> |
| 133 | </dependency> | 133 | </dependency> |
| 134 | 134 | ||
| 135 | <dependency> | ||
| 136 | <groupId>org.emercit</groupId> | ||
| 137 | <artifactId>devinfo</artifactId> | ||
| 138 | <version>1.0</version> | ||
| 139 | </dependency> | ||
| 140 | |||
| 141 | <dependency> | ||
| 142 | <groupId>org.emercit</groupId> | ||
| 143 | <artifactId>ethmanager</artifactId> | ||
| 144 | <version>1.5</version> | ||
| 145 | </dependency> | ||
| 146 | |||
| 147 | <dependency> | ||
| 148 | <groupId>org.emercit</groupId> | ||
| 149 | <artifactId>dnsmanager</artifactId> | ||
| 150 | <version>1.11</version> | ||
| 151 | </dependency> | ||
| 152 | |||
| 153 | <dependency> | ||
| 154 | <groupId>org.emercit</groupId> | ||
| 155 | <artifactId>proxymanager</artifactId> | ||
| 156 | <version>1.11</version> | ||
| 157 | </dependency> | ||
| 158 | |||
| 159 | <dependency> | ||
| 160 | <groupId>org.emercit</groupId> | ||
| 161 | <artifactId>remoteservers</artifactId> | ||
| 162 | <version>1.5</version> | ||
| 163 | </dependency> | ||
| 164 | |||
| 165 | <dependency> | ||
| 166 | <groupId>org.emercit</groupId> | ||
| 167 | <artifactId>pckutils</artifactId> | ||
| 168 | <version>1.5</version> | ||
| 169 | </dependency> | ||
| 170 | |||
| 171 | <dependency> | ||
| 172 | <groupId>org.emercit</groupId> | ||
| 173 | <artifactId>dtmanager</artifactId> | ||
| 174 | <version>1.2</version> | ||
| 175 | </dependency> | ||
| 176 | 135 | ||
| 177 | <dependency> | 136 | <dependency> |
| 178 | <groupId>org.emercit</groupId> | 137 | <groupId>org.emercit</groupId> |
| 179 | <artifactId>gsmmanager</artifactId> | 138 | <artifactId>utilstools</artifactId> |
| 180 | <version>1.5</version> | 139 | <version>1.0</version> |
| 181 | </dependency> | ||
| 182 | |||
| 183 | <dependency> | ||
| 184 | <groupId>org.emercit</groupId> | ||
| 185 | <artifactId>xmldbmanager</artifactId> | ||
| 186 | <version>1.5</version> | ||
| 187 | </dependency> | ||
| 188 | |||
| 189 | <dependency> | ||
| 190 | <groupId>org.emercit</groupId> | ||
| 191 | <artifactId>projecttools</artifactId> | ||
| 192 | <version>1.5</version> | ||
| 193 | </dependency> | 140 | </dependency> |
| 194 | 141 | ||
| 195 | </dependencies> | 142 | </dependencies> | ... | ... |
No preview for this file type
| 1 | b8e537be9abe9441768d59cf976279b9 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 216e568620c1b0aefc6de1116d2a6877116a4491 | ||
| ... | \ 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.0</version> | ||
| 8 | </project> |
| 1 | c0cfe20cb5a84143fe493150265bbb3a | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | e89dbf7e9452f2b5668a13a911899349c4b356bb | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | f34fb34c127fb701e749ba391cf88fad | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 01a7014d918ebe63858409ea507342bfe788739c | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | package org.emercit.devinfo.service; | ||
| 2 | |||
| 3 | import java.beans.XMLDecoder; | ||
| 4 | import java.beans.XMLEncoder; | ||
| 5 | import java.io.BufferedInputStream; | ||
| 6 | import java.io.BufferedOutputStream; | ||
| 7 | import java.io.FileInputStream; | ||
| 8 | import java.io.FileOutputStream; | ||
| 9 | |||
| 10 | import org.apache.log4j.Logger; | ||
| 11 | import org.emercit.devinfo.model.DevInfoBean; | ||
| 12 | |||
| 13 | import org.emercit.xmldbmanager.service.Db; | ||
| 14 | import org.emercit.projecttools.constants.Paths; | ||
| 15 | |||
| 16 | public class DevInfo implements IDevInfo { | ||
| 17 | |||
| 18 | private static final Logger log = Logger.getLogger(DevInfo.class); | ||
| 19 | |||
| 20 | private Db db=new Db(Paths.BEAN_DEVINFO); | ||
| 21 | |||
| 22 | public boolean set(DevInfoBean m) { | ||
| 23 | return db.create(m); | ||
| 24 | } | ||
| 25 | |||
| 26 | public DevInfoBean get() { | ||
| 27 | return (DevInfoBean)db.select(); | ||
| 28 | } | ||
| 29 | |||
| 30 | } |
| 1 | package org.emercit.devinfo.service; | ||
| 2 | |||
| 3 | import java.beans.XMLDecoder; | ||
| 4 | import java.beans.XMLEncoder; | ||
| 5 | import java.io.BufferedInputStream; | ||
| 6 | import java.io.BufferedOutputStream; | ||
| 7 | import java.io.FileInputStream; | ||
| 8 | import java.io.FileOutputStream; | ||
| 9 | |||
| 10 | import org.apache.log4j.Logger; | ||
| 11 | import org.emercit.devinfo.model.DevInfoBean; | ||
| 12 | |||
| 13 | public class DevInfoImpl implements IDevInfo { | ||
| 14 | |||
| 15 | private static final Logger log = Logger.getLogger(DevInfoImpl.class); | ||
| 16 | |||
| 17 | public boolean Set(DevInfoBean m) { | ||
| 18 | |||
| 19 | try { | ||
| 20 | |||
| 21 | FileOutputStream fos = new FileOutputStream("/opt/devtools/beans/DevInfo.xml"); | ||
| 22 | BufferedOutputStream bos = new BufferedOutputStream(fos); | ||
| 23 | XMLEncoder xmlEncoder = new XMLEncoder(bos); | ||
| 24 | xmlEncoder.writeObject(m); | ||
| 25 | xmlEncoder.close(); | ||
| 26 | return true; | ||
| 27 | }catch(Exception e) { | ||
| 28 | log.error(e.getMessage()); | ||
| 29 | return false; | ||
| 30 | } | ||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | } | ||
| 35 | |||
| 36 | public DevInfoBean Get() { | ||
| 37 | try { | ||
| 38 | XMLDecoder d = new XMLDecoder( | ||
| 39 | new BufferedInputStream( | ||
| 40 | new FileInputStream("/opt/devtools/beans/DevInfo.xml"))); | ||
| 41 | DevInfoBean result =(DevInfoBean) d.readObject(); | ||
| 42 | d.close(); | ||
| 43 | |||
| 44 | return result; | ||
| 45 | }catch(Exception e) { | ||
| 46 | log.error(e.getMessage()); | ||
| 47 | return null; | ||
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 51 | } |
| 1 | package org.emercit.devinfo.service; | ||
| 2 | |||
| 3 | import java.beans.XMLEncoder; | ||
| 4 | import java.beans.XMLDecoder; | ||
| 5 | import java.io.BufferedOutputStream; | ||
| 6 | import java.io.BufferedInputStream; | ||
| 7 | import java.io.FileOutputStream; | ||
| 8 | import java.io.FileInputStream; | ||
| 9 | |||
| 10 | import org.emercit.devinfo.model.DevInfoBean; | ||
| 11 | |||
| 12 | public enum DevInfoService { | ||
| 13 | |||
| 14 | INSTANCE; | ||
| 15 | |||
| 16 | public boolean Set(DevInfoBean m) throws Exception { | ||
| 17 | boolean result=false; | ||
| 18 | |||
| 19 | FileOutputStream fos = new FileOutputStream("/opt/devtools/beans/DevInfo.xml"); | ||
| 20 | BufferedOutputStream bos = new BufferedOutputStream(fos); | ||
| 21 | XMLEncoder xmlEncoder = new XMLEncoder(bos); | ||
| 22 | xmlEncoder.writeObject(m); | ||
| 23 | xmlEncoder.close(); | ||
| 24 | |||
| 25 | return result; | ||
| 26 | |||
| 27 | } | ||
| 28 | |||
| 29 | public DevInfoBean Get() throws Exception { | ||
| 30 | |||
| 31 | DevInfoBean result=null; | ||
| 32 | XMLDecoder d = new XMLDecoder( | ||
| 33 | |||
| 34 | new BufferedInputStream( | ||
| 35 | new FileInputStream("/opt/devtools/beans/DevInfo.xml"))); | ||
| 36 | result =(DevInfoBean) d.readObject(); | ||
| 37 | d.close(); | ||
| 38 | return result; | ||
| 39 | } | ||
| 40 | |||
| 41 | } |
| ... | @@ -11,14 +11,8 @@ import org.emercit.devinfo.model.DevInfoBean; | ... | @@ -11,14 +11,8 @@ import org.emercit.devinfo.model.DevInfoBean; |
| 11 | 11 | ||
| 12 | public interface IDevInfo { | 12 | public interface IDevInfo { |
| 13 | 13 | ||
| 14 | public boolean set(DevInfoBean m); | ||
| 14 | 15 | ||
| 15 | public boolean Set(DevInfoBean m); | 16 | public DevInfoBean get(); |
| 16 | |||
| 17 | |||
| 18 | public DevInfoBean Get(); | ||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | |||
| 23 | 17 | ||
| 24 | } | 18 | } | ... | ... |
| 1 | package org.emercit.dnsmanager.model; | ||
| 2 | |||
| 3 | |||
| 4 | import java.io.BufferedReader; | ||
| 5 | import java.io.InputStreamReader; | ||
| 6 | import java.util.List; | ||
| 7 | import java.util.ArrayList; | ||
| 8 | import java.util.Random; | ||
| 9 | |||
| 10 | import java.util.Vector; | ||
| 11 | |||
| 12 | |||
| 13 | |||
| 14 | public class CommandExecutor { | ||
| 15 | |||
| 16 | |||
| 17 | public Vector<String> Run(String cmd) throws Exception { | ||
| 18 | |||
| 19 | Vector<String> v=new Vector<String>(); | ||
| 20 | |||
| 21 | Runtime run = Runtime.getRuntime(); | ||
| 22 | |||
| 23 | Process proc = run.exec(new String[]{"/bin/sh", "-c",cmd}); | ||
| 24 | proc.waitFor(); | ||
| 25 | BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream())); | ||
| 26 | while(br.ready()) { | ||
| 27 | v.add(br.readLine()); | ||
| 28 | } | ||
| 29 | |||
| 30 | return v; | ||
| 31 | } | ||
| 32 | } |
| ... | @@ -9,22 +9,18 @@ import java.util.Vector; | ... | @@ -9,22 +9,18 @@ import java.util.Vector; |
| 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 | 11 | ||
| 12 | import org.emercit.dnsmanager.model.CommandExecutor; | 12 | import org.emercit.pckutils.cmd.CmdExec; |
| 13 | |||
| 14 | 13 | ||
| 15 | public class DnsLinux implements IDns{ | 14 | public class DnsLinux implements IDns{ |
| 16 | 15 | ||
| 17 | private static final Logger log = Logger.getLogger(DnsLinux.class); | 16 | private static final Logger log = Logger.getLogger(DnsLinux.class); |
| 18 | 17 | ||
| 19 | 18 | private CmdExec ce=new CmdExec(); | |
| 20 | private CommandExecutor ce=new CommandExecutor(); | ||
| 21 | 19 | ||
| 22 | private Vector<DnsBean> dbs; | 20 | private Vector<DnsBean> dbs; |
| 23 | 21 | ||
| 24 | private DnsBean db; | 22 | private DnsBean db; |
| 25 | 23 | ||
| 26 | private String json; | ||
| 27 | |||
| 28 | 24 | ||
| 29 | public void Add (String value){ | 25 | public void Add (String value){ |
| 30 | 26 | ||
| ... | @@ -40,8 +36,6 @@ public class DnsLinux implements IDns{ | ... | @@ -40,8 +36,6 @@ public class DnsLinux implements IDns{ |
| 40 | 36 | ||
| 41 | } | 37 | } |
| 42 | 38 | ||
| 43 | |||
| 44 | |||
| 45 | public void Delete(String value) { | 39 | public void Delete(String value) { |
| 46 | 40 | ||
| 47 | dbs=getAllDns(); | 41 | dbs=getAllDns(); |
| ... | @@ -55,7 +49,6 @@ public class DnsLinux implements IDns{ | ... | @@ -55,7 +49,6 @@ public class DnsLinux implements IDns{ |
| 55 | Config(dbs); | 49 | Config(dbs); |
| 56 | } | 50 | } |
| 57 | 51 | ||
| 58 | |||
| 59 | public boolean Update(Vector<DnsBean> beans) { | 52 | public boolean Update(Vector<DnsBean> beans) { |
| 60 | 53 | ||
| 61 | 54 | ... | ... |
| 1 | package org.emercit.dtmanager.model; | 1 | package org.emercit.dtmanager.model; |
| 2 | 2 | ||
| 3 | public class DateInfo { | 3 | import java.io.Serializable; |
| 4 | |||
| 5 | public class DateInfo implements Serializable { | ||
| 6 | |||
| 7 | private String dt; | ||
| 8 | |||
| 9 | private String ntp; | ||
| 10 | |||
| 11 | public DateInfo() { | ||
| 12 | |||
| 13 | } | ||
| 14 | |||
| 15 | public void setDt(String value){ | ||
| 16 | |||
| 17 | this.dt=value; | ||
| 18 | } | ||
| 19 | |||
| 20 | public String getDt() { | ||
| 21 | |||
| 22 | return dt; | ||
| 23 | } | ||
| 24 | |||
| 25 | |||
| 26 | public void setNtp(String value ) { | ||
| 27 | |||
| 28 | this.ntp=value; | ||
| 29 | } | ||
| 30 | |||
| 31 | public String getNtp() { | ||
| 32 | |||
| 33 | return ntp; | ||
| 34 | } | ||
| 4 | 35 | ||
| 5 | public String dt; | ||
| 6 | 36 | ||
| 7 | public String ntp; | ||
| 8 | 37 | ||
| 9 | } | 38 | } | ... | ... |
| ... | @@ -41,7 +41,9 @@ public class EthLinux implements IEth { | ... | @@ -41,7 +41,9 @@ public class EthLinux implements IEth { |
| 41 | public EthLinux() { | 41 | public EthLinux() { |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | 44 | public Vector<EthBean> getEthBeans(){ | |
| 45 | return (Vector<EthBean>)db.select(); | ||
| 46 | } | ||
| 45 | 47 | ||
| 46 | /* | 48 | /* |
| 47 | * Список интерфейсов Ethernet на данном устройстве | 49 | * Список интерфейсов Ethernet на данном устройстве | ... | ... |
| ... | @@ -17,6 +17,7 @@ public class Paths { | ... | @@ -17,6 +17,7 @@ public class Paths { |
| 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+"RemoteServerBeans.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 | 21 | ||
| 21 | //SCRIPTS | 22 | //SCRIPTS |
| 22 | public static final String FINDPROCESS_SCRIPT=dirScripts+"findprocess.sh"; | 23 | public static final String FINDPROCESS_SCRIPT=dirScripts+"findprocess.sh"; | ... | ... |
| ... | @@ -40,6 +40,10 @@ public class ProxyLinux { | ... | @@ -40,6 +40,10 @@ public class ProxyLinux { |
| 40 | return false; | 40 | return false; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | public Vector<ProxyBean> getProxyBeans() { | ||
| 44 | return (Vector<ProxyBean>)db.select(); | ||
| 45 | } | ||
| 46 | |||
| 43 | 47 | ||
| 44 | public void Config(Vector<ProxyBean> pbs) { | 48 | public void Config(Vector<ProxyBean> pbs) { |
| 45 | try { | 49 | try { | ... | ... |
| 1 | package org.emercit.remoteservers.model; | 1 | package org.emercit.rserv.model; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | 4 | ||
| ... | @@ -6,7 +6,7 @@ package org.emercit.remoteservers.model; | ... | @@ -6,7 +6,7 @@ package org.emercit.remoteservers.model; |
| 6 | import java.io.Serializable; | 6 | import java.io.Serializable; |
| 7 | import java.util.Vector; | 7 | import java.util.Vector; |
| 8 | 8 | ||
| 9 | public class RemoteServerBean implements Serializable { | 9 | public class RServBean implements Serializable { |
| 10 | 10 | ||
| 11 | private static final long serialVersionUID = 1L; | 11 | private static final long serialVersionUID = 1L; |
| 12 | 12 | ||
| ... | @@ -23,7 +23,7 @@ private static final long serialVersionUID = 1L; | ... | @@ -23,7 +23,7 @@ private static final long serialVersionUID = 1L; |
| 23 | 23 | ||
| 24 | private String title; | 24 | private String title; |
| 25 | 25 | ||
| 26 | public RemoteServerBean() { | 26 | public RServBean() { |
| 27 | 27 | ||
| 28 | } | 28 | } |
| 29 | 29 | ... | ... |
| 1 | package org.emercit.remoteserver.service; | 1 | package org.emercit.rserv.service; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | import java.util.Vector; | 4 | import java.util.Vector; |
| 5 | 5 | ||
| 6 | import org.emercit.remoteservers.model.RemoteServerBean; | 6 | import org.emercit.rserv.model.RServBean; |
| 7 | 7 | ||
| 8 | public interface IRemSrv { | 8 | public interface IRemSrv { |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | public Vector<RemoteServerBean> get(); | 11 | public Vector<RServBean> get(); |
| 12 | 12 | ||
| 13 | public boolean set(Vector<RemoteServerBean> beans); | 13 | public boolean set(Vector<RServBean> beans); |
| 14 | 14 | ||
| 15 | public void init(); | 15 | public void init(); |
| 16 | 16 | ... | ... |
| 1 | package org.emercit.remoteserver.service; | 1 | package org.emercit.rserv.service; |
| 2 | 2 | ||
| 3 | import java.util.Vector; | 3 | import java.util.Vector; |
| 4 | import java.beans.XMLEncoder; | 4 | import java.beans.XMLEncoder; |
| ... | @@ -9,11 +9,9 @@ import java.io.FileOutputStream; | ... | @@ -9,11 +9,9 @@ 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.remoteserver.service.IRemSrv; | 12 | import org.emercit.rserv.model.RServBean; |
| 13 | import org.emercit.remoteservers.model.RemoteServerBean; | 13 | import org.emercit.rserv.service.IRemSrv; |
| 14 | |||
| 15 | import org.emercit.xmldbmanager.service.Db; | 14 | import org.emercit.xmldbmanager.service.Db; |
| 16 | |||
| 17 | import org.emercit.projecttools.constants.Paths; | 15 | import org.emercit.projecttools.constants.Paths; |
| 18 | 16 | ||
| 19 | public class RemSrv implements IRemSrv { | 17 | public class RemSrv implements IRemSrv { |
| ... | @@ -22,14 +20,14 @@ public class RemSrv implements IRemSrv { | ... | @@ -22,14 +20,14 @@ public class RemSrv implements IRemSrv { |
| 22 | 20 | ||
| 23 | private Db db=new Db(Paths.BEAN_REMOTESERVER); | 21 | private Db db=new Db(Paths.BEAN_REMOTESERVER); |
| 24 | 22 | ||
| 25 | public boolean set(Vector<RemoteServerBean> beans) { | 23 | public boolean set(Vector<RServBean> beans) { |
| 26 | 24 | ||
| 27 | return db.create(beans); | 25 | return db.create(beans); |
| 28 | } | 26 | } |
| 29 | 27 | ||
| 30 | public Vector<RemoteServerBean> get() { | 28 | public Vector<RServBean> get() { |
| 31 | 29 | ||
| 32 | return (Vector<RemoteServerBean>)db.select(); | 30 | return (Vector<RServBean>)db.select(); |
| 33 | 31 | ||
| 34 | } | 32 | } |
| 35 | 33 | ||
| ... | @@ -37,9 +35,9 @@ public class RemSrv implements IRemSrv { | ... | @@ -37,9 +35,9 @@ public class RemSrv implements IRemSrv { |
| 37 | 35 | ||
| 38 | public void init() { | 36 | public void init() { |
| 39 | 37 | ||
| 40 | Vector<RemoteServerBean> beans=new Vector<RemoteServerBean>(); | 38 | Vector<RServBean> beans=new Vector<RServBean>(); |
| 41 | 39 | ||
| 42 | RemoteServerBean rsb=new RemoteServerBean(); | 40 | RServBean rsb=new RServBean(); |
| 43 | 41 | ||
| 44 | rsb.setId(1); | 42 | rsb.setId(1); |
| 45 | rsb.setIp("127.0.0.1"); | 43 | rsb.setIp("127.0.0.1"); | ... | ... |
| ... | @@ -5,4 +5,4 @@ | ... | @@ -5,4 +5,4 @@ |
| 5 | * @author root | 5 | * @author root |
| 6 | * | 6 | * |
| 7 | */ | 7 | */ |
| 8 | package org.emercit.servicemanager.model; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 8 | package org.emercit.svmanager.model; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | package org.emercit.svmanager.service; | 1 | package org.emercit.svmanager.service; |
| 2 | 2 | ||
| 3 | import org.emercit.servicemanager.model.SvBean; | 3 | import org.emercit.svmanager.model.SvBean; |
| 4 | |||
| 4 | import java.util.Vector; | 5 | import java.util.Vector; |
| 5 | 6 | ||
| 6 | public interface ISv { | 7 | public interface ISv { |
| 7 | 8 | ||
| 8 | public boolean isRun(); | ||
| 9 | |||
| 10 | public void set(Vector<SvBean> m); | 9 | public void set(Vector<SvBean> m); |
| 11 | 10 | ||
| 12 | public Vector<SvBean> get(); | 11 | public Vector<SvBean> get(); | ... | ... |
| 1 | package org.emercit.svmanager.service; | ||
| 2 | |||
| 3 | import java.util.Vector; | ||
| 4 | |||
| 5 | import org.emercit.svmanager.model.SvBean; | ||
| 6 | import org.emercit.xmldbmanager.service.Db; | ||
| 7 | import org.emercit.projecttools.constants.Paths; | ||
| 8 | |||
| 9 | public class Sv { | ||
| 10 | |||
| 11 | public Db db=new Db(Paths.BEAN_SV); | ||
| 12 | |||
| 13 | public void set(Vector<SvBean> m) { | ||
| 14 | |||
| 15 | db.create(m); | ||
| 16 | } | ||
| 17 | |||
| 18 | public Vector<SvBean> get() { | ||
| 19 | |||
| 20 | return (Vector<SvBean>)db.select(); | ||
| 21 | } | ||
| 22 | |||
| 23 | } |
| 1 | package org.emercit.svmanager.service; | ||
| 2 | |||
| 3 | |||
| 4 | import org.emercit.pckutils.cmd.CmdExec; | ||
| 5 | |||
| 6 | public class SvControl implements ISvControl { | ||
| 7 | |||
| 8 | private CmdExec cmdexec=new CmdExec(); | ||
| 9 | |||
| 10 | private String process; | ||
| 11 | |||
| 12 | public SvControl(String value) { | ||
| 13 | |||
| 14 | this.process=value; | ||
| 15 | } | ||
| 16 | |||
| 17 | public boolean stop() { | ||
| 18 | |||
| 19 | try { cmdexec.Run(process+" "+"stop"); }catch(Exception e) { return false; }; | ||
| 20 | |||
| 21 | return true; | ||
| 22 | } | ||
| 23 | |||
| 24 | public boolean start() { | ||
| 25 | |||
| 26 | try { cmdexec.Run(process+" "+"start"); }catch(Exception e) { return false; }; | ||
| 27 | |||
| 28 | return true; | ||
| 29 | } | ||
| 30 | |||
| 31 | public boolean restart() { | ||
| 32 | |||
| 33 | try { cmdexec.Run(process+" "+"restart"); }catch(Exception e) { return false; }; | ||
| 34 | |||
| 35 | return true; | ||
| 36 | } | ||
| 37 | |||
| 38 | } |
| 1 | package org.emercit.utilstools; | 1 | package org.emercit.utilstools; |
| 2 | 2 | ||
| 3 | import org.emercit.utilstools.model.SettingsBean; | ||
| 4 | import org.emercit.utilstools.service.Settings; | ||
| 5 | |||
| 6 | |||
| 3 | public class App | 7 | public class App |
| 4 | { | 8 | { |
| 9 | |||
| 10 | |||
| 5 | public static void main( String[] args ) | 11 | public static void main( String[] args ) |
| 6 | { | 12 | { |
| 7 | System.out.println( "UtilsTools!" ); | 13 | System.out.println( "UtilsTools!" ); |
| 14 | |||
| 15 | Settings settings=new Settings(); | ||
| 16 | |||
| 17 | SettingsBean sb=settings.make(); | ||
| 18 | |||
| 19 | settings.set(sb); | ||
| 20 | |||
| 21 | |||
| 8 | } | 22 | } |
| 9 | } | 23 | } | ... | ... |
| 1 | package org.emercit.utilstools.model; | ||
| 2 | |||
| 3 | import java.util.Vector; | ||
| 4 | |||
| 5 | import org.emercit.devinfo.model.DevInfoBean; | ||
| 6 | import org.emercit.dnsmanager.model.DnsBean; | ||
| 7 | import org.emercit.dtmanager.model.DateInfo; | ||
| 8 | import org.emercit.gsmmanager.model.GSMBean; | ||
| 9 | import org.emercit.ethmanager.model.EthBean; | ||
| 10 | import org.emercit.proxymanager.model.ProxyBean; | ||
| 11 | import org.emercit.rserv.model.RServBean; | ||
| 12 | import org.emercit.svmanager.model.SvBean; | ||
| 13 | |||
| 14 | import java.io.Serializable; | ||
| 15 | |||
| 16 | |||
| 17 | public class SettingsBean implements Serializable { | ||
| 18 | |||
| 19 | private DevInfoBean devinfobean; | ||
| 20 | |||
| 21 | private Vector<DnsBean> dnsbeans; | ||
| 22 | |||
| 23 | private DateInfo dateinfobean; | ||
| 24 | |||
| 25 | private GSMBean gsmbean; | ||
| 26 | |||
| 27 | private Vector<EthBean> ethbeans; | ||
| 28 | |||
| 29 | private Vector<ProxyBean> proxybeans; | ||
| 30 | |||
| 31 | private Vector<RServBean> rserverbeans; | ||
| 32 | |||
| 33 | private Vector<SvBean> svbeans; | ||
| 34 | |||
| 35 | public SettingsBean() { | ||
| 36 | |||
| 37 | } | ||
| 38 | |||
| 39 | //Set | ||
| 40 | public void setDevInfoBean(DevInfoBean model){ | ||
| 41 | |||
| 42 | this.devinfobean=model; | ||
| 43 | } | ||
| 44 | |||
| 45 | public void setDnsbeans(Vector<DnsBean> models) { | ||
| 46 | |||
| 47 | this.dnsbeans=models; | ||
| 48 | } | ||
| 49 | |||
| 50 | public void setDateInfo(DateInfo model) { | ||
| 51 | |||
| 52 | this.dateinfobean=model; | ||
| 53 | } | ||
| 54 | |||
| 55 | public void setGSMBean(GSMBean model) { | ||
| 56 | |||
| 57 | this.gsmbean=model; | ||
| 58 | } | ||
| 59 | |||
| 60 | public void setEthBeans(Vector<EthBean> models) { | ||
| 61 | |||
| 62 | this.ethbeans=models; | ||
| 63 | } | ||
| 64 | |||
| 65 | public void setProxyBeans(Vector<ProxyBean> models) { | ||
| 66 | |||
| 67 | this.proxybeans=models; | ||
| 68 | } | ||
| 69 | |||
| 70 | public void setRserverbeans(Vector<RServBean> models) { | ||
| 71 | |||
| 72 | this.rserverbeans=models; | ||
| 73 | } | ||
| 74 | |||
| 75 | public void setSvbeans(Vector<SvBean> models) { | ||
| 76 | |||
| 77 | this.svbeans=models; | ||
| 78 | } | ||
| 79 | |||
| 80 | |||
| 81 | //Get | ||
| 82 | |||
| 83 | public DevInfoBean getDevInfoBean(){ | ||
| 84 | |||
| 85 | return devinfobean; | ||
| 86 | } | ||
| 87 | |||
| 88 | public Vector<DnsBean> getDnsbeans() { | ||
| 89 | |||
| 90 | return dnsbeans; | ||
| 91 | } | ||
| 92 | |||
| 93 | public DateInfo getDateInfo() { | ||
| 94 | |||
| 95 | return dateinfobean; | ||
| 96 | } | ||
| 97 | |||
| 98 | public GSMBean getGSMBean() { | ||
| 99 | |||
| 100 | return gsmbean; | ||
| 101 | } | ||
| 102 | |||
| 103 | public Vector<EthBean> getEthBeans() { | ||
| 104 | |||
| 105 | return ethbeans; | ||
| 106 | } | ||
| 107 | |||
| 108 | public Vector<ProxyBean> getProxyBeans() { | ||
| 109 | |||
| 110 | return proxybeans; | ||
| 111 | } | ||
| 112 | |||
| 113 | public Vector<RServBean> getRserverbeans() { | ||
| 114 | |||
| 115 | return rserverbeans; | ||
| 116 | } | ||
| 117 | |||
| 118 | public Vector<SvBean> getSvbeans() { | ||
| 119 | |||
| 120 | return svbeans; | ||
| 121 | } | ||
| 122 | |||
| 123 | |||
| 124 | |||
| 125 | } |
| 1 | package org.emercit.utilstools.service; | ||
| 2 | |||
| 3 | import java.util.Vector; | ||
| 4 | |||
| 5 | import org.emercit.utilstools.model.SettingsBean; | ||
| 6 | |||
| 7 | public interface ISettings { | ||
| 8 | |||
| 9 | public SettingsBean get(); | ||
| 10 | |||
| 11 | public boolean set(SettingsBean bean); | ||
| 12 | |||
| 13 | public boolean configuring(); | ||
| 14 | |||
| 15 | public SettingsBean make(); | ||
| 16 | |||
| 17 | } |
| 1 | package org.emercit.utilstools.service; | ||
| 2 | |||
| 3 | import java.util.Vector; | ||
| 4 | |||
| 5 | import org.emercit.utilstools.model.SettingsBean; | ||
| 6 | import org.emercit.xmldbmanager.service.Db; | ||
| 7 | import org.emercit.projecttools.constants.Paths; | ||
| 8 | |||
| 9 | import org.emercit.devinfo.model.DevInfoBean; | ||
| 10 | import org.emercit.dnsmanager.model.DnsBean; | ||
| 11 | import org.emercit.dtmanager.model.DateInfo; | ||
| 12 | import org.emercit.gsmmanager.model.GSMBean; | ||
| 13 | import org.emercit.ethmanager.model.EthBean; | ||
| 14 | import org.emercit.proxymanager.model.ProxyBean; | ||
| 15 | import org.emercit.rserv.model.RServBean; | ||
| 16 | import org.emercit.svmanager.model.SvBean; | ||
| 17 | |||
| 18 | import org.emercit.devinfo.service.DevInfo; | ||
| 19 | import org.emercit.dnsmanager.service.DnsLinux; | ||
| 20 | import org.emercit.dtmanager.service.NtpLinux; | ||
| 21 | import org.emercit.gsmmanager.service.Gsm; | ||
| 22 | import org.emercit.ethmanager.service.EthLinux; | ||
| 23 | import org.emercit.proxymanager.service.ProxyLinux; | ||
| 24 | import org.emercit.rserv.service.RemSrv; | ||
| 25 | import org.emercit.svmanager.service.Sv; | ||
| 26 | |||
| 27 | |||
| 28 | public class Settings implements ISettings { | ||
| 29 | |||
| 30 | |||
| 31 | private Db db=new Db(Paths.BEAN_SETTINGS); | ||
| 32 | |||
| 33 | |||
| 34 | private DevInfo devinfo=new DevInfo(); | ||
| 35 | |||
| 36 | private DnsLinux dnslinux=new DnsLinux(); | ||
| 37 | |||
| 38 | private NtpLinux ntplinux=new NtpLinux(); | ||
| 39 | |||
| 40 | private Gsm gsm=new Gsm(); | ||
| 41 | |||
| 42 | private EthLinux ethlinux=new EthLinux(); | ||
| 43 | |||
| 44 | private ProxyLinux proxylinux=new ProxyLinux(); | ||
| 45 | |||
| 46 | private RemSrv remserv=new RemSrv(); | ||
| 47 | |||
| 48 | private Sv sv=new Sv(); | ||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | private SettingsBean sb; | ||
| 53 | |||
| 54 | public SettingsBean get() { | ||
| 55 | |||
| 56 | return (SettingsBean)db.select(); | ||
| 57 | } | ||
| 58 | |||
| 59 | public boolean set(SettingsBean bean) { | ||
| 60 | |||
| 61 | return db.create(bean); | ||
| 62 | } | ||
| 63 | |||
| 64 | public boolean configuring() { | ||
| 65 | |||
| 66 | return true; | ||
| 67 | } | ||
| 68 | |||
| 69 | public SettingsBean make() { | ||
| 70 | |||
| 71 | sb=new SettingsBean(); | ||
| 72 | |||
| 73 | |||
| 74 | sb.setDevInfoBean(devinfo.get()); | ||
| 75 | sb.setDnsbeans(dnslinux.getAllDns()); | ||
| 76 | |||
| 77 | |||
| 78 | DateInfo dateInfo=new DateInfo(); | ||
| 79 | dateInfo.setDt(""); | ||
| 80 | dateInfo.setNtp(ntplinux.getUseNtpServer()); | ||
| 81 | |||
| 82 | sb.setDateInfo(dateInfo); | ||
| 83 | |||
| 84 | sb.setGSMBean(gsm.get()); | ||
| 85 | sb.setEthBeans(ethlinux.getEthBeans()); | ||
| 86 | sb.setProxyBeans(proxylinux.getProxyBeans()); | ||
| 87 | sb.setRserverbeans(remserv.get()); | ||
| 88 | |||
| 89 | return sb; | ||
| 90 | } | ||
| 91 | |||
| 92 | |||
| 93 | } |
| ... | @@ -10,11 +10,7 @@ import junit.framework.TestSuite; | ... | @@ -10,11 +10,7 @@ import junit.framework.TestSuite; |
| 10 | public class AppTest | 10 | public class AppTest |
| 11 | extends TestCase | 11 | extends TestCase |
| 12 | { | 12 | { |
| 13 | /** | 13 | |
| 14 | * Create the test case | ||
| 15 | * | ||
| 16 | * @param testName name of the test case | ||
| 17 | */ | ||
| 18 | public AppTest( String testName ) | 14 | public AppTest( String testName ) |
| 19 | { | 15 | { |
| 20 | super( testName ); | 16 | super( testName ); | ... | ... |
XmlDbManager/.classpath
deleted
100644 → 0
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <classpath> | ||
| 3 | <classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
| 4 | <attributes> | ||
| 5 | <attribute name="optional" value="true"/> | ||
| 6 | <attribute name="maven.pomderived" value="true"/> | ||
| 7 | </attributes> | ||
| 8 | </classpathentry> | ||
| 9 | <classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
| 10 | <attributes> | ||
| 11 | <attribute name="optional" value="true"/> | ||
| 12 | <attribute name="maven.pomderived" value="true"/> | ||
| 13 | </attributes> | ||
| 14 | </classpathentry> | ||
| 15 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> | ||
| 16 | <attributes> | ||
| 17 | <attribute name="maven.pomderived" value="true"/> | ||
| 18 | </attributes> | ||
| 19 | </classpathentry> | ||
| 20 | <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
| 21 | <attributes> | ||
| 22 | <attribute name="maven.pomderived" value="true"/> | ||
| 23 | </attributes> | ||
| 24 | </classpathentry> | ||
| 25 | <classpathentry kind="output" path="target/classes"/> | ||
| 26 | </classpath> |
XmlDbManager/.gitignore
deleted
100644 → 0
| 1 | /target |
XmlDbManager/.project
deleted
100644 → 0
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <projectDescription> | ||
| 3 | <name>XmlDbManager</name> | ||
| 4 | <comment></comment> | ||
| 5 | <projects> | ||
| 6 | </projects> | ||
| 7 | <buildSpec> | ||
| 8 | <buildCommand> | ||
| 9 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
| 10 | <arguments> | ||
| 11 | </arguments> | ||
| 12 | </buildCommand> | ||
| 13 | <buildCommand> | ||
| 14 | <name>org.eclipse.m2e.core.maven2Builder</name> | ||
| 15 | <arguments> | ||
| 16 | </arguments> | ||
| 17 | </buildCommand> | ||
| 18 | </buildSpec> | ||
| 19 | <natures> | ||
| 20 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
| 21 | <nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
| 22 | </natures> | ||
| 23 | </projectDescription> |
XmlDbManager/pom.xml
deleted
100644 → 0
| 1 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 2 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 3 | <modelVersion>4.0.0</modelVersion> | ||
| 4 | |||
| 5 | <groupId>org.emercit</groupId> | ||
| 6 | <artifactId>XmlDbManager</artifactId> | ||
| 7 | <version>0.0.1-SNAPSHOT</version> | ||
| 8 | <packaging>jar</packaging> | ||
| 9 | |||
| 10 | <name>XmlDbManager</name> | ||
| 11 | <url>http://maven.apache.org</url> | ||
| 12 | |||
| 13 | <properties> | ||
| 14 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| 15 | </properties> | ||
| 16 | |||
| 17 | |||
| 18 | <build> | ||
| 19 | <plugins> | ||
| 20 | <plugin> | ||
| 21 | <groupId>org.apache.maven.plugins</groupId> | ||
| 22 | <artifactId>maven-compiler-plugin</artifactId> | ||
| 23 | <configuration> | ||
| 24 | <source>1.7</source> | ||
| 25 | <target>1.7</target> | ||
| 26 | <showDeprecation>true</showDeprecation> | ||
| 27 | <showWarnings>true</showWarnings> | ||
| 28 | <executable>${env.JAVA_HOME_7}/bin/javac</executable> | ||
| 29 | <fork>true</fork> | ||
| 30 | </configuration> | ||
| 31 | </plugin> | ||
| 32 | </plugins> | ||
| 33 | </build> | ||
| 34 | |||
| 35 | |||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | <dependencies> | ||
| 41 | <dependency> | ||
| 42 | <groupId>junit</groupId> | ||
| 43 | <artifactId>junit</artifactId> | ||
| 44 | <version>3.8.1</version> | ||
| 45 | <scope>test</scope> | ||
| 46 | </dependency> | ||
| 47 | |||
| 48 | <dependency> | ||
| 49 | <groupId>org.emercit</groupId> | ||
| 50 | <artifactId>projecttools</artifactId> | ||
| 51 | <version>1.5</version> | ||
| 52 | </dependency> | ||
| 53 | |||
| 54 | </dependencies> | ||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | <repositories> | ||
| 60 | <!--other repositories if any--> | ||
| 61 | <repository> | ||
| 62 | <id>project.local</id> | ||
| 63 | <name>project</name> | ||
| 64 | <url>file:/root/git/hardwareconfig/DevTools/repo</url> | ||
| 65 | </repository> | ||
| 66 | </repositories> | ||
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | |||
| 71 | |||
| 72 | |||
| 73 | |||
| 74 | |||
| 75 | </project> |
| 1 | package org.emercit.XmlDbManager; | ||
| 2 | |||
| 3 | import junit.framework.Test; | ||
| 4 | import junit.framework.TestCase; | ||
| 5 | import junit.framework.TestSuite; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * Unit test for simple App. | ||
| 9 | */ | ||
| 10 | public class AppTest | ||
| 11 | extends TestCase | ||
| 12 | { | ||
| 13 | /** | ||
| 14 | * Create the test case | ||
| 15 | * | ||
| 16 | * @param testName name of the test case | ||
| 17 | */ | ||
| 18 | public AppTest( String testName ) | ||
| 19 | { | ||
| 20 | super( testName ); | ||
| 21 | } | ||
| 22 | |||
| 23 | /** | ||
| 24 | * @return the suite of tests being tested | ||
| 25 | */ | ||
| 26 | public static Test suite() | ||
| 27 | { | ||
| 28 | return new TestSuite( AppTest.class ); | ||
| 29 | } | ||
| 30 | |||
| 31 | /** | ||
| 32 | * Rigourous Test :-) | ||
| 33 | */ | ||
| 34 | public void testApp() | ||
| 35 | { | ||
| 36 | assertTrue( true ); | ||
| 37 | } | ||
| 38 | } |
-
Please register or sign in to post a comment