Commit 59d94331 59d943313b0a86b4363de3144b3f1e63cb3243b5 by root

save

1 parent e2bfd647
Showing 165 changed files with 203 additions and 2732 deletions
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/J2SE-1.5">
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>
1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3 org.eclipse.jdt.core.compiler.compliance=1.5
4 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 org.eclipse.jdt.core.compiler.source=1.5
1 <?xml version="1.0" encoding="UTF-8"?>
2 <java version="1.8.0_25" class="java.beans.XMLDecoder">
3 <object class="DevInfo.DevInfo.DevInfoBean">
4 <void property="description">
5 <string>Tes Device</string>
6 </void>
7 <void property="guid">
8 <string>dsdd-3424-sad-asdas-sddd</string>
9 </void>
10 </object>
11 </java>
1 <project>
2 <modelVersion>4.0.0</modelVersion>
3
4 <groupId>DevInfo</groupId>
5 <artifactId>DevInfo</artifactId>
6 <version>0.0.1-SNAPSHOT</version>
7 <packaging>jar</packaging>
8
9 <dependencies>
10
11
12
13 <dependency>
14 <groupId>net.sourceforge.argparse4j</groupId>
15 <artifactId>argparse4j</artifactId>
16 <version>0.6.0</version>
17 </dependency>
18
19
20 <dependency>
21 <groupId>log4j</groupId>
22 <artifactId>log4j</artifactId>
23 <version>1.2.17</version>
24 </dependency>
25
26 <dependency>
27 <groupId>junit</groupId>
28 <artifactId>junit</artifactId>
29 <version>4.12</version>
30 </dependency>
31
32 </dependencies>
33 </project>
34
35
36
37
38
39
40
41
1 package org.emercit.devinfo;
2
3 import java.io.IOException;
4 import java.nio.ByteBuffer;
5 import java.nio.channels.ByteChannel;
6 import java.nio.file.Files;
7 import java.nio.file.Path;
8 import java.nio.file.Paths;
9 import java.nio.file.StandardOpenOption;
10 import java.security.MessageDigest;
11 import java.security.NoSuchAlgorithmException;
12
13 import net.sourceforge.argparse4j.ArgumentParsers;
14 import net.sourceforge.argparse4j.impl.Arguments;
15 import net.sourceforge.argparse4j.inf.ArgumentParser;
16 import net.sourceforge.argparse4j.inf.ArgumentParserException;
17 import net.sourceforge.argparse4j.inf.Namespace;
18
19 import org.apache.log4j.Logger;
20 import org.apache.log4j.ConsoleAppender;
21 import org.apache.log4j.Level;
22 import org.apache.log4j.PatternLayout;
23 import org.apache.log4j.RollingFileAppender;
24 import org.emercit.devinfo.model.DevInfoBean;
25 import org.emercit.devinfo.service.DevInfoService;
26
27
28 public class App
29 {
30 private static final Logger log = Logger.getLogger(App.class);
31
32
33 private static String method;
34 private static String pr;
35 private static String value;
36
37
38 public static void main( String[] args )
39 {
40 ArgumentParser parser = ArgumentParsers.newArgumentParser("prog");
41
42
43
44 try {
45
46 parser.description("Информация об устройстве")
47 .version("Version:1.0.0.0")
48 .defaultHelp(true);
49
50 parser.addArgument("-v")
51 .type(String.class)
52 .setDefault("")
53 .help("Значение параметра");
54
55 parser.addArgument("-m")
56 .type(String.class)
57 .setDefault("get")
58 .help("Функция. Получение параметров - get, установка параметров - set, создание файла DevInfo.xml - create");
59
60 parser.addArgument("-log")
61 .type(Integer.class)
62 .setDefault(0)
63 .help("Логирование. 0-выкл.; 1-консоль; 2-файл");
64
65
66 parser.addArgument("-p")
67 .type(String.class)
68 .setDefault("get")
69 .help("Параметр, который хотим прочитать или изменить");
70
71
72 Logger rootLogger = Logger.getRootLogger();
73 PatternLayout layout = new PatternLayout("%d{ISO8601} [%t] %-5p %c %x - %m%n");
74
75 //rootLogger.setLevel(Level.OFF);
76 rootLogger.setLevel(Level.DEBUG);
77
78 rootLogger.addAppender(new ConsoleAppender(layout));
79 try
80 {
81 RollingFileAppender fileAppender = new RollingFileAppender(layout, "/var/log/devtools/DevInfo.log");
82 rootLogger.addAppender(fileAppender);
83 }
84 catch (IOException e)
85 {
86 log.error(e.getMessage());
87 }
88
89
90
91 Namespace res = parser.parseArgs(args);
92
93 method=res.getString("m");
94 pr=res.getString("p");
95
96 if (method.equals("set")) { // Установка параметров
97
98 value = res.getString("v");
99
100
101 DevInfoBean m=DevInfoService.INSTANCE.Get();
102
103 if (pr.equals("title")) {
104 m.setDescription(value);
105 }else if (pr.equals("guid")) {
106 m.setGuid(value);
107 }
108
109 DevInfoService.INSTANCE.Set(m);
110
111 }else if (method.equals("get")) { // Получение параметров
112
113 DevInfoBean m=DevInfoService.INSTANCE.Get();
114
115 if (pr.equals("title")) {
116 System.out.println(m.getDescription());
117 }else if (pr.equals("guid")) {
118 System.out.println(m.getGuid());
119 }
120 }else if (method.equals("create")) {
121 DevInfoBean db=new DevInfoBean();
122 db.setDescription("");
123 db.setGuid("");
124 DevInfoService.INSTANCE.Set(db);
125
126 }
127
128 }catch(Exception e){
129
130
131
132 if(e instanceof ArgumentParserException){
133 log.error(e.getMessage());
134 } else {
135 parser.handleError((ArgumentParserException) e);
136 log.error(e.getMessage());
137 System.exit(1);
138 }
139 }
140
141
142 }
143 }
144
145
146
147
148
149
150
151
152
153
154
155
156
157
...@@ -23,13 +23,11 @@ ...@@ -23,13 +23,11 @@
23 </dependency> 23 </dependency>
24 24
25 <dependency> 25 <dependency>
26 <groupId>org.apache.httpcomponents</groupId> 26 <groupId>org.apache.httpcomponents</groupId>
27 <artifactId>httpclient</artifactId> 27 <artifactId>httpclient</artifactId>
28 <version>4.3.2</version> 28 <version>4.3.2</version>
29 </dependency> 29 </dependency>
30 30
31
32
33 <dependency> 31 <dependency>
34 <groupId>org.springframework</groupId> 32 <groupId>org.springframework</groupId>
35 <artifactId>spring-context</artifactId> 33 <artifactId>spring-context</artifactId>
...@@ -55,10 +53,6 @@ ...@@ -55,10 +53,6 @@
55 <version>${org.aspectj-version}</version> 53 <version>${org.aspectj-version}</version>
56 </dependency> 54 </dependency>
57 55
58
59
60
61
62 <!-- Logging --> 56 <!-- Logging -->
63 <dependency> 57 <dependency>
64 <groupId>org.slf4j</groupId> 58 <groupId>org.slf4j</groupId>
...@@ -214,15 +208,15 @@ ...@@ -214,15 +208,15 @@
214 <enabled>true</enabled> 208 <enabled>true</enabled>
215 </snapshots> 209 </snapshots>
216 </repository> 210 </repository>
217 <!-- For developing against latest Spring milestones --> 211 <!-- For developing against latest Spring milestones -->
218 <repository> 212 <repository>
219 <id>org.springframework.maven.milestone</id> 213 <id>org.springframework.maven.milestone</id>
220 <name>Spring Maven Milestone Repository</name> 214 <name>Spring Maven Milestone Repository</name>
221 <url>http://maven.springframework.org/milestone</url> 215 <url>http://maven.springframework.org/milestone</url>
222 <snapshots> 216 <snapshots>
223 <enabled>false</enabled> 217 <enabled>false</enabled>
224 </snapshots> 218 </snapshots>
225 </repository> 219 </repository>
226 220
227 221
228 222
......
1 a928c62d3f0ee8dbbed3091111a63391
...\ No newline at end of file ...\ No newline at end of file
1 bdf89b9b226109fc3552b52a43554e7ca78e0319
...\ 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>projecttools</artifactId>
7 <version>1.6</version>
8 </project>
1 feb04edd6060041ee399c1106196d510
...\ No newline at end of file ...\ No newline at end of file
1 9dc748b515323a43cc4a60635cd3fc2ee8888fa2
...\ No newline at end of file ...\ No newline at end of file
1 224f86b5347cff699dc9af8abdc76ce8
...\ No newline at end of file ...\ No newline at end of file
1 18f94ba99f751c75231ada4c27aa206bdc52b00a
...\ 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>projecttools</artifactId>
7 <version>1.7</version>
8 </project>
1 cd5091dcd6613baafe1e21faeb0e08b2
...\ No newline at end of file ...\ No newline at end of file
1 a5be29b08fa075045db2ca9a8d4fb8fa203cf589
...\ No newline at end of file ...\ No newline at end of file
...@@ -3,11 +3,13 @@ ...@@ -3,11 +3,13 @@
3 <groupId>org.emercit</groupId> 3 <groupId>org.emercit</groupId>
4 <artifactId>projecttools</artifactId> 4 <artifactId>projecttools</artifactId>
5 <versioning> 5 <versioning>
6 <release>1.5</release> 6 <release>1.7</release>
7 <versions> 7 <versions>
8 <version>1.0</version> 8 <version>1.0</version>
9 <version>1.5</version> 9 <version>1.5</version>
10 <version>1.6</version>
11 <version>1.7</version>
10 </versions> 12 </versions>
11 <lastUpdated>20150727175307</lastUpdated> 13 <lastUpdated>20150729064433</lastUpdated>
12 </versioning> 14 </versioning>
13 </metadata> 15 </metadata>
......
1 b260825c3bfcf4adbc4c55f14b06a533
...\ No newline at end of file ...\ No newline at end of file
1 45d7b34c8095939178525a9d326945f3
...\ No newline at end of file ...\ No newline at end of file
......
1 42f45f1bfe5327569975623e348e4d84480f536b
...\ No newline at end of file ...\ No newline at end of file
1 68c8d4957a5b529d5f9f48bba6ca3dd54aea5238
...\ No newline at end of file ...\ No newline at end of file
......
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription>
3 <name>DisplayCalibrator</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>
1 activeProfiles=
2 eclipse.preferences.version=1
3 resolveWorkspaceProjects=true
4 version=1
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>HardwareConfig</groupId>
6 <artifactId>DisplayCalibration</artifactId>
7 <version>0.0.1-SNAPSHOT</version>
8 <packaging>jar</packaging>
9
10 <name>DisplayCalibration</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 <dependencies>
36 <dependency>
37 <groupId>junit</groupId>
38 <artifactId>junit</artifactId>
39 <version>3.8.1</version>
40 <scope>test</scope>
41 </dependency>
42
43 <dependency>
44 <groupId>org.emercit</groupId>
45 <artifactId>pckutils</artifactId>
46 <version>1.5</version>
47 </dependency>
48
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
63 </project>
1 package org.emercit.displaycalibrator;
2
3 /**
4 * Hello world!
5 *
6 */
7
8 import org.emercit.displaycalibrator.service.DCalibratorBB;
9
10
11 public class App
12 {
13 public static void main( String[] args )
14 {
15
16 DCalibratorBB dcbb=new DCalibratorBB();
17
18 dcbb.Run("/home/debian/start-xinput-config.sh");
19
20 }
21 }
1 package HardwareConfig.DisplayCalibration;
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 }
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.m2e.MAVEN2_CLASSPATH_CONTAINER">
16 <attributes>
17 <attribute name="maven.pomderived" value="true"/>
18 </attributes>
19 </classpathentry>
20 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
21 <attributes>
22 <attribute name="maven.pomderived" value="true"/>
23 </attributes>
24 </classpathentry>
25 <classpathentry kind="output" path="target/classes"/>
26 </classpath>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription>
3 <name>DnsManager</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>
1 eclipse.preferences.version=1
2 encoding//src/main/java=UTF-8
3 encoding//src/test/java=UTF-8
4 encoding/<project>=UTF-8
1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
3 org.eclipse.jdt.core.compiler.compliance=1.7
4 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 org.eclipse.jdt.core.compiler.source=1.7
1 activeProfiles=
2 eclipse.preferences.version=1
3 resolveWorkspaceProjects=true
4 version=1
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>DnsServer</groupId>
6 <artifactId>DnsServer</artifactId>
7 <version>0.0.1-SNAPSHOT</version>
8 <packaging>jar</packaging>
9
10 <name>DnsServer</name>
11 <url>http://maven.apache.org</url>
12
13 <properties>
14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15 <java-version>1.7</java-version>
16 </properties>
17
18
19
20 <build>
21 <plugins>
22 <plugin>
23 <groupId>org.apache.maven.plugins</groupId>
24 <artifactId>maven-compiler-plugin</artifactId>
25 <configuration>
26 <source>1.7</source>
27 <target>1.7</target>
28 <showDeprecation>true</showDeprecation>
29 <showWarnings>true</showWarnings>
30 <executable>${env.JAVA_HOME_7}/bin/javac</executable>
31 <fork>true</fork>
32 </configuration>
33 </plugin>
34 </plugins>
35
36 </build>
37
38
39
40 <dependencies>
41
42 <dependency>
43 <groupId>net.sourceforge.argparse4j</groupId>
44 <artifactId>argparse4j</artifactId>
45 <version>0.6.0</version>
46 </dependency>
47
48 <dependency>
49 <groupId>log4j</groupId>
50 <artifactId>log4j</artifactId>
51 <version>1.2.17</version>
52 </dependency>
53
54 <dependency>
55 <groupId>junit</groupId>
56 <artifactId>junit</artifactId>
57 <version>4.12</version>
58 </dependency>
59
60 <dependency>
61 <groupId>com.cedarsoftware</groupId>
62 <artifactId>json-io</artifactId>
63 <version>4.0.0</version>
64 </dependency>
65
66
67
68
69 <dependency>
70 <groupId>org.emercit</groupId>
71 <artifactId>projecttools</artifactId>
72 <version>1.5</version>
73 </dependency>
74
75 </dependencies>
76
77 <repositories>
78 <!--other repositories if any-->
79 <repository>
80 <id>project.local</id>
81 <name>project</name>
82 <url>file:/root/git/hardwareconfig/DevTools/repo</url>
83 </repository>
84 </repositories>
85
86
87
88 </project>
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
1 package org.emercit.dnsmanager;
2
3 import java.io.IOException;
4 import java.nio.ByteBuffer;
5 import java.nio.channels.ByteChannel;
6 import java.nio.file.Files;
7 import java.nio.file.Path;
8 import java.nio.file.Paths;
9 import java.nio.file.StandardOpenOption;
10 import java.security.MessageDigest;
11 import java.security.NoSuchAlgorithmException;
12
13 import net.sourceforge.argparse4j.ArgumentParsers;
14 import net.sourceforge.argparse4j.impl.Arguments;
15 import net.sourceforge.argparse4j.inf.ArgumentParser;
16 import net.sourceforge.argparse4j.inf.ArgumentParserException;
17 import net.sourceforge.argparse4j.inf.Namespace;
18
19 import org.apache.log4j.Logger;
20 import org.apache.log4j.ConsoleAppender;
21 import org.apache.log4j.Level;
22 import org.apache.log4j.PatternLayout;
23 import org.apache.log4j.RollingFileAppender;
24 import org.emercit.dnsmanager.service.DnsLinux;
25
26 public class App
27 {
28
29 private static final Logger log = Logger.getLogger(App.class);
30
31 private static DnsLinux dnslinux=new DnsLinux();
32
33 private static String method;
34
35 private static String param;
36
37 private static String value;
38
39
40 public static void main( String[] args )
41 {
42 ArgumentParser parser = ArgumentParsers.newArgumentParser("prog");
43
44
45 try {
46
47 parser.description("Конфигуратор DNS")
48 .version("Version:1.0.0.0")
49 .defaultHelp(true);
50
51 parser.addArgument("-m")
52 .type(String.class)
53 .setDefault("get")
54 .help("Методы: \n"
55 + "1) get - получение всех IP DNS серверов;\n"
56 + "2) add - добавление IP адреса DNS сервера;\n"
57 + "3) del - удаление IP DNS сервера.\n");
58
59 parser.addArgument("-v")
60 .type(String.class)
61 .setDefault("")
62 .help("Значение параметра");
63
64 parser.addArgument("-p")
65 .type(String.class)
66 .setDefault("")
67 .help("Имя параметра.\n Возможные параметры:\n"
68 +"1) ip - адрес DNS сервера\n");
69
70 parser.addArgument("-e")
71 .type(String.class)
72 .setDefault("")
73 .help("Название сетевого интерфейса");
74
75 parser.addArgument("-log")
76 .type(Integer.class)
77 .setDefault(0)
78 .help("Логирование. 0-выкл.; 1-консоль; 2-файл");
79
80 Logger rootLogger = Logger.getRootLogger();
81 PatternLayout layout = new PatternLayout("%d{ISO8601} [%t] %-5p %c %x - %m%n");
82
83 //rootLogger.setLevel(Level.OFF);
84 rootLogger.setLevel(Level.DEBUG);
85
86 rootLogger.addAppender(new ConsoleAppender(layout));
87 try {
88 RollingFileAppender fileAppender = new RollingFileAppender(layout, "/var/log/devtools/DnsManager.log");
89 rootLogger.addAppender(fileAppender);
90 } catch (IOException e) {
91 log.error(e.getMessage());
92 }
93
94 Namespace res = parser.parseArgs(args);
95
96
97 method=res.getString("m");
98
99 if (method.equals("add")) { //Добавление Ip DNS сервера
100
101 value=res.getString("v");
102 dnslinux.Add(value);
103
104 }else if (method.equals("get")) { //Вывод списка DNS в JSON формате
105
106 dnslinux.PrintInfoDnsAll();
107
108 }else if (method.equals("del")) { // Удаление IP адреса DNS
109
110 value=res.getString("v");
111 dnslinux.Delete(value);
112 }
113
114 }catch(Exception e){
115
116 if(e instanceof ArgumentParserException){
117 log.error(e.getMessage());
118 }
119 else {
120 parser.handleError((ArgumentParserException) e);
121 log.error(e.getMessage());
122 System.exit(1);
123 }
124 }
125
126 }
127 }
128
129
130
131
132
133
134
135
136
137
138
1 package DnsServer.DnsServer;
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 }
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.m2e.MAVEN2_CLASSPATH_CONTAINER">
16 <attributes>
17 <attribute name="maven.pomderived" value="true"/>
18 </attributes>
19 </classpathentry>
20 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
21 <attributes>
22 <attribute name="maven.pomderived" value="true"/>
23 </attributes>
24 </classpathentry>
25 <classpathentry kind="output" path="target/classes"/>
26 </classpath>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription>
3 <name>DtManager</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>
1 eclipse.preferences.version=1
2 encoding//src/main/java=UTF-8
3 encoding//src/test/java=UTF-8
4 encoding/<project>=UTF-8
1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
3 org.eclipse.jdt.core.compiler.compliance=1.7
4 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 org.eclipse.jdt.core.compiler.source=1.7
1 activeProfiles=
2 eclipse.preferences.version=1
3 resolveWorkspaceProjects=true
4 version=1
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>DtManager</artifactId>
7 <version>0.0.1-SNAPSHOT</version>
8 <packaging>jar</packaging>
9
10 <name>DtManager</name>
11 <url>http://maven.apache.org</url>
12
13 <properties>
14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15 </properties>
16
17 <build>
18 <plugins>
19 <plugin>
20 <groupId>org.apache.maven.plugins</groupId>
21 <artifactId>maven-compiler-plugin</artifactId>
22 <configuration>
23 <source>1.7</source>
24 <target>1.7</target>
25 <showDeprecation>true</showDeprecation>
26 <showWarnings>true</showWarnings>
27 <executable>${env.JAVA_HOME_7}/bin/javac</executable>
28 <fork>true</fork>
29 </configuration>
30 </plugin>
31 </plugins>
32
33 </build>
34
35 <dependencies>
36 <dependency>
37 <groupId>junit</groupId>
38 <artifactId>junit</artifactId>
39 <version>3.8.1</version>
40 <scope>test</scope>
41 </dependency>
42
43
44 <dependency>
45 <groupId>org.emercit</groupId>
46 <artifactId>pckutils</artifactId>
47 <version>1.0</version>
48 </dependency>
49
50
51 </dependencies>
52
53 <repositories>
54 <!--other repositories if any-->
55 <repository>
56 <id>project.local</id>
57 <name>project</name>
58 <url>file:/opt/devtools/repo</url>
59 </repository>
60 </repositories>
61
62
63
64 </project>
1 package org.emercit.dtmanager;
2
3
4
5 import java.text.SimpleDateFormat;
6 import java.util.Calendar;
7 import java.util.Date;
8 import java.util.GregorianCalendar;
9 import java.util.TimeZone;
10
11 import org.emercit.dtmanager.service.NtpLinux;
12
13 public class App
14 {
15 public static void main( String[] args )
16 {
17
18 /*
19 #server 0.it.pool.ntp.org iburst
20 #server 1.it.pool.ntp.org iburst
21 #server 2.it.pool.ntp.org iburst
22 server 3.it.pool.ntp.org iburst
23
24 restrict default nomodify nopeer
25 restrict 0.0.0.0
26
27 driftfile /var/lib/ntp/ntp.drift
28 logfile /var/log/ntp.log
29
30 */
31 /*
32 Calendar calendar = Calendar.getInstance();
33
34
35 TimeZone timeZone = calendar.getTimeZone();
36
37
38 String[] tzAll=timeZone.getAvailableIDs();
39
40
41 for (String tz:tzAll) {
42 System.out.println(tz);
43 }
44
45 */
46 Calendar calendar = Calendar.getInstance();
47
48 TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
49
50 // calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
51
52 TimeZone timeZone = calendar.getTimeZone();
53
54
55 Date date=calendar.getTime();
56 String formattedDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
57 System.out.println(formattedDate);
58
59 System.out.println(timeZone.getID());
60
61
62 }
63 }
1 package org.emercit.DtManager;
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 }
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.m2e.MAVEN2_CLASSPATH_CONTAINER">
16 <attributes>
17 <attribute name="maven.pomderived" value="true"/>
18 </attributes>
19 </classpathentry>
20 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
21 <attributes>
22 <attribute name="maven.pomderived" value="true"/>
23 </attributes>
24 </classpathentry>
25 <classpathentry kind="output" path="target/classes"/>
26 </classpath>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription>
3 <name>EthManager</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>
1 eclipse.preferences.version=1
2 encoding//src/main/java=UTF-8
3 encoding//src/test/java=UTF-8
4 encoding/<project>=UTF-8
1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 org.eclipse.jdt.core.compiler.compliance=1.7
6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
12 org.eclipse.jdt.core.compiler.source=1.7
1 activeProfiles=
2 eclipse.preferences.version=1
3 resolveWorkspaceProjects=true
4 version=1
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>NetConfig</groupId>
6 <artifactId>NetConfig</artifactId>
7 <version>0.0.1-SNAPSHOT</version>
8 <packaging>jar</packaging>
9
10 <name>NetConfig</name>
11 <url>http://maven.apache.org</url>
12
13
14 <properties>
15 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16 <java-version>1.7</java-version>
17
18 </properties>
19
20
21
22 <build>
23 <plugins>
24 <plugin>
25 <groupId>org.apache.maven.plugins</groupId>
26 <artifactId>maven-compiler-plugin</artifactId>
27 <configuration>
28 <source>1.7</source>
29 <target>1.7</target>
30 <showDeprecation>true</showDeprecation>
31 <showWarnings>true</showWarnings>
32 <executable>${env.JAVA_HOME_7}/bin/javac</executable>
33 <fork>true</fork>
34 </configuration>
35 </plugin>
36 </plugins>
37
38 </build>
39
40
41 <dependencies>
42
43 <dependency>
44 <groupId>net.sourceforge.argparse4j</groupId>
45 <artifactId>argparse4j</artifactId>
46 <version>0.6.0</version>
47 </dependency>
48
49
50 <dependency>
51 <groupId>log4j</groupId>
52 <artifactId>log4j</artifactId>
53 <version>1.2.17</version>
54 </dependency>
55
56 <dependency>
57 <groupId>junit</groupId>
58 <artifactId>junit</artifactId>
59 <version>4.12</version>
60 </dependency>
61
62
63 <dependency>
64 <groupId>com.cedarsoftware</groupId>
65 <artifactId>json-io</artifactId>
66 <version>4.0.0</version>
67 </dependency>
68
69 <dependency>
70 <groupId>org.emercit</groupId>
71 <artifactId>xmldbmanager</artifactId>
72 <version>1.5</version>
73 </dependency>
74
75
76 <dependency>
77 <groupId>org.emercit</groupId>
78 <artifactId>projecttools</artifactId>
79 <version>1.5</version>
80 </dependency>
81
82
83
84 </dependencies>
85
86
87 <repositories>
88 <!--other repositories if any-->
89 <repository>
90 <id>project.local</id>
91 <name>project</name>
92 <url>file:/root/git/hardwareconfig/DevTools/repo</url>
93 </repository>
94 </repositories>
95
96
97 </project>
1 package org.emercit.ethmanager;
2
3
4 import java.io.IOException;
5 import java.nio.ByteBuffer;
6 import java.nio.channels.ByteChannel;
7 import java.nio.file.Files;
8 import java.nio.file.Path;
9 import java.nio.file.Paths;
10 import java.nio.file.StandardOpenOption;
11 import java.security.MessageDigest;
12 import java.security.NoSuchAlgorithmException;
13 import java.util.Vector;
14
15 import net.sourceforge.argparse4j.ArgumentParsers;
16 import net.sourceforge.argparse4j.impl.Arguments;
17 import net.sourceforge.argparse4j.inf.ArgumentParser;
18 import net.sourceforge.argparse4j.inf.ArgumentParserException;
19 import net.sourceforge.argparse4j.inf.Namespace;
20
21 import org.apache.log4j.Logger;
22 import org.apache.log4j.ConsoleAppender;
23 import org.apache.log4j.Level;
24 import org.apache.log4j.PatternLayout;
25 import org.apache.log4j.RollingFileAppender;
26 import org.emercit.ethmanager.service.EthLinux;
27
28
29
30 public class App
31 {
32
33
34 private static EthLinux ethlinux=new EthLinux();
35
36 public static void main( String[] args )
37 {
38 ethlinux.setDefaults();
39
40 }
41 }
42
43
44
45
46
47
48
49
50
51
1 package org.emercit.netmanager;
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 }
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.m2e.MAVEN2_CLASSPATH_CONTAINER">
16 <attributes>
17 <attribute name="maven.pomderived" value="true"/>
18 </attributes>
19 </classpathentry>
20 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
21 <attributes>
22 <attribute name="maven.pomderived" value="true"/>
23 </attributes>
24 </classpathentry>
25 <classpathentry kind="output" path="target/classes"/>
26 </classpath>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription>
3 <name>GSMManager</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>
1 eclipse.preferences.version=1
2 encoding//src/main/java=UTF-8
3 encoding//src/test/java=UTF-8
4 encoding/<project>=UTF-8
1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
3 org.eclipse.jdt.core.compiler.compliance=1.7
4 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 org.eclipse.jdt.core.compiler.source=1.7
1 activeProfiles=
2 eclipse.preferences.version=1
3 resolveWorkspaceProjects=true
4 version=1
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>GsmModemManager</artifactId>
7 <version>0.0.1-SNAPSHOT</version>
8 <packaging>jar</packaging>
9
10 <name>GsmModemManager</name>
11 <url>http://maven.apache.org</url>
12 <properties>
13 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14 </properties>
15
16
17 <build>
18 <plugins>
19 <plugin>
20 <groupId>org.apache.maven.plugins</groupId>
21 <artifactId>maven-compiler-plugin</artifactId>
22 <configuration>
23 <source>1.7</source>
24 <target>1.7</target>
25 <showDeprecation>true</showDeprecation>
26 <showWarnings>true</showWarnings>
27 <executable>${env.JAVA_HOME_7}/bin/javac</executable>
28 <fork>true</fork>
29 </configuration>
30 </plugin>
31 </plugins>
32
33 </build>
34
35 <dependencies>
36 <dependency>
37 <groupId>junit</groupId>
38 <artifactId>junit</artifactId>
39 <version>3.8.1</version>
40 <scope>test</scope>
41 </dependency>
42
43 <dependency>
44 <groupId>org.emercit</groupId>
45 <artifactId>xmldbmanager</artifactId>
46 <version>1.5</version>
47 </dependency>
48
49 <dependency>
50 <groupId>org.emercit</groupId>
51 <artifactId>projecttools</artifactId>
52 <version>1.5</version>
53 </dependency>
54
55 </dependencies>
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 </project>
1 package org.emercit.gsmmanager;
2
3
4 import org.emercit.gsmmanager.service.Gsm;
5
6 public class App
7 {
8 public static void main( String[] args )
9 {
10 Gsm gsm=new Gsm();
11
12 gsm.init();
13 }
14 }
1 package org.emercit.GsmModemManager;
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 }
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.m2e.MAVEN2_CLASSPATH_CONTAINER">
16 <attributes>
17 <attribute name="maven.pomderived" value="true"/>
18 </attributes>
19 </classpathentry>
20 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
21 <attributes>
22 <attribute name="maven.pomderived" value="true"/>
23 </attributes>
24 </classpathentry>
25 <classpathentry kind="output" path="target/classes"/>
26 </classpath>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription>
3 <name>PckUtils</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>
1 eclipse.preferences.version=1
2 encoding//src/main/java=UTF-8
3 encoding//src/test/java=UTF-8
4 encoding/<project>=UTF-8
1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
3 org.eclipse.jdt.core.compiler.compliance=1.7
4 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 org.eclipse.jdt.core.compiler.source=1.7
1 activeProfiles=
2 eclipse.preferences.version=1
3 resolveWorkspaceProjects=true
4 version=1
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>HardwareConfig</groupId>
6 <artifactId>PUtils</artifactId>
7 <version>0.0.1-SNAPSHOT</version>
8 <packaging>jar</packaging>
9
10 <name>PUtils</name>
11 <url>http://maven.apache.org</url>
12
13 <properties>
14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15 </properties>
16
17 <build>
18 <plugins>
19 <plugin>
20 <groupId>org.apache.maven.plugins</groupId>
21 <artifactId>maven-compiler-plugin</artifactId>
22 <configuration>
23 <source>1.7</source>
24 <target>1.7</target>
25 <showDeprecation>true</showDeprecation>
26 <showWarnings>true</showWarnings>
27 <executable>${env.JAVA_HOME_7}/bin/javac</executable>
28 <fork>true</fork>
29 </configuration>
30 </plugin>
31 </plugins>
32 </build>
33
34
35 <dependencies>
36 <dependency>
37 <groupId>junit</groupId>
38 <artifactId>junit</artifactId>
39 <version>3.8.1</version>
40 <scope>test</scope>
41 </dependency>
42
43 <dependency>
44 <groupId>org.emercit</groupId>
45 <artifactId>projecttools</artifactId>
46 <version>1.5</version>
47 </dependency>
48
49 </dependencies>
50
51 <repositories>
52 <!--other repositories if any-->
53 <repository>
54 <id>project.local</id>
55 <name>project</name>
56 <url>file:/root/git/hardwareconfig/DevTools/repo</url>
57 </repository>
58 </repositories>
59
60
61 </project>
1 package org.emercit.pckutils;
2
3 /**
4 * Hello world!
5 *
6 */
7 public class App
8 {
9 public static void main( String[] args )
10 {
11 System.out.println( "Hello World!" );
12 }
13 }
1 package HardwareConfig.PUtils;
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 }
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.m2e.MAVEN2_CLASSPATH_CONTAINER">
16 <attributes>
17 <attribute name="maven.pomderived" value="true"/>
18 </attributes>
19 </classpathentry>
20 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
21 <attributes>
22 <attribute name="maven.pomderived" value="true"/>
23 </attributes>
24 </classpathentry>
25 <classpathentry kind="output" path="target/classes"/>
26 </classpath>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription>
3 <name>ProjectTools</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>
1 eclipse.preferences.version=1
2 encoding//src/main/java=UTF-8
3 encoding//src/test/java=UTF-8
4 encoding/<project>=UTF-8
1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
3 org.eclipse.jdt.core.compiler.compliance=1.7
4 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 org.eclipse.jdt.core.compiler.source=1.7
1 activeProfiles=
2 eclipse.preferences.version=1
3 resolveWorkspaceProjects=true
4 version=1
1 package org.emercit.ProjectTools;
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 }
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.m2e.MAVEN2_CLASSPATH_CONTAINER">
16 <attributes>
17 <attribute name="maven.pomderived" value="true"/>
18 </attributes>
19 </classpathentry>
20 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
21 <attributes>
22 <attribute name="maven.pomderived" value="true"/>
23 </attributes>
24 </classpathentry>
25 <classpathentry kind="output" path="target/classes"/>
26 </classpath>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription>
3 <name>ProxyManager</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>
1 eclipse.preferences.version=1
2 encoding//src/main/java=UTF-8
3 encoding//src/test/java=UTF-8
4 encoding/<project>=UTF-8
1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 org.eclipse.jdt.core.compiler.compliance=1.7
6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
12 org.eclipse.jdt.core.compiler.source=1.7
1 activeProfiles=
2 eclipse.preferences.version=1
3 resolveWorkspaceProjects=true
4 version=1
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>ProxyManager</groupId>
6 <artifactId>ProxyManager</artifactId>
7 <version>0.0.1-SNAPSHOT</version>
8 <packaging>jar</packaging>
9
10 <name>ProxyManager</name>
11 <url>http://maven.apache.org</url>
12
13 <properties>
14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15 <java-version>1.7</java-version>
16 </properties>
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
34 </build>
35
36
37 <dependencies>
38
39 <dependency>
40 <groupId>net.sourceforge.argparse4j</groupId>
41 <artifactId>argparse4j</artifactId>
42 <version>0.6.0</version>
43 </dependency>
44
45 <dependency>
46 <groupId>log4j</groupId>
47 <artifactId>log4j</artifactId>
48 <version>1.2.17</version>
49 </dependency>
50
51 <dependency>
52 <groupId>junit</groupId>
53 <artifactId>junit</artifactId>
54 <version>4.12</version>
55 </dependency>
56
57 <dependency>
58 <groupId>com.cedarsoftware</groupId>
59 <artifactId>json-io</artifactId>
60 <version>4.0.0</version>
61 </dependency>
62
63 <dependency>
64 <groupId>org.emercit</groupId>
65 <artifactId>xmldbmanager</artifactId>
66 <version>1.5</version>
67 </dependency>
68
69 <dependency>
70 <groupId>org.emercit</groupId>
71 <artifactId>projecttools</artifactId>
72 <version>1.5</version>
73 </dependency>
74
75 </dependencies>
76
77 <repositories>
78 <!--other repositories if any-->
79 <repository>
80 <id>project.local</id>
81 <name>project</name>
82 <url>file:/root/git/hardwareconfig/DevTools/repo</url>
83 </repository>
84 </repositories>
85
86 </project>
1 package org.emercit.proxymanager;
2
3
4 import java.io.IOException;
5 import java.nio.ByteBuffer;
6 import java.nio.channels.ByteChannel;
7 import java.nio.file.Files;
8 import java.nio.file.Path;
9 import java.nio.file.Paths;
10 import java.nio.file.StandardOpenOption;
11 import java.security.MessageDigest;
12 import java.security.NoSuchAlgorithmException;
13
14 import net.sourceforge.argparse4j.ArgumentParsers;
15 import net.sourceforge.argparse4j.impl.Arguments;
16 import net.sourceforge.argparse4j.inf.ArgumentParser;
17 import net.sourceforge.argparse4j.inf.ArgumentParserException;
18 import net.sourceforge.argparse4j.inf.Namespace;
19
20 import org.apache.log4j.Logger;
21 import org.apache.log4j.ConsoleAppender;
22 import org.apache.log4j.Level;
23 import org.apache.log4j.PatternLayout;
24 import org.apache.log4j.RollingFileAppender;
25 import org.emercit.proxymanager.service.ProxyLinux;
26
27
28 public class App
29 {
30
31 private static final Logger log = Logger.getLogger(App.class);
32
33 private static ProxyLinux proxyLinux=new ProxyLinux();
34
35
36
37 public static void main( String[] args )
38 {
39
40 proxyLinux.init();
41
42
43 }
44 }
45
46
47
48
49
50
51
52
53
54
55
1 package org.emercit.proxymanager;
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 }
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.m2e.MAVEN2_CLASSPATH_CONTAINER">
16 <attributes>
17 <attribute name="maven.pomderived" value="true"/>
18 </attributes>
19 </classpathentry>
20 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
21 <attributes>
22 <attribute name="maven.pomderived" value="true"/>
23 </attributes>
24 </classpathentry>
25 <classpathentry kind="output" path="target/classes"/>
26 </classpath>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription>
3 <name>RemoteServers</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>
1 eclipse.preferences.version=1
2 encoding//src/main/java=UTF-8
3 encoding//src/test/java=UTF-8
4 encoding/<project>=UTF-8
1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
3 org.eclipse.jdt.core.compiler.compliance=1.7
4 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 org.eclipse.jdt.core.compiler.source=1.7
1 activeProfiles=
2 eclipse.preferences.version=1
3 resolveWorkspaceProjects=true
4 version=1
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>HardwareConfig</groupId>
6 <artifactId>RemoteServers</artifactId>
7 <version>0.0.1-SNAPSHOT</version>
8 <packaging>jar</packaging>
9
10 <name>RemoteServers</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
34 </build>
35
36
37
38 <dependencies>
39
40
41 <dependency>
42 <groupId>net.sourceforge.argparse4j</groupId>
43 <artifactId>argparse4j</artifactId>
44 <version>0.6.0</version>
45 </dependency>
46
47
48 <dependency>
49 <groupId>log4j</groupId>
50 <artifactId>log4j</artifactId>
51 <version>1.2.17</version>
52 </dependency>
53
54 <dependency>
55 <groupId>junit</groupId>
56 <artifactId>junit</artifactId>
57 <version>4.12</version>
58 </dependency>
59
60
61 <dependency>
62 <groupId>com.cedarsoftware</groupId>
63 <artifactId>json-io</artifactId>
64 <version>4.0.0</version>
65 </dependency>
66
67 <dependency>
68 <groupId>org.emercit</groupId>
69 <artifactId>xmldbmanager</artifactId>
70 <version>1.5</version>
71 </dependency>
72
73 <dependency>
74 <groupId>org.emercit</groupId>
75 <artifactId>projecttools</artifactId>
76 <version>1.5</version>
77 </dependency>
78
79
80
81 </dependencies>
82
83 <repositories>
84 <!--other repositories if any-->
85 <repository>
86 <id>project.local</id>
87 <name>project</name>
88 <url>file:/root/git/hardwareconfig/DevTools/repo</url>
89 </repository>
90 </repositories>
91
92
93 </project>
1 package org.emercit.remoteservers;
2
3
4 import org.emercit.remoteserver.service.RemSrv;
5
6 public class App
7 {
8 public static void main( String[] args )
9 {
10
11 RemSrv sv=new RemSrv();
12 sv.init();
13 }
14 }
1 package org.emercit.remoteservers;
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 }
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/J2SE-1.5">
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>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription>
3 <name>SSHCmdExecutor</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>
1 eclipse.preferences.version=1
2 encoding//src/main/java=UTF-8
3 encoding//src/test/java=UTF-8
4 encoding/<project>=UTF-8
1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3 org.eclipse.jdt.core.compiler.compliance=1.5
4 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 org.eclipse.jdt.core.compiler.source=1.5
1 activeProfiles=
2 eclipse.preferences.version=1
3 resolveWorkspaceProjects=true
4 version=1
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>NetConfig</groupId>
6 <artifactId>SSHClient</artifactId>
7 <version>0.0.1-SNAPSHOT</version>
8 <packaging>jar</packaging>
9
10 <name>SSHClient</name>
11 <url>http://maven.apache.org</url>
12
13 <properties>
14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15 </properties>
16
17 <dependencies>
18 <dependency>
19 <groupId>junit</groupId>
20 <artifactId>junit</artifactId>
21 <version>3.8.1</version>
22 <scope>test</scope>
23 </dependency>
24
25 <dependency>
26 <groupId>com.jcraft</groupId>
27 <artifactId>jsch</artifactId>
28 <version>0.1.51</version>
29 </dependency>
30
31
32
33 <dependency>
34 <groupId>log4j</groupId>
35 <artifactId>log4j</artifactId>
36 <version>1.2.17</version>
37 </dependency>
38
39
40 <dependency>
41 <groupId>net.sourceforge.argparse4j</groupId>
42 <artifactId>argparse4j</artifactId>
43 <version>0.6.0</version>
44 </dependency>
45
46
47 </dependencies>
48 </project>
1 package org.emercit.sshcmdexecutor;
2
3
4
5 import java.io.IOException;
6 import java.nio.ByteBuffer;
7 import java.nio.channels.ByteChannel;
8 import java.nio.file.Files;
9 import java.nio.file.Path;
10 import java.nio.file.Paths;
11 import java.nio.file.StandardOpenOption;
12 import java.security.MessageDigest;
13 import java.security.NoSuchAlgorithmException;
14
15 import net.sourceforge.argparse4j.ArgumentParsers;
16 import net.sourceforge.argparse4j.impl.Arguments;
17 import net.sourceforge.argparse4j.inf.ArgumentParser;
18 import net.sourceforge.argparse4j.inf.ArgumentParserException;
19 import net.sourceforge.argparse4j.inf.Namespace;
20
21 import org.apache.log4j.Logger;
22 import org.apache.log4j.ConsoleAppender;
23 import org.apache.log4j.Level;
24 import org.apache.log4j.PatternLayout;
25 import org.apache.log4j.RollingFileAppender;
26
27
28 public class App
29 {
30 private static final Logger log = Logger.getLogger(App.class);
31
32 private static SSHCmdExecutor executor=new SSHCmdExecutor();
33
34 public static void main( String[] args )
35 {
36 ArgumentParser parser = ArgumentParsers.newArgumentParser("prog");
37
38 try {
39
40 parser.description("Выполнение команд через подключении по SSH")
41 .version("Version:1.0.0.0")
42 .defaultHelp(true);
43
44 parser.addArgument("-login")
45 .type(String.class)
46 .help("Имя пользователя");
47
48 parser.addArgument("-pass")
49 .type(String.class)
50 .help("Пароль");
51
52 parser.addArgument("-host")
53 .type(String.class)
54 .help("Адрес");
55
56 parser.addArgument("-port")
57 .type(Integer.class)
58 .help("Порт");
59
60 parser.addArgument("-cmd")
61 .type(String.class)
62 .help("Команда для выполнения");
63
64 parser.addArgument("-log")
65 .type(Integer.class)
66 .setDefault(0)
67 .help("Логирование. 0-выкл.; 1-консоль; 2-файл");
68
69 Logger rootLogger = Logger.getRootLogger();
70 PatternLayout layout = new PatternLayout("%d{ISO8601} [%t] %-5p %c %x - %m%n");
71
72 //rootLogger.setLevel(Level.OFF);
73 rootLogger.setLevel(Level.DEBUG);
74
75 rootLogger.addAppender(new ConsoleAppender(layout));
76 try {
77 RollingFileAppender fileAppender = new RollingFileAppender(layout, "/var/log/devtools/SSHCmdExcecutor.log");
78 rootLogger.addAppender(fileAppender);
79 } catch (IOException e) {
80 log.error(e.getMessage());
81 }
82
83 Namespace res = parser.parseArgs(args);
84
85 executor.setLogin(res.getString("login"));
86 executor.setPassword(res.getString("pass"));
87 executor.setHost(res.getString("host"));
88 executor.setPort(res.getInt("port"));
89 executor.setCmd(res.getString("cmd"));
90
91 executor.Exec();
92
93 }catch(Exception e){
94 log.error(e.getMessage());
95 if(e instanceof ArgumentParserException){
96 log.error(e.getMessage());
97 } else {
98 parser.handleError((ArgumentParserException) e);
99 log.error(e.getMessage());
100 System.exit(1);
101 }
102 }
103
104 }
105 }
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
1 package NetConfig.SSHClient;
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 }
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/J2SE-1.5">
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>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription>
3 <name>ServiceManager</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>
1 eclipse.preferences.version=1
2 encoding//src/main/java=UTF-8
3 encoding//src/test/java=UTF-8
4 encoding/<project>=UTF-8
1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3 org.eclipse.jdt.core.compiler.compliance=1.5
4 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 org.eclipse.jdt.core.compiler.source=1.5
1 activeProfiles=
2 eclipse.preferences.version=1
3 resolveWorkspaceProjects=true
4 version=1
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>ServiceManager</artifactId>
7 <version>0.0.1-SNAPSHOT</version>
8 <packaging>jar</packaging>
9
10 <name>ServiceManager</name>
11 <url>http://maven.apache.org</url>
12
13 <properties>
14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15 </properties>
16
17 <dependencies>
18 <dependency>
19 <groupId>junit</groupId>
20 <artifactId>junit</artifactId>
21 <version>3.8.1</version>
22 <scope>test</scope>
23 </dependency>
24 </dependencies>
25 </project>
1 package org.emercit.servicemanager;
2
3 /**
4 * Hello world!
5 *
6 */
7 public class App
8 {
9 public static void main( String[] args )
10 {
11 System.out.println( "Hello World!" );
12 }
13 }
1 package org.emercit.servicemanager;
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 }
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription> 2 <projectDescription>
3 <name>DevInfo</name> 3 <name>UtilsTools</name>
4 <comment></comment> 4 <comment></comment>
5 <projects> 5 <projects>
6 </projects> 6 </projects>
......
...@@ -3,36 +3,33 @@ ...@@ -3,36 +3,33 @@
3 <modelVersion>4.0.0</modelVersion> 3 <modelVersion>4.0.0</modelVersion>
4 4
5 <groupId>org.emercit</groupId> 5 <groupId>org.emercit</groupId>
6 <artifactId>ProjectTools</artifactId> 6 <artifactId>UtilsTools</artifactId>
7 <version>0.0.1-SNAPSHOT</version> 7 <version>0.0.1-SNAPSHOT</version>
8 <packaging>jar</packaging> 8 <packaging>jar</packaging>
9 9
10 <name>ProjectTools</name> 10 <name>UtilsTools</name>
11 <url>http://maven.apache.org</url> 11 <url>http://maven.apache.org</url>
12 12
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 16
17 <build> 17 <build>
18 <plugins> 18 <plugins>
19 <plugin> 19 <plugin>
20 <groupId>org.apache.maven.plugins</groupId> 20 <groupId>org.apache.maven.plugins</groupId>
21 <artifactId>maven-compiler-plugin</artifactId> 21 <artifactId>maven-compiler-plugin</artifactId>
22 <configuration> 22 <configuration>
23 <source>1.7</source> 23 <source>1.7</source>
24 <target>1.7</target> 24 <target>1.7</target>
25 <showDeprecation>true</showDeprecation> 25 <showDeprecation>true</showDeprecation>
26 <showWarnings>true</showWarnings> 26 <showWarnings>true</showWarnings>
27 <executable>${env.JAVA_HOME_7}/bin/javac</executable> 27 <executable>${env.JAVA_HOME_7}/bin/javac</executable>
28 <fork>true</fork> 28 <fork>true</fork>
29 </configuration> 29 </configuration>
30 </plugin> 30 </plugin>
31 </plugins> 31 </plugins>
32
33 </build> 32 </build>
34
35
36 33
37 <dependencies> 34 <dependencies>
38 <dependency> 35 <dependency>
...@@ -42,9 +39,30 @@ ...@@ -42,9 +39,30 @@
42 <scope>test</scope> 39 <scope>test</scope>
43 </dependency> 40 </dependency>
44 41
45 42
43 <dependency>
44 <groupId>com.jcraft</groupId>
45 <artifactId>jsch</artifactId>
46 <version>0.1.51</version>
47 </dependency>
48
49
50
51 <dependency>
52 <groupId>log4j</groupId>
53 <artifactId>log4j</artifactId>
54 <version>1.2.17</version>
55 </dependency>
56
57
58 <dependency>
59 <groupId>net.sourceforge.argparse4j</groupId>
60 <artifactId>argparse4j</artifactId>
61 <version>0.6.0</version>
62 </dependency>
63
64
65
66
46 </dependencies> 67 </dependencies>
47
48
49
50 </project> 68 </project>
......
...@@ -8,7 +8,6 @@ import java.io.FileInputStream; ...@@ -8,7 +8,6 @@ import java.io.FileInputStream;
8 import java.io.FileOutputStream; 8 import java.io.FileOutputStream;
9 9
10 import org.apache.log4j.Logger; 10 import org.apache.log4j.Logger;
11 import org.emercit.devinfo.App;
12 import org.emercit.devinfo.model.DevInfoBean; 11 import org.emercit.devinfo.model.DevInfoBean;
13 12
14 public class DevInfoImpl implements IDevInfo { 13 public class DevInfoImpl implements IDevInfo {
......
...@@ -14,6 +14,8 @@ public class DCalibratorBB implements DCalibrator { ...@@ -14,6 +14,8 @@ public class DCalibratorBB implements DCalibrator {
14 14
15 private CmdExec cmdExec=new CmdExec(); 15 private CmdExec cmdExec=new CmdExec();
16 16
17 //Run("/home/debian/start-xinput-config.sh");
18
17 public void Run(String cmd) { 19 public void Run(String cmd) {
18 try { 20 try {
19 Vector<String> params=cmdExec.Run(cmd); 21 Vector<String> params=cmdExec.Run(cmd);
......
...@@ -9,8 +9,6 @@ import java.util.Vector; ...@@ -9,8 +9,6 @@ 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 com.cedarsoftware.util.io.JsonWriter;
13
14 import org.emercit.dnsmanager.model.CommandExecutor; 12 import org.emercit.dnsmanager.model.CommandExecutor;
15 13
16 14
...@@ -42,25 +40,7 @@ public class DnsLinux implements IDns{ ...@@ -42,25 +40,7 @@ public class DnsLinux implements IDns{
42 40
43 } 41 }
44 42
45 43
46 /*
47 * Вывод на экран списка DNS серверов в JSON формате
48 * @see org.emerct.dnsmanager.service.IDns#PrintInfoDnsAll()
49 */
50 public void PrintInfoDnsAll() {
51
52 dbs=getAllDns();
53
54 try {
55 json = JsonWriter.objectToJson(dbs);
56 System.out.println(json);
57
58 }catch(Exception e) {
59 log.error(e.getMessage());
60 }
61
62
63 }
64 44
65 public void Delete(String value) { 45 public void Delete(String value) {
66 46
......
...@@ -8,8 +8,7 @@ public interface IDns { ...@@ -8,8 +8,7 @@ public interface IDns {
8 8
9 public void Add (String value); 9 public void Add (String value);
10 10
11 public void PrintInfoDnsAll(); 11
12
13 public void Delete(String value); 12 public void Delete(String value);
14 13
15 public boolean Config(Vector<DnsBean> dbs); 14 public boolean Config(Vector<DnsBean> dbs);
......
...@@ -3,8 +3,7 @@ package org.emercit.ethmanager.service; ...@@ -3,8 +3,7 @@ package org.emercit.ethmanager.service;
3 import org.apache.log4j.Logger; 3 import org.apache.log4j.Logger;
4 import org.emercit.ethmanager.model.EthBean; 4 import org.emercit.ethmanager.model.EthBean;
5 5
6 import com.cedarsoftware.util.io.JsonReader; 6
7 import com.cedarsoftware.util.io.JsonWriter;
8 7
9 import java.util.Vector; 8 import java.util.Vector;
10 import java.io.File; 9 import java.io.File;
...@@ -35,52 +34,14 @@ public class EthLinux implements IEth { ...@@ -35,52 +34,14 @@ public class EthLinux implements IEth {
35 34
36 private String mac; 35 private String mac;
37 36
38 private String json; 37
39
40 private Object obj;
41 38
42 private EthBean emp; 39 private EthBean emp;
43 40
44 public EthLinux() { 41 public EthLinux() {
45 } 42 }
46 43
47 public void ApplyConfig (String eth, String p, Object v) { 44
48
49 ebs=(Vector<EthBean>)db.select();
50
51 if (!p.equals("object")) {
52
53 for(EthBean eb : ebs) {
54 if(eb.getName().equals(eth)) {
55
56 switch(p) {
57 case "dhcp": eb.setDhcp(Boolean.valueOf((String)v)); break;
58 case "ip": eb.setIp((String)v); break;
59 case "netmask": eb.setNetmask((String)v); break;
60 case "gateway": eb.setGateway((String)v); break;
61
62 default: break;
63 }
64 break;
65 }
66 }
67 }else {
68 obj = JsonReader.jsonToJava((String)json);
69 emp = (EthBean) obj;
70
71 for(EthBean eb : ebs) {
72 if(eb.getName().equals(emp.getName())) {
73
74 eb.setDhcp(emp.getDhcp());
75 eb.setIp(emp.getIp());
76 eb.setNetmask(emp.getNetmask());
77 eb.setGateway(emp.getGateway());
78 }
79 break;
80 }
81 }
82 Config(ebs);
83 }
84 45
85 /* 46 /*
86 * Список интерфейсов Ethernet на данном устройстве 47 * Список интерфейсов Ethernet на данном устройстве
...@@ -113,47 +74,7 @@ Config(ebs); ...@@ -113,47 +74,7 @@ Config(ebs);
113 return result; 74 return result;
114 } 75 }
115 76
116
117 public void PrintInfoByName(String name) {
118
119 ebs=(Vector<EthBean>)db.select();
120
121 for(EthBean eb : ebs) {
122
123 if(eb.getName().equals(name)) {
124
125 try {
126 extinfo=ce.Run("ifconfig"+" "+eb.getName());
127
128 mac=ce.Run("ifconfig"+" "+eb.getName()+" | grep HWaddr | awk '{ print $5}' ").firstElement();
129
130 eb.setInfo(extinfo);
131 eb.setMac(mac);
132
133 if (eb.getDhcp()) {
134
135 String addr=ce.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'").firstElement();
136 String mask=ce.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f4 | awk '{ print $1}'").firstElement();
137 String gateway=ce.Run("/sbin/route -n | grep 'UG' | awk '{print $2}'").firstElement();
138
139 eb.setIp(addr);
140 eb.setNetmask(mask);
141 eb.setGateway(gateway);
142 }
143
144 json = JsonWriter.objectToJson(eb);
145
146 System.out.println(json);
147 77
148 }catch(Exception e) {
149 log.error(e.getMessage());
150 }
151
152 }
153 }
154
155 }
156
157 78
158 79
159 80
......
...@@ -6,10 +6,7 @@ import java.util.Vector; ...@@ -6,10 +6,7 @@ import java.util.Vector;
6 import org.emercit.ethmanager.model.*; 6 import org.emercit.ethmanager.model.*;
7 7
8 public interface IEth { 8 public interface IEth {
9 9
10 public void ApplyConfig (String eth, String p, Object v);
11
12 public void PrintInfoByName(String name);
13 10
14 public void setDefaults(); 11 public void setDefaults();
15 12
......
...@@ -2,8 +2,12 @@ package org.emercit.projecttools.constants; ...@@ -2,8 +2,12 @@ package org.emercit.projecttools.constants;
2 2
3 public class Paths { 3 public class Paths {
4 4
5
6
5 private static final String dirBeans="/opt/apps/beans/"; 7 private static final String dirBeans="/opt/apps/beans/";
6 private static final String dirScripts="/opt/apps/scripts/"; 8 private static final String dirScripts="/opt/apps/scripts/";
9 private static final String dirInit_d="/etc/init.d";
10
7 11
8 //BEANS 12 //BEANS
9 public static final String BEAN_GSM=dirBeans+"GSMBean.xml"; 13 public static final String BEAN_GSM=dirBeans+"GSMBean.xml";
...@@ -12,10 +16,18 @@ public class Paths { ...@@ -12,10 +16,18 @@ public class Paths {
12 public static final String BEAN_DNS=dirBeans+"DnsBeans.xml"; 16 public static final String BEAN_DNS=dirBeans+"DnsBeans.xml";
13 public static final String BEAN_PROXY=dirBeans+"ProxyBeans.xml"; 17 public static final String BEAN_PROXY=dirBeans+"ProxyBeans.xml";
14 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";
15 20
16 //SCRIPTS 21 //SCRIPTS
17 public static final String FINDPROCESS_SCRIPT=dirScripts+"findprocess.sh"; 22 public static final String FINDPROCESS_SCRIPT=dirScripts+"findprocess.sh";
18 23
24 //PROCESS
25 public static final String PROC_JETTY=dirInit_d+"jetty";
26 public static final String PROC_CTRLPNL=dirInit_d+"ctrlpnl";
27 public static final String PROC_SNMPAGENT=dirInit_d+"snmpagent";
28 public static final String PROC_SNMPCLIENT=dirInit_d+"snmpclient";
29
30
19 31
20 32
21 } 33 }
......
...@@ -9,8 +9,7 @@ import java.util.Vector; ...@@ -9,8 +9,7 @@ import java.util.Vector;
9 import org.apache.log4j.Logger; 9 import org.apache.log4j.Logger;
10 import org.emercit.proxymanager.model.ProxyBean; 10 import org.emercit.proxymanager.model.ProxyBean;
11 11
12 import com.cedarsoftware.util.io.JsonReader; 12
13 import com.cedarsoftware.util.io.JsonWriter;
14 13
15 import org.emercit.xmldbmanager.service.Db; 14 import org.emercit.xmldbmanager.service.Db;
16 import org.emercit.projecttools.constants.Paths; 15 import org.emercit.projecttools.constants.Paths;
......
1 package org.emercit.servicemanager.model;
2
3
4
5
6 import java.io.Serializable;
7 import java.util.Vector;
8
9 public class SvBean implements Serializable {
10
11 private static final long serialVersionUID = 1L;
12
13 private int id;
14
15 private String process;
16
17 private boolean autostart;
18
19 private boolean isrun;
20
21
22 public SvBean() {
23
24 }
25
26
27 public int getId() {
28 return this.id;
29 }
30
31 public void setId(int value) {
32 this.id=value;
33 }
34
35 public boolean getAutostart() {
36 return autostart;
37 }
38
39 public void setAutostart(boolean value) {
40 this.autostart=value;
41 }
42
43 public boolean getIsrun() {
44 return isrun;
45 }
46
47 public void setIsrun(boolean value) {
48 this.isrun=value;
49 }
50
51 }
52
1 /**
2 *
3 */
4 /**
5 * @author root
6 *
7 */
8 package org.emercit.servicemanager.model;
...\ No newline at end of file ...\ No newline at end of file
1 package org.emercit.sshcmdexecutor; 1 package org.emercit.sshexec;
2 2
3 3
4 import java.util.Properties; 4 import java.util.Properties;
...@@ -14,9 +14,9 @@ import java.io.OutputStream; ...@@ -14,9 +14,9 @@ import java.io.OutputStream;
14 import org.apache.log4j.Logger; 14 import org.apache.log4j.Logger;
15 15
16 16
17 public class SSHCmdExecutor { 17 public class SSHExec {
18 18
19 private static final Logger log = Logger.getLogger(SSHCmdExecutor.class); 19 private static final Logger log = Logger.getLogger(SSHExec.class);
20 20
21 Properties config = new Properties(); 21 Properties config = new Properties();
22 22
...@@ -30,7 +30,7 @@ public class SSHCmdExecutor { ...@@ -30,7 +30,7 @@ public class SSHCmdExecutor {
30 30
31 private String cmd; 31 private String cmd;
32 32
33 public SSHCmdExecutor() { 33 public SSHExec() {
34 config.put("StrictHostKeyChecking", "no"); 34 config.put("StrictHostKeyChecking", "no");
35 } 35 }
36 36
......
1 package org.emercit.svmanager.service;
2
3 import org.emercit.servicemanager.model.SvBean;
4 import java.util.Vector;
5
6 public interface ISv {
7
8 public boolean isRun();
9
10 public void set(Vector<SvBean> m);
11
12 public Vector<SvBean> get();
13
14 }
1 package org.emercit.svmanager.service;
2
3 public enum ISvControl {
4
5 }
1 /**
2 *
3 */
4 /**
5 * @author root
6 *
7 */
8 package org.emercit.svmanager.service;
...\ No newline at end of file ...\ No newline at end of file
1 package org.emercit.projecttools; 1 package org.emercit.utilstools;
2
3 2
4 public class App 3 public class App
5 { 4 {
6 public static void main( String[] args ) 5 public static void main( String[] args )
7 { 6 {
8 System.out.println(" project tools !"); 7 System.out.println( "UtilsTools!" );
9 } 8 }
10 } 9 }
......
...@@ -11,6 +11,8 @@ import org.emercit.projecttools.constants.Paths; ...@@ -11,6 +11,8 @@ import org.emercit.projecttools.constants.Paths;
11 11
12 public class Db implements IDb { 12 public class Db implements IDb {
13 13
14
15
14 private String pathfile=null; 16 private String pathfile=null;
15 17
16 public Db(String path) { 18 public Db(String path) {
...@@ -59,6 +61,4 @@ public class Db implements IDb { ...@@ -59,6 +61,4 @@ public class Db implements IDb {
59 } 61 }
60 62
61 63
62
63
64 } 64 }
......
1 package org.emercit.devinfo; 1 package org.emercit.utilstools;
2 2
3 import junit.framework.Test; 3 import junit.framework.Test;
4 import junit.framework.TestCase; 4 import junit.framework.TestCase;
......