Commit c91f620a c91f620a165f7f048ad1d1a1cfb281d284b91e76 by root

save

1 parent 5413c059
eb96f0d7c6eb16bba3a80585ade26f46
\ No newline at end of file
fcf9ad831694a6eb9ccec60ad06c6d4b2996fc9e
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<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"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>pckutils</artifactId>
<version>1.5</version>
</project>
9261a56b4a8d86ad7e6991a8f9a2822a
\ No newline at end of file
805dff1560e8a224309fea2b92ac167d61a87d54
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.emercit</groupId>
<artifactId>pckutils</artifactId>
<versioning>
<release>1.5</release>
<versions>
<version>1.5</version>
</versions>
<lastUpdated>20150727180908</lastUpdated>
</versioning>
</metadata>
08d8c6f6e4526506253777d406715c4d
\ No newline at end of file
074ac5995190869a9ce6821c47809f2aba60d959
\ No newline at end of file
......@@ -12,12 +12,12 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
......
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.compiler.source=1.7
......
......@@ -13,6 +13,24 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<executable>${env.JAVA_HOME_7}/bin/javac</executable>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
......@@ -21,5 +39,25 @@
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.emercit</groupId>
<artifactId>pckutils</artifactId>
<version>1.5</version>
</dependency>
</dependencies>
<repositories>
<!--other repositories if any-->
<repository>
<id>project.local</id>
<name>project</name>
<url>file:/root/git/hardwareconfig/DevTools/repo</url>
</repository>
</repositories>
</project>
......
......@@ -7,24 +7,22 @@ import java.io.FileWriter;
import java.io.InputStreamReader;
import java.util.Vector;
import org.emercit.pckutils.cmd.CmdExec;
public class DCalibratorBB implements DCalibrator {
private CmdExec cmdExec=new CmdExec();
public void Run(String cmd) {
try {
Vector<String> params=ExcecCmd(cmd);
Vector<String> params=cmdExec.Run(cmd);
File file = new File("/etc/X11/xorg.conf.d/99-calibration.conf");
File file = new File("/etc/X11/xorg.conf.d/99-calibration.conf");
if (!file.exists()) {
file.createNewFile();
}
if (!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
......@@ -44,24 +42,5 @@ public class DCalibratorBB implements DCalibrator {
}
}
private Vector<String> ExcecCmd(String cmd) throws Exception {
Vector<String> v=new Vector<String>();
Runtime run = Runtime.getRuntime();
Process proc = run.exec(new String[]{"/bin/sh", "-c",cmd});
proc.waitFor();
BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
while(br.ready()) {
v.add(br.readLine());
}
return v;
}
}
......
......@@ -69,9 +69,17 @@
<dependency>
<groupId>org.emercit</groupId>
<artifactId>xmldbmanager</artifactId>
<version>1.4</version>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.emercit</groupId>
<artifactId>projecttools</artifactId>
<version>1.5</version>
</dependency>
</dependencies>
......
......@@ -16,6 +16,8 @@ import org.emercit.ethmanager.model.CommandExecutor;
import org.emercit.xmldbmanager.service.Db;
import org.emercit.projecttools.constants.Paths;
public class EthLinux implements IEth {
......@@ -27,7 +29,7 @@ public class EthLinux implements IEth {
private Vector<EthBean> ebs=new Vector<EthBean>();
private Db ethStore;
private Db db=new Db(Paths.BEAN_ETH);
private Vector<String> extinfo;
......@@ -39,17 +41,12 @@ public class EthLinux implements IEth {
private EthBean emp;
public EthLinux() {
ethStore=new Db((Object)ebs);
public EthLinux() {
}
public void ApplyConfig (String eth, String p, Object v) {
ebs=(Vector<EthBean>)ethStore.select();
ebs=(Vector<EthBean>)db.select();
if (!p.equals("object")) {
......@@ -82,9 +79,7 @@ public class EthLinux implements IEth {
break;
}
}
Config(ebs);
Config(ebs);
}
/*
......@@ -98,7 +93,7 @@ public class EthLinux implements IEth {
try {
Vector<String> buff=ce.Run("ifconfig | grep eth | awk '{print $1}'");
ebs=ethStore.select();
ebs=(Vector<EthBean>)db.select();
for (EthBean eb:ebs) {
......@@ -120,27 +115,25 @@ public class EthLinux implements IEth {
public void PrintInfoByName(String name) {
ebs=ethStore.select();
ebs=(Vector<EthBean>)db.select();
for(EthBean eb : ebs) {
if(eb.getName().equals(name)) {
try {
extinfo=ce.Run("ifconfig"+" "+eb.getName());
extinfo=ce.Run("ifconfig"+" "+eb.getName());
mac=ce.Run("ifconfig"+" "+eb.getName()+" | grep HWaddr | awk '{ print $5}' ").toString();
mac=ce.Run("ifconfig"+" "+eb.getName()+" | grep HWaddr | awk '{ print $5}' ").toString();
eb.setInfo(extinfo);
eb.setMac(mac);
eb.setInfo(extinfo);
eb.setMac(mac);
if (eb.getDhcp()) {
if (eb.getDhcp()) {
String addr=ce.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'").toString();
String mask=ce.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f4 | awk '{ print $1}'").toString();
String addr=ce.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'").toString();
String mask=ce.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f4 | awk '{ print $1}'").toString();
String gateway=ce.Run("/sbin/route -n | grep 'UG' | awk '{print $2}'").toString();
eb.setIp(addr);
......@@ -156,8 +149,6 @@ public class EthLinux implements IEth {
log.error(e.getMessage());
}
}
}
......