save
Showing
17 changed files
with
204 additions
and
78 deletions
| ... | @@ -12,8 +12,6 @@ import org.emercit.xmldbmanager.service.Db; | ... | @@ -12,8 +12,6 @@ import org.emercit.xmldbmanager.service.Db; |
| 12 | import org.emercit.projecttools.constants.Paths; | 12 | import org.emercit.projecttools.constants.Paths; |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | |||
| 16 | |||
| 17 | public enum ProxyService { | 15 | public enum ProxyService { |
| 18 | 16 | ||
| 19 | INSTANCE; | 17 | INSTANCE; |
| ... | @@ -21,8 +19,6 @@ public enum ProxyService { | ... | @@ -21,8 +19,6 @@ public enum ProxyService { |
| 21 | private ProxyLinux proxy=new ProxyLinux(); | 19 | private ProxyLinux proxy=new ProxyLinux(); |
| 22 | private Db db=new Db(Paths.BEAN_PROXY); | 20 | private Db db=new Db(Paths.BEAN_PROXY); |
| 23 | 21 | ||
| 24 | |||
| 25 | |||
| 26 | private Vector<String> vStr; | 22 | private Vector<String> vStr; |
| 27 | private Vector<ProxyBean> vPb; | 23 | private Vector<ProxyBean> vPb; |
| 28 | 24 | ||
| ... | @@ -31,8 +27,6 @@ public enum ProxyService { | ... | @@ -31,8 +27,6 @@ public enum ProxyService { |
| 31 | 27 | ||
| 32 | } | 28 | } |
| 33 | 29 | ||
| 34 | |||
| 35 | |||
| 36 | public boolean Upd(Vector<ProxyBean> beans) { | 30 | public boolean Upd(Vector<ProxyBean> beans) { |
| 37 | 31 | ||
| 38 | // proxy.Config(beans); | 32 | // proxy.Config(beans); | ... | ... |
| ... | @@ -12,6 +12,7 @@ import org.emercit.devinfo.model.DevInfoBean; | ... | @@ -12,6 +12,7 @@ import org.emercit.devinfo.model.DevInfoBean; |
| 12 | 12 | ||
| 13 | import org.emercit.xmldbmanager.service.Db; | 13 | import org.emercit.xmldbmanager.service.Db; |
| 14 | import org.emercit.projecttools.constants.Paths; | 14 | import org.emercit.projecttools.constants.Paths; |
| 15 | import org.emercit.projecttools.constants.Msg; | ||
| 15 | 16 | ||
| 16 | public class DevInfo implements IDevInfo { | 17 | public class DevInfo implements IDevInfo { |
| 17 | 18 | ||
| ... | @@ -21,22 +22,24 @@ public class DevInfo implements IDevInfo { | ... | @@ -21,22 +22,24 @@ public class DevInfo implements IDevInfo { |
| 21 | 22 | ||
| 22 | private DevInfoBean devinfobean; | 23 | private DevInfoBean devinfobean; |
| 23 | 24 | ||
| 24 | public boolean set(DevInfoBean m) { | 25 | public Msg set(DevInfoBean m) { |
| 25 | return db.create(m); | 26 | return db.create(m); |
| 26 | } | 27 | } |
| 27 | 28 | ||
| 29 | |||
| 28 | public DevInfoBean get() { | 30 | public DevInfoBean get() { |
| 29 | return (DevInfoBean)db.select(); | 31 | return (DevInfoBean)db.select(); |
| 30 | } | 32 | } |
| 31 | 33 | ||
| 32 | 34 | ||
| 33 | public void init() { | 35 | public Msg init() { |
| 34 | 36 | ||
| 35 | devinfobean=new DevInfoBean(); | 37 | devinfobean=new DevInfoBean(); |
| 36 | devinfobean.setDescription("Описание устройства"); | 38 | devinfobean.setDescription("Описание устройства"); |
| 37 | devinfobean.setGuid("00000000-0000-0000-0000-000000000000"); | 39 | devinfobean.setGuid("00000000-0000-0000-0000-000000000000"); |
| 38 | 40 | ||
| 39 | set(devinfobean); | 41 | return set(devinfobean); |
| 42 | |||
| 40 | } | 43 | } |
| 41 | 44 | ||
| 42 | } | 45 | } | ... | ... |
| ... | @@ -7,14 +7,16 @@ import java.io.BufferedOutputStream; | ... | @@ -7,14 +7,16 @@ 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; | ||
| 11 | |||
| 10 | import org.emercit.devinfo.model.DevInfoBean; | 12 | import org.emercit.devinfo.model.DevInfoBean; |
| 11 | 13 | ||
| 12 | public interface IDevInfo { | 14 | public interface IDevInfo { |
| 13 | 15 | ||
| 14 | public boolean set(DevInfoBean m); | 16 | public Msg set(DevInfoBean m); |
| 15 | 17 | ||
| 16 | public DevInfoBean get(); | 18 | public DevInfoBean get(); |
| 17 | 19 | ||
| 18 | public void init(); | 20 | public Msg init(); |
| 19 | 21 | ||
| 20 | } | 22 | } | ... | ... |
| 1 | package org.emercit.displaycalibrator.service; | 1 | package org.emercit.displaycalibrator.service; |
| 2 | 2 | ||
| 3 | import org.emercit.projecttools.constants.Msg; | ||
| 4 | |||
| 3 | public interface DCalibrator { | 5 | public interface DCalibrator { |
| 4 | 6 | ||
| 5 | 7 | ||
| 6 | public void Run(String cmd); | 8 | public Msg Run(String cmd); |
| 7 | 9 | ||
| 8 | } | 10 | } | ... | ... |
| ... | @@ -7,16 +7,21 @@ import java.io.FileWriter; | ... | @@ -7,16 +7,21 @@ import java.io.FileWriter; |
| 7 | import java.io.InputStreamReader; | 7 | import java.io.InputStreamReader; |
| 8 | import java.util.Vector; | 8 | import java.util.Vector; |
| 9 | 9 | ||
| 10 | import org.apache.log4j.Logger; | ||
| 11 | import org.emercit.devinfo.service.DevInfo; | ||
| 10 | import org.emercit.pckutils.cmd.CmdExec; | 12 | import org.emercit.pckutils.cmd.CmdExec; |
| 13 | import org.emercit.projecttools.constants.Msg; | ||
| 11 | 14 | ||
| 12 | 15 | ||
| 13 | public class DCalibratorBB implements DCalibrator { | 16 | public class DCalibratorBB implements DCalibrator { |
| 14 | 17 | ||
| 18 | private static final Logger log = Logger.getLogger(DCalibratorBB.class); | ||
| 19 | |||
| 15 | private CmdExec cmdExec=new CmdExec(); | 20 | private CmdExec cmdExec=new CmdExec(); |
| 16 | 21 | ||
| 17 | //Run("/home/debian/start-xinput-config.sh"); | 22 | //Run("/home/debian/start-xinput-config.sh"); |
| 18 | 23 | ||
| 19 | public void Run(String cmd) { | 24 | public Msg Run(String cmd) { |
| 20 | try { | 25 | try { |
| 21 | Vector<String> params=cmdExec.Run(cmd); | 26 | Vector<String> params=cmdExec.Run(cmd); |
| 22 | 27 | ||
| ... | @@ -39,8 +44,12 @@ public class DCalibratorBB implements DCalibrator { | ... | @@ -39,8 +44,12 @@ public class DCalibratorBB implements DCalibrator { |
| 39 | } | 44 | } |
| 40 | 45 | ||
| 41 | bw.close(); | 46 | bw.close(); |
| 42 | }catch(Exception e) { | 47 | log.info(Msg.CalibrSucc); |
| 48 | return Msg.CalibrSucc; | ||
| 43 | 49 | ||
| 50 | }catch(Exception e) { | ||
| 51 | log.error(Msg.CalibrError); | ||
| 52 | return Msg.CalibrError; | ||
| 44 | } | 53 | } |
| 45 | } | 54 | } |
| 46 | 55 | ... | ... |
| 1 | package org.emercit.ethmanager.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 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -11,19 +11,16 @@ import java.io.FileWriter; | ... | @@ -11,19 +11,16 @@ import java.io.FileWriter; |
| 11 | import java.io.BufferedWriter; | 11 | import java.io.BufferedWriter; |
| 12 | import java.io.IOException; | 12 | import java.io.IOException; |
| 13 | 13 | ||
| 14 | import org.emercit.ethmanager.model.CommandExecutor; | ||
| 15 | |||
| 16 | import org.emercit.xmldbmanager.service.Db; | 14 | import org.emercit.xmldbmanager.service.Db; |
| 17 | |||
| 18 | import org.emercit.projecttools.constants.Paths; | 15 | import org.emercit.projecttools.constants.Paths; |
| 19 | 16 | ||
| 17 | import org.emercit.pckutils.cmd.CmdExec; | ||
| 20 | 18 | ||
| 21 | public class EthLinux implements IEth { | 19 | public class EthLinux implements IEth { |
| 22 | 20 | ||
| 23 | private static final Logger log = Logger.getLogger(EthLinux.class); | 21 | private static final Logger log = Logger.getLogger(EthLinux.class); |
| 24 | 22 | ||
| 25 | private CommandExecutor ce=new CommandExecutor(); | 23 | private CmdExec cmdexec=new CmdExec(); |
| 26 | |||
| 27 | 24 | ||
| 28 | 25 | ||
| 29 | private Vector<EthBean> ebs=new Vector<EthBean>(); | 26 | private Vector<EthBean> ebs=new Vector<EthBean>(); |
| ... | @@ -54,7 +51,7 @@ public class EthLinux implements IEth { | ... | @@ -54,7 +51,7 @@ public class EthLinux implements IEth { |
| 54 | Vector<String> result=new Vector<String>(); | 51 | Vector<String> result=new Vector<String>(); |
| 55 | 52 | ||
| 56 | try { | 53 | try { |
| 57 | Vector<String> buff=ce.Run("ifconfig | grep eth | awk '{print $1}'"); | 54 | Vector<String> buff=cmdexec.Run("ifconfig | grep eth | awk '{print $1}'"); |
| 58 | 55 | ||
| 59 | ebs=(Vector<EthBean>)db.select(); | 56 | ebs=(Vector<EthBean>)db.select(); |
| 60 | 57 | ||
| ... | @@ -90,18 +87,18 @@ public class EthLinux implements IEth { | ... | @@ -90,18 +87,18 @@ public class EthLinux implements IEth { |
| 90 | if(eb.getName().equals(name)) { | 87 | if(eb.getName().equals(name)) { |
| 91 | 88 | ||
| 92 | try { | 89 | try { |
| 93 | extinfo=ce.Run("ifconfig"+" "+eb.getName()); | 90 | extinfo=cmdexec.Run("ifconfig"+" "+eb.getName()); |
| 94 | 91 | ||
| 95 | mac=ce.Run("ifconfig"+" "+eb.getName()+" | grep HWaddr | awk '{ print $5}' ").firstElement(); | 92 | mac=cmdexec.Run("ifconfig"+" "+eb.getName()+" | grep HWaddr | awk '{ print $5}' ").firstElement(); |
| 96 | 93 | ||
| 97 | eb.setInfo(extinfo); | 94 | eb.setInfo(extinfo); |
| 98 | eb.setMac(mac); | 95 | eb.setMac(mac); |
| 99 | 96 | ||
| 100 | if (eb.getDhcp()) { | 97 | if (eb.getDhcp()) { |
| 101 | 98 | ||
| 102 | String addr=ce.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'").firstElement(); | 99 | String addr=cmdexec.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'").firstElement(); |
| 103 | String mask=ce.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f4 | awk '{ print $1}'").firstElement(); | 100 | String mask=cmdexec.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f4 | awk '{ print $1}'").firstElement(); |
| 104 | String gateway=ce.Run("/sbin/route -n | grep 'UG' | awk '{print $2}'").firstElement(); | 101 | String gateway=cmdexec.Run("/sbin/route -n | grep 'UG' | awk '{print $2}'").firstElement(); |
| 105 | 102 | ||
| 106 | eb.setIp(addr); | 103 | eb.setIp(addr); |
| 107 | eb.setNetmask(mask); | 104 | eb.setNetmask(mask); | ... | ... |
| 1 | package org.emercit.projecttools.constants; | ||
| 2 | |||
| 3 | import java.util.Vector; | ||
| 4 | |||
| 5 | public class DefSettings { | ||
| 6 | |||
| 7 | //DevInfo | ||
| 8 | public static final String DevInfo_Guid="00000000-0000-0000-0000-000000000000"; | ||
| 9 | public static final String DevInfo_Description="Описание устройства"; | ||
| 10 | //Dns | ||
| 11 | public static final String Dns_host="8.8.8.8"; | ||
| 12 | //Ntp | ||
| 13 | public static final String Ntp_host="127.0.0.1"; | ||
| 14 | //Eth0 | ||
| 15 | public static final int Eth0_id=0; | ||
| 16 | public static final String Eth0_name="eth0"; | ||
| 17 | public static final String Eth0_mac=""; | ||
| 18 | public static final boolean Eth0_dhcp=false; | ||
| 19 | public static final String Eth0_ip="192.168.99.1"; | ||
| 20 | public static final String Eth0_netmask="255.255.255.0"; | ||
| 21 | public static final String Eth0_gateway="192.168.99.2"; | ||
| 22 | public static final String Eth0_broadcast=""; | ||
| 23 | public static final String Eth0_extinfo=""; | ||
| 24 | //Eth1 | ||
| 25 | public static final int Eth1_id=1; | ||
| 26 | public static final String Eth1_name="eth1"; | ||
| 27 | public static final String Eth1_mac=""; | ||
| 28 | public static final boolean Eth1_dhcp=true; | ||
| 29 | public static final String Eth1_ip=""; | ||
| 30 | public static final String Eth1_netmask=""; | ||
| 31 | public static final String Eth1_gateway=""; | ||
| 32 | public static final String Eth1_broadcast=""; | ||
| 33 | public static final String Eth1_extinfo=""; | ||
| 34 | //GSM | ||
| 35 | public static final String gsm_operator="megafon"; | ||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | } |
| 1 | package org.emercit.projecttools.constants; | ||
| 2 | |||
| 3 | import org.emercit.projecttools.constants.TypeMsg; | ||
| 4 | |||
| 5 | public enum Msg { | ||
| 6 | |||
| 7 | SaveFileSucc(1,TypeMsg.INFO,"Выполнено сохранение файла"), | ||
| 8 | SaveFileError(2,TypeMsg.ERROR,"Сохранение файла не выполнено"), | ||
| 9 | |||
| 10 | LoadFileSucc(3,TypeMsg.INFO,"Чтение файла выполнено"), | ||
| 11 | LoadFileError(4,TypeMsg.ERROR,"Ошибка чтения файла"), | ||
| 12 | |||
| 13 | UpdSuccess(5,TypeMsg.INFO,"Конфигурация выполнена успешно"), | ||
| 14 | UpdError(6,TypeMsg.ERROR,"Ошибка при конфигурации"), | ||
| 15 | |||
| 16 | CalibrSucc(7,TypeMsg.INFO,"Выполнена калибровка экрана"), | ||
| 17 | CalibrError(8,TypeMsg.ERROR,"Калибровка экрана не выполнена"), | ||
| 18 | |||
| 19 | |||
| 20 | InitSucc(9,TypeMsg.INFO,"Выполнена инициализация"), | ||
| 21 | InitError(10,TypeMsg.ERROR,"Инициализация не выполнена"); | ||
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | private int code; | ||
| 26 | |||
| 27 | private TypeMsg type; | ||
| 28 | |||
| 29 | private String description; | ||
| 30 | |||
| 31 | private Msg(int code, TypeMsg type, String description ) { | ||
| 32 | this.code = code; | ||
| 33 | this.type = type; | ||
| 34 | this.description=description; | ||
| 35 | } | ||
| 36 | |||
| 37 | static public Msg getCode(int code) { | ||
| 38 | for (Msg v: Msg.values()) { | ||
| 39 | if (v.getCode()==code) { | ||
| 40 | return v; | ||
| 41 | } | ||
| 42 | } | ||
| 43 | return null; | ||
| 44 | } | ||
| 45 | |||
| 46 | public int getCode() { | ||
| 47 | return this.code; | ||
| 48 | } | ||
| 49 | |||
| 50 | public TypeMsg getTypeVariable() { | ||
| 51 | return this.type; | ||
| 52 | } | ||
| 53 | public TypeMsg getDescription() { | ||
| 54 | return this.type; | ||
| 55 | } | ||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | |||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | /* | ||
| 64 | public static final String msgUpdSucc="Выполнено обновление"; | ||
| 65 | public static final String msgUpdErr="Обновление не выполнено"; | ||
| 66 | |||
| 67 | public static final String mdgCalibratorSucc="Выполнена калибровка экрана"; | ||
| 68 | public static final String msgCalibratorError="Калибровка экрана не выполнена"; | ||
| 69 | */ | ||
| 70 | |||
| 71 | |||
| 72 | |||
| 73 | } |
| 1 | package org.emercit.projecttools.constants; | ||
| 2 | |||
| 3 | |||
| 4 | public enum TypeMsg implements TypeVariable { | ||
| 5 | |||
| 6 | INFO(1,"Уведомление"), | ||
| 7 | ERROR(2,"Ошибка"); | ||
| 8 | |||
| 9 | private int code; | ||
| 10 | |||
| 11 | private String description; | ||
| 12 | |||
| 13 | |||
| 14 | private TypeMsg(int code, String description) { | ||
| 15 | this.code=code; | ||
| 16 | this.description=description; | ||
| 17 | } | ||
| 18 | |||
| 19 | static public TypeMsg getByCode(int code) { | ||
| 20 | for (TypeMsg v: TypeMsg.values()) { | ||
| 21 | if (v.getCode()==code) { | ||
| 22 | return v; | ||
| 23 | } | ||
| 24 | } | ||
| 25 | throw new RuntimeException("Неизвестный тип"); | ||
| 26 | } | ||
| 27 | |||
| 28 | public int getCode() { | ||
| 29 | return this.code; | ||
| 30 | } | ||
| 31 | |||
| 32 | public String getDescription(){ | ||
| 33 | return this.description; | ||
| 34 | } | ||
| 35 | |||
| 36 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -4,11 +4,13 @@ import java.util.Vector; | ... | @@ -4,11 +4,13 @@ import java.util.Vector; |
| 4 | 4 | ||
| 5 | import org.emercit.utilstools.model.SettingsBean; | 5 | import org.emercit.utilstools.model.SettingsBean; |
| 6 | 6 | ||
| 7 | import org.emercit.projecttools.constants.Msg; | ||
| 8 | |||
| 7 | public interface ISettings { | 9 | public interface ISettings { |
| 8 | 10 | ||
| 9 | //public SettingsBean get(); | 11 | //public SettingsBean get(); |
| 10 | 12 | ||
| 11 | public boolean set(SettingsBean bean); | 13 | public Msg set(SettingsBean bean); |
| 12 | 14 | ||
| 13 | public boolean configuring(SettingsBean model); | 15 | public boolean configuring(SettingsBean model); |
| 14 | 16 | ... | ... |
| ... | @@ -20,6 +20,7 @@ import org.emercit.proxymanager.service.ProxyLinux; | ... | @@ -20,6 +20,7 @@ import org.emercit.proxymanager.service.ProxyLinux; |
| 20 | import org.emercit.servers.service.Servers; | 20 | import org.emercit.servers.service.Servers; |
| 21 | import org.emercit.svmanager.service.Sv; | 21 | import org.emercit.svmanager.service.Sv; |
| 22 | 22 | ||
| 23 | import org.emercit.projecttools.constants.Msg; | ||
| 23 | 24 | ||
| 24 | public class Settings implements ISettings { | 25 | public class Settings implements ISettings { |
| 25 | 26 | ||
| ... | @@ -53,7 +54,7 @@ public class Settings implements ISettings { | ... | @@ -53,7 +54,7 @@ public class Settings implements ISettings { |
| 53 | } | 54 | } |
| 54 | */ | 55 | */ |
| 55 | 56 | ||
| 56 | public boolean set(SettingsBean bean) { | 57 | public Msg set(SettingsBean bean) { |
| 57 | 58 | ||
| 58 | return db.create(bean); | 59 | return db.create(bean); |
| 59 | } | 60 | } | ... | ... |
| ... | @@ -7,11 +7,14 @@ import java.io.BufferedOutputStream; | ... | @@ -7,11 +7,14 @@ 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.apache.log4j.Logger; | ||
| 11 | import org.emercit.devinfo.service.DevInfo; | ||
| 10 | import org.emercit.projecttools.constants.Paths; | 12 | import org.emercit.projecttools.constants.Paths; |
| 13 | import org.emercit.projecttools.constants.Msg; | ||
| 11 | 14 | ||
| 12 | public class Db implements IDb { | 15 | public class Db implements IDb { |
| 13 | 16 | ||
| 14 | 17 | private static final Logger log = Logger.getLogger(Db.class); | |
| 15 | 18 | ||
| 16 | private String pathfile=null; | 19 | private String pathfile=null; |
| 17 | 20 | ||
| ... | @@ -23,7 +26,7 @@ public class Db implements IDb { | ... | @@ -23,7 +26,7 @@ public class Db implements IDb { |
| 23 | * Создает или перезаписывает сущетсвующий файл | 26 | * Создает или перезаписывает сущетсвующий файл |
| 24 | * @see org.emercit.xmldbmanager.service.IDb#create(java.lang.Object) | 27 | * @see org.emercit.xmldbmanager.service.IDb#create(java.lang.Object) |
| 25 | */ | 28 | */ |
| 26 | public boolean create(Object o) { | 29 | public Msg create(Object o) { |
| 27 | 30 | ||
| 28 | boolean result=true; | 31 | boolean result=true; |
| 29 | try { | 32 | try { |
| ... | @@ -33,9 +36,9 @@ public class Db implements IDb { | ... | @@ -33,9 +36,9 @@ public class Db implements IDb { |
| 33 | xmlEncoder.writeObject(o); | 36 | xmlEncoder.writeObject(o); |
| 34 | xmlEncoder.close(); | 37 | xmlEncoder.close(); |
| 35 | }catch(Exception e) { | 38 | }catch(Exception e) { |
| 36 | result=false; | 39 | return Msg.SaveFileError; |
| 37 | } | 40 | } |
| 38 | return result; | 41 | return Msg.SaveFileSucc; |
| 39 | 42 | ||
| 40 | } | 43 | } |
| 41 | 44 | ||
| ... | @@ -50,14 +53,12 @@ public class Db implements IDb { | ... | @@ -50,14 +53,12 @@ public class Db implements IDb { |
| 50 | new FileInputStream(pathfile))); | 53 | new FileInputStream(pathfile))); |
| 51 | Object result=(Object)d.readObject(); | 54 | Object result=(Object)d.readObject(); |
| 52 | d.close(); | 55 | d.close(); |
| 53 | 56 | log.error(Msg.LoadFileSucc); | |
| 54 | return result; | 57 | return result; |
| 55 | }catch(Exception e) { | 58 | }catch(Exception e) { |
| 56 | 59 | log.error(Msg.LoadFileError); | |
| 57 | return null; | 60 | return null; |
| 58 | } | 61 | } |
| 59 | |||
| 60 | |||
| 61 | } | 62 | } |
| 62 | 63 | ||
| 63 | 64 | ... | ... |
| 1 | package org.emercit.xmldbmanager.service; | 1 | package org.emercit.xmldbmanager.service; |
| 2 | 2 | ||
| 3 | import org.emercit.projecttools.constants.Msg; | ||
| 4 | |||
| 3 | public interface IDb { | 5 | public interface IDb { |
| 4 | 6 | ||
| 5 | public boolean create(Object obj); | 7 | public Msg create(Object obj); |
| 6 | 8 | ||
| 7 | public Object select(); | 9 | public Object select(); |
| 8 | 10 | ... | ... |
-
Please register or sign in to post a comment