Commit c91f620a c91f620a165f7f048ad1d1a1cfb281d284b91e76 by root

save

1 parent 5413c059
1 eb96f0d7c6eb16bba3a80585ade26f46
...\ No newline at end of file ...\ No newline at end of file
1 fcf9ad831694a6eb9ccec60ad06c6d4b2996fc9e
...\ 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>pckutils</artifactId>
7 <version>1.5</version>
8 </project>
1 9261a56b4a8d86ad7e6991a8f9a2822a
...\ No newline at end of file ...\ No newline at end of file
1 805dff1560e8a224309fea2b92ac167d61a87d54
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="UTF-8"?>
2 <metadata>
3 <groupId>org.emercit</groupId>
4 <artifactId>pckutils</artifactId>
5 <versioning>
6 <release>1.5</release>
7 <versions>
8 <version>1.5</version>
9 </versions>
10 <lastUpdated>20150727180908</lastUpdated>
11 </versioning>
12 </metadata>
1 08d8c6f6e4526506253777d406715c4d
...\ No newline at end of file ...\ No newline at end of file
1 074ac5995190869a9ce6821c47809f2aba60d959
...\ No newline at end of file ...\ No newline at end of file
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
12 <attribute name="maven.pomderived" value="true"/> 12 <attribute name="maven.pomderived" value="true"/>
13 </attributes> 13 </attributes>
14 </classpathentry> 14 </classpathentry>
15 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"> 15 <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
16 <attributes> 16 <attributes>
17 <attribute name="maven.pomderived" value="true"/> 17 <attribute name="maven.pomderived" value="true"/>
18 </attributes> 18 </attributes>
19 </classpathentry> 19 </classpathentry>
20 <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> 20 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
21 <attributes> 21 <attributes>
22 <attribute name="maven.pomderived" value="true"/> 22 <attribute name="maven.pomderived" value="true"/>
23 </attributes> 23 </attributes>
......
1 eclipse.preferences.version=1 1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 2 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
3 org.eclipse.jdt.core.compiler.compliance=1.5 3 org.eclipse.jdt.core.compiler.compliance=1.7
4 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 4 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 org.eclipse.jdt.core.compiler.source=1.5 5 org.eclipse.jdt.core.compiler.source=1.7
......
...@@ -13,6 +13,24 @@ ...@@ -13,6 +13,24 @@
13 <properties> 13 <properties>
14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15 </properties> 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>
16 34
17 <dependencies> 35 <dependencies>
18 <dependency> 36 <dependency>
...@@ -21,5 +39,25 @@ ...@@ -21,5 +39,25 @@
21 <version>3.8.1</version> 39 <version>3.8.1</version>
22 <scope>test</scope> 40 <scope>test</scope>
23 </dependency> 41 </dependency>
42
43 <dependency>
44 <groupId>org.emercit</groupId>
45 <artifactId>pckutils</artifactId>
46 <version>1.5</version>
47 </dependency>
48
24 </dependencies> 49 </dependencies>
50
51
52 <repositories>
53 <!--other repositories if any-->
54 <repository>
55 <id>project.local</id>
56 <name>project</name>
57 <url>file:/root/git/hardwareconfig/DevTools/repo</url>
58 </repository>
59 </repositories>
60
61
62
25 </project> 63 </project>
......
...@@ -7,24 +7,22 @@ import java.io.FileWriter; ...@@ -7,24 +7,22 @@ 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.emercit.pckutils.cmd.CmdExec;
11
10 12
11 public class DCalibratorBB implements DCalibrator { 13 public class DCalibratorBB implements DCalibrator {
12 14
13 15 private CmdExec cmdExec=new CmdExec();
14
15
16 16
17 public void Run(String cmd) { 17 public void Run(String cmd) {
18 try { 18 try {
19 Vector<String> params=ExcecCmd(cmd); 19 Vector<String> params=cmdExec.Run(cmd);
20 20
21 21 File file = new File("/etc/X11/xorg.conf.d/99-calibration.conf");
22
23 File file = new File("/etc/X11/xorg.conf.d/99-calibration.conf");
24 22
25 if (!file.exists()) { 23 if (!file.exists()) {
26 file.createNewFile(); 24 file.createNewFile();
27 } 25 }
28 26
29 FileWriter fw = new FileWriter(file.getAbsoluteFile()); 27 FileWriter fw = new FileWriter(file.getAbsoluteFile());
30 BufferedWriter bw = new BufferedWriter(fw); 28 BufferedWriter bw = new BufferedWriter(fw);
...@@ -44,24 +42,5 @@ public class DCalibratorBB implements DCalibrator { ...@@ -44,24 +42,5 @@ public class DCalibratorBB implements DCalibrator {
44 } 42 }
45 } 43 }
46 44
47
48
49
50
51 private Vector<String> ExcecCmd(String cmd) throws Exception {
52
53 Vector<String> v=new Vector<String>();
54
55 Runtime run = Runtime.getRuntime();
56
57 Process proc = run.exec(new String[]{"/bin/sh", "-c",cmd});
58 proc.waitFor();
59 BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
60 while(br.ready()) {
61 v.add(br.readLine());
62 }
63
64 return v;
65 }
66 45
67 } 46 }
......
...@@ -69,9 +69,17 @@ ...@@ -69,9 +69,17 @@
69 <dependency> 69 <dependency>
70 <groupId>org.emercit</groupId> 70 <groupId>org.emercit</groupId>
71 <artifactId>xmldbmanager</artifactId> 71 <artifactId>xmldbmanager</artifactId>
72 <version>1.4</version> 72 <version>1.5</version>
73 </dependency> 73 </dependency>
74 74
75
76 <dependency>
77 <groupId>org.emercit</groupId>
78 <artifactId>projecttools</artifactId>
79 <version>1.5</version>
80 </dependency>
81
82
75 83
76 </dependencies> 84 </dependencies>
77 85
......
...@@ -16,6 +16,8 @@ import org.emercit.ethmanager.model.CommandExecutor; ...@@ -16,6 +16,8 @@ import org.emercit.ethmanager.model.CommandExecutor;
16 16
17 import org.emercit.xmldbmanager.service.Db; 17 import org.emercit.xmldbmanager.service.Db;
18 18
19 import org.emercit.projecttools.constants.Paths;
20
19 21
20 public class EthLinux implements IEth { 22 public class EthLinux implements IEth {
21 23
...@@ -27,7 +29,7 @@ public class EthLinux implements IEth { ...@@ -27,7 +29,7 @@ public class EthLinux implements IEth {
27 29
28 private Vector<EthBean> ebs=new Vector<EthBean>(); 30 private Vector<EthBean> ebs=new Vector<EthBean>();
29 31
30 private Db ethStore; 32 private Db db=new Db(Paths.BEAN_ETH);
31 33
32 private Vector<String> extinfo; 34 private Vector<String> extinfo;
33 35
...@@ -39,17 +41,12 @@ public class EthLinux implements IEth { ...@@ -39,17 +41,12 @@ public class EthLinux implements IEth {
39 41
40 private EthBean emp; 42 private EthBean emp;
41 43
42 public EthLinux() { 44 public EthLinux() {
43
44 ethStore=new Db((Object)ebs);
45 } 45 }
46 46
47
48 public void ApplyConfig (String eth, String p, Object v) { 47 public void ApplyConfig (String eth, String p, Object v) {
49 48
50 49 ebs=(Vector<EthBean>)db.select();
51
52 ebs=(Vector<EthBean>)ethStore.select();
53 50
54 if (!p.equals("object")) { 51 if (!p.equals("object")) {
55 52
...@@ -82,9 +79,7 @@ public class EthLinux implements IEth { ...@@ -82,9 +79,7 @@ public class EthLinux implements IEth {
82 break; 79 break;
83 } 80 }
84 } 81 }
85 82 Config(ebs);
86
87 Config(ebs);
88 } 83 }
89 84
90 /* 85 /*
...@@ -98,7 +93,7 @@ public class EthLinux implements IEth { ...@@ -98,7 +93,7 @@ public class EthLinux implements IEth {
98 try { 93 try {
99 Vector<String> buff=ce.Run("ifconfig | grep eth | awk '{print $1}'"); 94 Vector<String> buff=ce.Run("ifconfig | grep eth | awk '{print $1}'");
100 95
101 ebs=ethStore.select(); 96 ebs=(Vector<EthBean>)db.select();
102 97
103 for (EthBean eb:ebs) { 98 for (EthBean eb:ebs) {
104 99
...@@ -120,27 +115,25 @@ public class EthLinux implements IEth { ...@@ -120,27 +115,25 @@ public class EthLinux implements IEth {
120 115
121 116
122 public void PrintInfoByName(String name) { 117 public void PrintInfoByName(String name) {
123 118
124 ebs=ethStore.select(); 119 ebs=(Vector<EthBean>)db.select();
125
126
127 120
128 for(EthBean eb : ebs) { 121 for(EthBean eb : ebs) {
129 122
130 if(eb.getName().equals(name)) { 123 if(eb.getName().equals(name)) {
131 124
132 try { 125 try {
133 extinfo=ce.Run("ifconfig"+" "+eb.getName()); 126 extinfo=ce.Run("ifconfig"+" "+eb.getName());
134 127
135 mac=ce.Run("ifconfig"+" "+eb.getName()+" | grep HWaddr | awk '{ print $5}' ").toString(); 128 mac=ce.Run("ifconfig"+" "+eb.getName()+" | grep HWaddr | awk '{ print $5}' ").toString();
136 129
137 eb.setInfo(extinfo); 130 eb.setInfo(extinfo);
138 eb.setMac(mac); 131 eb.setMac(mac);
139 132
140 if (eb.getDhcp()) { 133 if (eb.getDhcp()) {
141 134
142 String addr=ce.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'").toString(); 135 String addr=ce.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'").toString();
143 String mask=ce.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f4 | awk '{ print $1}'").toString(); 136 String mask=ce.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f4 | awk '{ print $1}'").toString();
144 String gateway=ce.Run("/sbin/route -n | grep 'UG' | awk '{print $2}'").toString(); 137 String gateway=ce.Run("/sbin/route -n | grep 'UG' | awk '{print $2}'").toString();
145 138
146 eb.setIp(addr); 139 eb.setIp(addr);
...@@ -156,8 +149,6 @@ public class EthLinux implements IEth { ...@@ -156,8 +149,6 @@ public class EthLinux implements IEth {
156 log.error(e.getMessage()); 149 log.error(e.getMessage());
157 } 150 }
158 151
159
160
161 } 152 }
162 } 153 }
163 154
......