main
commit
79aa1678b2
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- You may freely edit this file. See commented blocks below for -->
|
||||||
|
<!-- some examples of how to customize the build. -->
|
||||||
|
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||||
|
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||||
|
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||||
|
<!-- the Compile on Save feature is turned off for the project. -->
|
||||||
|
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||||
|
<!-- in the project's Project Properties dialog box.-->
|
||||||
|
<project name="jNetLib" default="default" basedir=".">
|
||||||
|
<description>Builds, tests, and runs the project jNetLib.</description>
|
||||||
|
<import file="nbproject/build-impl.xml"/>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
There exist several targets which are by default empty and which can be
|
||||||
|
used for execution of your tasks. These targets are usually executed
|
||||||
|
before and after some main targets. They are:
|
||||||
|
|
||||||
|
-pre-init: called before initialization of project properties
|
||||||
|
-post-init: called after initialization of project properties
|
||||||
|
-pre-compile: called before javac compilation
|
||||||
|
-post-compile: called after javac compilation
|
||||||
|
-pre-compile-single: called before javac compilation of single file
|
||||||
|
-post-compile-single: called after javac compilation of single file
|
||||||
|
-pre-compile-test: called before javac compilation of JUnit tests
|
||||||
|
-post-compile-test: called after javac compilation of JUnit tests
|
||||||
|
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||||
|
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||||
|
-pre-jar: called before JAR building
|
||||||
|
-post-jar: called after JAR building
|
||||||
|
-post-clean: called after cleaning build products
|
||||||
|
|
||||||
|
(Targets beginning with '-' are not intended to be called on their own.)
|
||||||
|
|
||||||
|
Example of inserting an obfuscator after compilation could look like this:
|
||||||
|
|
||||||
|
<target name="-post-compile">
|
||||||
|
<obfuscate>
|
||||||
|
<fileset dir="${build.classes.dir}"/>
|
||||||
|
</obfuscate>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
For list of available properties check the imported
|
||||||
|
nbproject/build-impl.xml file.
|
||||||
|
|
||||||
|
|
||||||
|
Another way to customize the build is by overriding existing main targets.
|
||||||
|
The targets of interest are:
|
||||||
|
|
||||||
|
-init-macrodef-javac: defines macro for javac compilation
|
||||||
|
-init-macrodef-junit: defines macro for junit execution
|
||||||
|
-init-macrodef-debug: defines macro for class debugging
|
||||||
|
-init-macrodef-java: defines macro for class execution
|
||||||
|
-do-jar: JAR building
|
||||||
|
run: execution of project
|
||||||
|
-javadoc-build: Javadoc generation
|
||||||
|
test-report: JUnit report generation
|
||||||
|
|
||||||
|
An example of overriding the target for project execution could look like this:
|
||||||
|
|
||||||
|
<target name="run" depends="jNetLib-impl.jar">
|
||||||
|
<exec dir="bin" executable="launcher.exe">
|
||||||
|
<arg file="${dist.jar}"/>
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
Notice that the overridden target depends on the jar target and not only on
|
||||||
|
the compile target as the regular run target does. Again, for a list of available
|
||||||
|
properties which you can use, check the target you are overriding in the
|
||||||
|
nbproject/build-impl.xml file.
|
||||||
|
|
||||||
|
-->
|
||||||
|
</project>
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,8 @@
|
||||||
|
build.xml.data.CRC32=237f5361
|
||||||
|
build.xml.script.CRC32=83758712
|
||||||
|
build.xml.stylesheet.CRC32=f85dc8f2@1.113.0.48
|
||||||
|
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||||
|
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||||
|
nbproject/build-impl.xml.data.CRC32=237f5361
|
||||||
|
nbproject/build-impl.xml.script.CRC32=30659ce6
|
||||||
|
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.113.0.48
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
annotation.processing.enabled=true
|
||||||
|
annotation.processing.enabled.in.editor=false
|
||||||
|
annotation.processing.processors.list=
|
||||||
|
annotation.processing.run.all.processors=true
|
||||||
|
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||||
|
application.title=jNetLib
|
||||||
|
application.vendor=cucky
|
||||||
|
build.classes.dir=${build.dir}/classes
|
||||||
|
build.classes.excludes=**/*.java,**/*.form
|
||||||
|
# This directory is removed when the project is cleaned:
|
||||||
|
build.dir=build
|
||||||
|
build.generated.dir=${build.dir}/generated
|
||||||
|
build.generated.sources.dir=${build.dir}/generated-sources
|
||||||
|
# Only compile against the classpath explicitly listed here:
|
||||||
|
build.sysclasspath=ignore
|
||||||
|
build.test.classes.dir=${build.dir}/test/classes
|
||||||
|
build.test.results.dir=${build.dir}/test/results
|
||||||
|
# Uncomment to specify the preferred debugger connection transport:
|
||||||
|
#debug.transport=dt_socket
|
||||||
|
debug.classpath=\
|
||||||
|
${run.classpath}
|
||||||
|
debug.modulepath=\
|
||||||
|
${run.modulepath}
|
||||||
|
debug.test.classpath=\
|
||||||
|
${run.test.classpath}
|
||||||
|
debug.test.modulepath=\
|
||||||
|
${run.test.modulepath}
|
||||||
|
# Files in build.classes.dir which should be excluded from distribution jar
|
||||||
|
dist.archive.excludes=
|
||||||
|
# This directory is removed when the project is cleaned:
|
||||||
|
dist.dir=dist
|
||||||
|
dist.jar=${dist.dir}/jNetLib.jar
|
||||||
|
dist.javadoc.dir=${dist.dir}/javadoc
|
||||||
|
dist.jlink.dir=${dist.dir}/jlink
|
||||||
|
dist.jlink.output=${dist.jlink.dir}/jNetLib
|
||||||
|
endorsed.classpath=
|
||||||
|
excludes=
|
||||||
|
file.reference.apache-commons-configuration2-2.9.0.jar=C:\\Users\\cucky\\Documents\\NetBeansProjects\\jar_files\\apache-commons-configuration2-2.9.0.jar
|
||||||
|
file.reference.apache-commons-lang3-3.12.0.jar=C:\\Users\\cucky\\Documents\\NetBeansProjects\\jar_files\\apache-commons-lang3-3.12.0.jar
|
||||||
|
file.reference.apache-commons-logging-1.2.jar=C:\\Users\\cucky\\Documents\\NetBeansProjects\\jar_files\\apache-commons-logging-1.2.jar
|
||||||
|
file.reference.argon2-jvm-nolibs-2.11.jar=C:\\Users\\cucky\\Documents\\NetBeansProjects\\jar_files\\argon2-jvm-nolibs-2.11.jar
|
||||||
|
file.reference.spring-security-crypto-5.8.0.jar=C:\\Users\\cucky\\Documents\\NetBeansProjects\\jar_files\\spring-security-crypto-5.8.0.jar
|
||||||
|
includes=**
|
||||||
|
jar.compress=false
|
||||||
|
javac.classpath=\
|
||||||
|
${file.reference.apache-commons-configuration2-2.9.0.jar}:\
|
||||||
|
${file.reference.apache-commons-lang3-3.12.0.jar}:\
|
||||||
|
${file.reference.spring-security-crypto-5.8.0.jar}:\
|
||||||
|
${file.reference.apache-commons-logging-1.2.jar}:\
|
||||||
|
${file.reference.argon2-jvm-nolibs-2.11.jar}
|
||||||
|
# Space-separated list of extra javac options
|
||||||
|
javac.compilerargs=
|
||||||
|
javac.deprecation=false
|
||||||
|
javac.external.vm=true
|
||||||
|
javac.modulepath=
|
||||||
|
javac.processormodulepath=
|
||||||
|
javac.processorpath=\
|
||||||
|
${javac.classpath}
|
||||||
|
javac.source=23
|
||||||
|
javac.target=23
|
||||||
|
javac.test.classpath=\
|
||||||
|
${javac.classpath}:\
|
||||||
|
${build.classes.dir}
|
||||||
|
javac.test.modulepath=\
|
||||||
|
${javac.modulepath}
|
||||||
|
javac.test.processorpath=\
|
||||||
|
${javac.test.classpath}
|
||||||
|
javadoc.additionalparam=
|
||||||
|
javadoc.author=false
|
||||||
|
javadoc.encoding=${source.encoding}
|
||||||
|
javadoc.html5=false
|
||||||
|
javadoc.noindex=false
|
||||||
|
javadoc.nonavbar=false
|
||||||
|
javadoc.notree=false
|
||||||
|
javadoc.private=false
|
||||||
|
javadoc.splitindex=true
|
||||||
|
javadoc.use=true
|
||||||
|
javadoc.version=false
|
||||||
|
javadoc.windowtitle=
|
||||||
|
# The jlink additional root modules to resolve
|
||||||
|
jlink.additionalmodules=
|
||||||
|
# The jlink additional command line parameters
|
||||||
|
jlink.additionalparam=
|
||||||
|
jlink.launcher=true
|
||||||
|
jlink.launcher.name=jNetLib
|
||||||
|
meta.inf.dir=${src.dir}/META-INF
|
||||||
|
mkdist.disabled=true
|
||||||
|
platform.active=default_platform
|
||||||
|
run.classpath=\
|
||||||
|
${javac.classpath}:\
|
||||||
|
${build.classes.dir}
|
||||||
|
# Space-separated list of JVM arguments used when running the project.
|
||||||
|
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||||
|
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||||
|
run.jvmargs=
|
||||||
|
run.modulepath=\
|
||||||
|
${javac.modulepath}
|
||||||
|
run.test.classpath=\
|
||||||
|
${javac.test.classpath}:\
|
||||||
|
${build.test.classes.dir}
|
||||||
|
run.test.modulepath=\
|
||||||
|
${javac.test.modulepath}
|
||||||
|
source.encoding=UTF-8
|
||||||
|
src.dir=src
|
||||||
|
test.src.dir=test
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||||
|
<type>org.netbeans.modules.java.j2seproject</type>
|
||||||
|
<configuration>
|
||||||
|
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||||
|
<name>jNetLib</name>
|
||||||
|
<source-roots>
|
||||||
|
<root id="src.dir"/>
|
||||||
|
</source-roots>
|
||||||
|
<test-roots>
|
||||||
|
<root id="test.src.dir"/>
|
||||||
|
</test-roots>
|
||||||
|
</data>
|
||||||
|
</configuration>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package jnet.lib;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.jar.JarFile;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
|
||||||
|
public class BuilddDate {
|
||||||
|
|
||||||
|
public static Date get() {
|
||||||
|
Date d = null;
|
||||||
|
Class<?> currentClass = new Object() {
|
||||||
|
}.getClass().getEnclosingClass();
|
||||||
|
URL resource = currentClass.getResource(currentClass.getSimpleName() + ".class");
|
||||||
|
if (resource != null) {
|
||||||
|
if (resource.getProtocol().equals("file")) {
|
||||||
|
try {
|
||||||
|
d = new Date(new File(resource.toURI()).lastModified());
|
||||||
|
} catch (URISyntaxException ignored) {
|
||||||
|
}
|
||||||
|
} else if (resource.getProtocol().equals("jar")) {
|
||||||
|
String path = resource.getPath();
|
||||||
|
d = new Date(new File(path.substring(5, path.indexOf("!"))).lastModified());
|
||||||
|
} else if (resource.getProtocol().equals("zip")) {
|
||||||
|
String path = resource.getPath();
|
||||||
|
File jarFileOnDisk = new File(path.substring(0, path.indexOf("!")));
|
||||||
|
//long jfodLastModifiedLong = jarFileOnDisk.lastModified ();
|
||||||
|
//Date jfodLasModifiedDate = new Date(jfodLastModifiedLong);
|
||||||
|
try (JarFile jf = new JarFile(jarFileOnDisk)) {
|
||||||
|
ZipEntry ze = jf.getEntry(path.substring(path.indexOf("!") + 2));//Skip the ! and the /
|
||||||
|
long zeTimeLong = ze.getTime();
|
||||||
|
Date zeTimeDate = new Date(zeTimeLong);
|
||||||
|
d = zeTimeDate;
|
||||||
|
} catch (IOException | RuntimeException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package jnet.lib;
|
||||||
|
|
||||||
|
import jnet.lib.object.Event;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
public class EventComparator implements Comparator<Event> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Event t1, Event t2) {
|
||||||
|
/*
|
||||||
|
int fromResult = Long.compare(t1.getFrom(), t2.getFrom());
|
||||||
|
if (fromResult == 0) {
|
||||||
|
return fromResult;
|
||||||
|
}
|
||||||
|
//return fromResult;
|
||||||
|
|
||||||
|
return Long.compare(t1.getTo(), t2.getTo());
|
||||||
|
*/
|
||||||
|
return Long.compare(t1.getStart(), t2.getStart());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package jnet.lib;
|
||||||
|
|
||||||
|
import jnet.lib.object.Event;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
||||||
|
public class EventManager {
|
||||||
|
|
||||||
|
|
||||||
|
private ArrayList<Event> events;
|
||||||
|
|
||||||
|
public static Event startPingEvent(ArrayList<Event> events, int object) {
|
||||||
|
Instant now = Instant.now();
|
||||||
|
long time = now.toEpochMilli();
|
||||||
|
Event event = new Event(object,
|
||||||
|
time,
|
||||||
|
"Offline",
|
||||||
|
Event.TYPE_PING);
|
||||||
|
events.add(event);
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
package jnet.lib;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
public class LogFile {
|
||||||
|
|
||||||
|
// nazev souboru
|
||||||
|
private static final String outFile = "log.log";
|
||||||
|
// zapisovat i log do console
|
||||||
|
private static boolean consoleLog = true;
|
||||||
|
// format datumu a casu
|
||||||
|
private static String dateFormat = "dd.MM.YY HH:m:ss";
|
||||||
|
// debug rezim
|
||||||
|
private static boolean debug = false;
|
||||||
|
|
||||||
|
private static File out = new File(outFile);
|
||||||
|
|
||||||
|
private static final DateFormat df = new SimpleDateFormat(dateFormat);
|
||||||
|
|
||||||
|
private static void write(Object text, boolean line) {
|
||||||
|
|
||||||
|
String date = df.format(new Date());
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!out.exists()) {
|
||||||
|
out.createNewFile();
|
||||||
|
}
|
||||||
|
PrintWriter pwOut = new PrintWriter(new FileOutputStream(out, true), true);
|
||||||
|
pwOut.print(date);
|
||||||
|
pwOut.write("\t");
|
||||||
|
if (line) {
|
||||||
|
pwOut.println(text);
|
||||||
|
} else {
|
||||||
|
pwOut.print(text);
|
||||||
|
}
|
||||||
|
pwOut.close();
|
||||||
|
|
||||||
|
LogWindow.addRow(date + "\t" + text.toString());
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.getLogger(LogFile.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void printErr(String line) {
|
||||||
|
write("E\t" + line, true);
|
||||||
|
if (consoleLog) {
|
||||||
|
System.err.println(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void printInfo(String line) {
|
||||||
|
write("I\t" + line, true);
|
||||||
|
if (consoleLog) {
|
||||||
|
System.out.println(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void printDebug(String line) {
|
||||||
|
write("D\t" + line, true);
|
||||||
|
if (debug) {
|
||||||
|
if (consoleLog) {
|
||||||
|
System.out.println(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clear() {
|
||||||
|
try {
|
||||||
|
out.delete();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.getLogger(LogFile.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDebug(boolean b) {
|
||||||
|
debug = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
package jnet.lib;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTextArea;
|
||||||
|
|
||||||
|
|
||||||
|
public class LogWindow {
|
||||||
|
|
||||||
|
private JFrame frame = new JFrame("Log aplikace");
|
||||||
|
private static JTextArea logTextArea = new JTextArea();
|
||||||
|
|
||||||
|
public LogWindow() {
|
||||||
|
// Vytvoření hlavního okna
|
||||||
|
|
||||||
|
frame.setSize(1000, 600);
|
||||||
|
|
||||||
|
// Nastavení, že okno bude spuštěno minimalizované
|
||||||
|
frame.setExtendedState(JFrame.ICONIFIED); // Minimalizované okno
|
||||||
|
|
||||||
|
// Přidání vlastního chování při zavření okna
|
||||||
|
frame.addWindowListener(new WindowAdapter() {
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e) {
|
||||||
|
// Můžete přidat vlastní logiku (např. skrytí okna místo jeho zavření)
|
||||||
|
//frame.setVisible(false); // Skrytí okna místo zavření
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Hlavní panel
|
||||||
|
JPanel mainPanel = new JPanel(new BorderLayout());
|
||||||
|
|
||||||
|
// Textová oblast pro logy
|
||||||
|
|
||||||
|
logTextArea.setEditable(false); // Zamezení úprav uživatelem
|
||||||
|
logTextArea.setFont(new Font("Monospaced", Font.PLAIN, 12)); // Monospace font pro logy
|
||||||
|
|
||||||
|
// Posuvník pro textovou oblast
|
||||||
|
JScrollPane scrollPane = new JScrollPane(logTextArea);
|
||||||
|
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
|
||||||
|
|
||||||
|
// Přidání scrollovacího panelu do hlavního panelu
|
||||||
|
mainPanel.add(scrollPane, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
// Přidání hlavního panelu do okna
|
||||||
|
frame.add(mainPanel);
|
||||||
|
|
||||||
|
// Zobrazení okna
|
||||||
|
frame.setVisible(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addRow(String msg){
|
||||||
|
logTextArea.append(msg + "\n");
|
||||||
|
|
||||||
|
// Automatické posunutí na konec
|
||||||
|
logTextArea.setCaretPosition(logTextArea.getDocument().getLength());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package jnet.lib;
|
||||||
|
|
||||||
|
import jnet.lib.object.Map;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
|
||||||
|
public class MapComparator implements Comparator<Map> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Map obj1, Map obj2) {
|
||||||
|
return obj1.getName().compareTo(obj2.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,135 @@
|
||||||
|
package jnet.lib;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author cucky
|
||||||
|
*/
|
||||||
|
public class Message implements Serializable {
|
||||||
|
|
||||||
|
// S->C: dotaz na verzi klient
|
||||||
|
// C->S: odeslána verze klienta
|
||||||
|
public static final int CLIENT_VERSION = 1;
|
||||||
|
|
||||||
|
// S->C: server odesila klientovi pokyn k updatu
|
||||||
|
public static final int UPDATE = 2;
|
||||||
|
|
||||||
|
// S->C: server posila pozadavek na autorizaci klienta
|
||||||
|
public static final int AUTH_REQUEST = 3;
|
||||||
|
|
||||||
|
// C->S: klient odesila autorizacni udaje
|
||||||
|
public static final int AUTH = 4;
|
||||||
|
|
||||||
|
// S->C: server odesila informaci o uspesnem prihlaseni klienta
|
||||||
|
public static final int AUTH_SUCEFULL = 5;
|
||||||
|
|
||||||
|
// S->C: server odesila informaci o neuspesnem prihlaseni klienta
|
||||||
|
public static final int AUTH_FAIL = 6;
|
||||||
|
|
||||||
|
// S->C: server odesila seznam pripojenych klientu
|
||||||
|
public static final int ONLINE_CLIENTS = 7;
|
||||||
|
|
||||||
|
// S->C: server posila typ objektu
|
||||||
|
public static final int OBJECT_TYPE = 8;
|
||||||
|
|
||||||
|
// S->C server odesila informace o prihlasenem uzivateli
|
||||||
|
public static final int USER_INFO = 9;
|
||||||
|
|
||||||
|
// C->S: klient odesíla novy typ objektu
|
||||||
|
public static final int NEW_OBJECT_TYPE = 10;
|
||||||
|
|
||||||
|
// S->C: odesila uzivatele
|
||||||
|
// C->S: klient pridává ukživatele
|
||||||
|
public static final int USER = 11;
|
||||||
|
|
||||||
|
// C->S: klietn posila udaje upraveneho uzivatele
|
||||||
|
public static final int USER_EDIT = 12;
|
||||||
|
|
||||||
|
// S->C: server posila nastaveni serveru
|
||||||
|
// C->S: klient odesila upravu serveru
|
||||||
|
public static final int SERVER_CONFIG = 13;
|
||||||
|
|
||||||
|
//S->C: server odesila seznam objektu
|
||||||
|
public static final int OBJECT_LIST = 14;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// S->C: server posila mapu
|
||||||
|
public static final int MAP = 100;
|
||||||
|
|
||||||
|
// S->C: server posila aktualizace statusu
|
||||||
|
public static final int STATUS_UPDATE = 101;
|
||||||
|
|
||||||
|
// C->S: klient posila nove souradnice objektu
|
||||||
|
public static final int OBJECT_MOVE = 102;
|
||||||
|
|
||||||
|
// C->S: klient posila zmenu zamku mapy
|
||||||
|
public static final int SET_MAP_LOCK = 103;
|
||||||
|
|
||||||
|
// C->S: klient posila informaci o smazání objektu
|
||||||
|
// S->C: server předává informaci o odebrání objektu
|
||||||
|
public static final int REMOVE_OBJECT = 104;
|
||||||
|
|
||||||
|
// C->S: klient odesílá nově přidaný objekt
|
||||||
|
// S->C: server odesila klientum nově přidany objekt
|
||||||
|
public static final int ADD_OBJECT = 105;
|
||||||
|
|
||||||
|
// C->S: klient odesíla upravený objekt
|
||||||
|
public static final int UPDATE_OBJECT = 106;
|
||||||
|
|
||||||
|
// S->C: server odesila SNMP profil
|
||||||
|
public static final int SNMP_PROFILE = 107;
|
||||||
|
|
||||||
|
// S->C: server odesila novy event
|
||||||
|
public static final int EVENT_NEW = 108;
|
||||||
|
|
||||||
|
// S->C: server odesila aktualizaci eventu
|
||||||
|
public static final int EVENT_UPDATE = 109;
|
||||||
|
|
||||||
|
// S->C server odesilam seznam udalosti
|
||||||
|
public static final int EVENT_LIST = 110;
|
||||||
|
|
||||||
|
// C->S: klient odebira mapu
|
||||||
|
// S->C: server předává informaci o odebrani mapy
|
||||||
|
public static final int MAP_REMOVE = 111;
|
||||||
|
|
||||||
|
// C->S: klient pridava mapu
|
||||||
|
public static final int MAP_ADD = 112;
|
||||||
|
|
||||||
|
// C->S: klient posila požadavek na smazaní udalostí
|
||||||
|
public static final int DELETE_LOG = 113;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private int type;
|
||||||
|
private Object msg;
|
||||||
|
|
||||||
|
public Message(int type, Object msg) {
|
||||||
|
this.type = type;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(Object msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package jnet.lib;
|
||||||
|
|
||||||
|
public class OSValidator {
|
||||||
|
|
||||||
|
private static String OS = System.getProperty("os.name").toLowerCase();
|
||||||
|
|
||||||
|
public static boolean isWindows() {
|
||||||
|
|
||||||
|
return (OS.indexOf("win") >= 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isMac() {
|
||||||
|
|
||||||
|
return (OS.indexOf("mac") >= 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isUnix() {
|
||||||
|
|
||||||
|
return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSolaris() {
|
||||||
|
|
||||||
|
return (OS.indexOf("sunos") >= 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package jnet.lib;
|
||||||
|
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hash hesla a jeho kontrola
|
||||||
|
* vyžaduje knihovnu spring-security-crypto-5.8.0.jar a apache-commons-logging-1.2.jar
|
||||||
|
* @author cucky
|
||||||
|
*/
|
||||||
|
public class PasswordHashing {
|
||||||
|
|
||||||
|
|
||||||
|
public static String hash(String string){
|
||||||
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
|
return passwordEncoder.encode(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean verify(String rawPassword, String hashedPassword){
|
||||||
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
|
return passwordEncoder.matches(rawPassword, hashedPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static String hash(String password){
|
||||||
|
// Argon2 argon2 = Argon2Factory.create();
|
||||||
|
// String hash = argon2.hash(10, 65536, 1, password);
|
||||||
|
// return hash;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static boolean verify(String rawPassword, String hashedPassword){
|
||||||
|
// Argon2 argon2 = Argon2Factory.create();
|
||||||
|
// return argon2.verify(hashedPassword, rawPassword);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
package jnet.lib;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import org.apache.commons.configuration2.PropertiesConfiguration;
|
||||||
|
import org.apache.commons.configuration2.ex.ConfigurationException;
|
||||||
|
|
||||||
|
public class PropertiesManager {
|
||||||
|
|
||||||
|
private PropertiesConfiguration config;
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
// Konstruktor pro inicializaci s cestou k souboru
|
||||||
|
public PropertiesManager(String filePath) {
|
||||||
|
this.filePath = filePath;
|
||||||
|
this.config = new PropertiesConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load() throws FileException, ConfigException {
|
||||||
|
try {
|
||||||
|
// Načtení existující konfigurace, pokud soubor existuje
|
||||||
|
config.read(new FileReader(filePath));
|
||||||
|
} catch (ConfigurationException ex) {
|
||||||
|
throw new ConfigException("Chyba konfigurace");
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new FileException("Chybný soubor");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metoda pro čtení hodnoty podle klíče
|
||||||
|
private String getProperty(String key) {
|
||||||
|
return config.getString(key, null); // Vrací null pokud klíč neexistuje
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metoda pro nastavení hodnoty podle klíče
|
||||||
|
private void setProperty(String key, String value) {
|
||||||
|
config.setProperty(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metoda pro uložení konfigurace do souboru
|
||||||
|
public void save() {
|
||||||
|
try (FileWriter writer = new FileWriter(filePath)) {
|
||||||
|
// Použití FileWriter pro zápis do souboru
|
||||||
|
config.write(writer);
|
||||||
|
LogFile.printInfo("Konfigurace byla uspesne ulozena.");
|
||||||
|
} catch (IOException | ConfigurationException e) {
|
||||||
|
LogFile.printErr("Chyba pri ukladani konfigurace. " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metoda pro výpis všech klíčů a hodnot v konfiguraci
|
||||||
|
// public void printAllProperties() {
|
||||||
|
// Iterator<String> keys = config.getKeys();
|
||||||
|
// while (keys.hasNext()) {
|
||||||
|
// String key = keys.next();
|
||||||
|
// System.out.println(key + " = " + config.getString(key));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
public boolean getBoolean(String key) {
|
||||||
|
return Boolean.valueOf(getProperty(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getString(String key) {
|
||||||
|
return getProperty(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInt(String key) {
|
||||||
|
return Integer.parseInt(getProperty(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBoolean(String key, Boolean value) {
|
||||||
|
setProperty(key, value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInt(String key, int value) {
|
||||||
|
setProperty(key, String.valueOf(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setString(String key, String value) {
|
||||||
|
setProperty(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileException extends Exception {
|
||||||
|
|
||||||
|
public FileException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ConfigException extends Exception {
|
||||||
|
|
||||||
|
public ConfigException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package jnet.lib;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
public class Status implements Serializable {
|
||||||
|
|
||||||
|
public static final int NA = 0;
|
||||||
|
public static final int OK = 1;
|
||||||
|
public static final int WARNING = 2;
|
||||||
|
public static final int OFFLINE = 3;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
package jnet.lib.object;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
public class Event implements Serializable{
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private int object;
|
||||||
|
private long start;
|
||||||
|
private long end;
|
||||||
|
private String description;
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
public static final int TYPE_PING = 1;
|
||||||
|
public static final int TYPE_SNMP = 2;
|
||||||
|
public static final int TYPE_INFO = 3;
|
||||||
|
public static final int TYPE_PING_OFF = 4;
|
||||||
|
|
||||||
|
public Event(int id, int object, long start, long end, String description, int type) {
|
||||||
|
this.id = id;
|
||||||
|
this.object = object;
|
||||||
|
this.start = start;
|
||||||
|
this.end = end;
|
||||||
|
this.description = description;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event(int object, long start, String description, int type) {
|
||||||
|
this.object = object;
|
||||||
|
this.start = start;
|
||||||
|
this.description = description;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getObject() {
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObject(int object) {
|
||||||
|
this.object = object;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getStart() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStart(long start) {
|
||||||
|
this.start = start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getEnd() {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnd(long end) {
|
||||||
|
this.end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
package jnet.lib.object;
|
||||||
|
|
||||||
|
import jnet.lib.Status;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author cucky
|
||||||
|
*/
|
||||||
|
public class Map implements Serializable {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private boolean lock;
|
||||||
|
//private ArrayList<MapObject> objects;
|
||||||
|
private int status;
|
||||||
|
|
||||||
|
public Map(int id, String name, boolean lock) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.lock = lock;
|
||||||
|
this.status = Status.NA;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map(String name) {
|
||||||
|
this.name = name;
|
||||||
|
this.lock = false;
|
||||||
|
this.status = Status.NA;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLock() {
|
||||||
|
return lock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLock(boolean lock) {
|
||||||
|
this.lock = lock;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,333 @@
|
||||||
|
package jnet.lib.object;
|
||||||
|
|
||||||
|
import jnet.lib.Status;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class MapObject implements Serializable {
|
||||||
|
|
||||||
|
private int map;
|
||||||
|
private int status;
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private int objectType;
|
||||||
|
private String ip;
|
||||||
|
private int x;
|
||||||
|
private int y;
|
||||||
|
private String user;
|
||||||
|
private String password;
|
||||||
|
private boolean enablePing;
|
||||||
|
private String description;
|
||||||
|
private String location;
|
||||||
|
private int snmpProfile;
|
||||||
|
private ArrayList<SnmpProbe> snmpProbe;
|
||||||
|
private boolean active;
|
||||||
|
public int pingAttemp;
|
||||||
|
private boolean winbox;
|
||||||
|
private String winboxPort;
|
||||||
|
private boolean ssh;
|
||||||
|
private String sshPort;
|
||||||
|
private boolean web;
|
||||||
|
private String webPort;
|
||||||
|
private int webVerze;
|
||||||
|
private boolean telnet;
|
||||||
|
private String telnetPort;
|
||||||
|
private boolean sms;
|
||||||
|
private String smsPort;
|
||||||
|
private int smsVerze;
|
||||||
|
|
||||||
|
public MapObject(int id,
|
||||||
|
String name,
|
||||||
|
int map,
|
||||||
|
int objectType,
|
||||||
|
String ip,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
String user,
|
||||||
|
String password,
|
||||||
|
String description,
|
||||||
|
String location,
|
||||||
|
int snmpProfile,
|
||||||
|
ArrayList<SnmpProbe> snmpProbe,
|
||||||
|
boolean active,
|
||||||
|
boolean winbox,
|
||||||
|
String winboxPort,
|
||||||
|
boolean ssh,
|
||||||
|
String sshPort,
|
||||||
|
boolean web,
|
||||||
|
String webPort,
|
||||||
|
int webVerze,
|
||||||
|
boolean telnet,
|
||||||
|
String telnetPort,
|
||||||
|
boolean sms,
|
||||||
|
String smsPort,
|
||||||
|
int smsVerze
|
||||||
|
) {
|
||||||
|
this.status = Status.NA;
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.map = map;
|
||||||
|
this.objectType = objectType;
|
||||||
|
this.ip = ip;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.user = user;
|
||||||
|
this.password = password;
|
||||||
|
this.description = description;
|
||||||
|
this.location = location;
|
||||||
|
this.snmpProfile = snmpProfile;
|
||||||
|
this.snmpProbe = snmpProbe;
|
||||||
|
this.active = active;
|
||||||
|
this.winbox = winbox;
|
||||||
|
this.winboxPort = winboxPort;
|
||||||
|
this.ssh = ssh;
|
||||||
|
this.sshPort = sshPort;
|
||||||
|
this.web = web;
|
||||||
|
this.webPort = webPort;
|
||||||
|
this.webVerze = webVerze;
|
||||||
|
this.telnet = telnet;
|
||||||
|
this.telnetPort = telnetPort;
|
||||||
|
this.sms = sms;
|
||||||
|
this.smsPort = smsPort;
|
||||||
|
this.smsVerze = smsVerze;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapObject() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMap() {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMap(int map) {
|
||||||
|
this.map = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(int status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getObjectType() {
|
||||||
|
return objectType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjectType(int objectType) {
|
||||||
|
this.objectType = objectType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIp() {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIp(String ip) {
|
||||||
|
this.ip = ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setX(int x) {
|
||||||
|
this.x = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getY() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setY(int y) {
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(String user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEnablePing() {
|
||||||
|
return enablePing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnablePing(boolean enablePing) {
|
||||||
|
this.enablePing = enablePing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocation(String location) {
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSnmpProfile() {
|
||||||
|
return snmpProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSnmpProfile(int snmpProfile) {
|
||||||
|
this.snmpProfile = snmpProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<SnmpProbe> getSnmpProbe() {
|
||||||
|
return snmpProbe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSnmpProbe(ArrayList<SnmpProbe> snmpProbe) {
|
||||||
|
this.snmpProbe = snmpProbe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActive(boolean active) {
|
||||||
|
this.active = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPingAttemp() {
|
||||||
|
return pingAttemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPingAttemp(int pingAttemp) {
|
||||||
|
this.pingAttemp = pingAttemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWinbox() {
|
||||||
|
return winbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWinbox(boolean winbox) {
|
||||||
|
this.winbox = winbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWinboxPort() {
|
||||||
|
return winboxPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWinboxPort(String winboxPort) {
|
||||||
|
this.winboxPort = winboxPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSsh() {
|
||||||
|
return ssh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSsh(boolean ssh) {
|
||||||
|
this.ssh = ssh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSshPort() {
|
||||||
|
return sshPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSshPort(String sshPort) {
|
||||||
|
this.sshPort = sshPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWeb() {
|
||||||
|
return web;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeb(boolean web) {
|
||||||
|
this.web = web;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWebPort() {
|
||||||
|
return webPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWebPort(String webPort) {
|
||||||
|
this.webPort = webPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWebVerze() {
|
||||||
|
return webVerze;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWebVerze(int webVerze) {
|
||||||
|
this.webVerze = webVerze;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTelnet() {
|
||||||
|
return telnet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTelnet(boolean telnet) {
|
||||||
|
this.telnet = telnet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTelnetPort() {
|
||||||
|
return telnetPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTelnetPort(String telnetPort) {
|
||||||
|
this.telnetPort = telnetPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSms() {
|
||||||
|
return sms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSms(boolean sms) {
|
||||||
|
this.sms = sms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSmsPort() {
|
||||||
|
return smsPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmsPort(String smsPort) {
|
||||||
|
this.smsPort = smsPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSmsVerze() {
|
||||||
|
return smsVerze;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmsVerze(int smsVerze) {
|
||||||
|
this.smsVerze = smsVerze;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package jnet.lib.object;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
public class ObjectType implements Serializable{
|
||||||
|
|
||||||
|
int id;
|
||||||
|
String name;
|
||||||
|
String imgStr;
|
||||||
|
|
||||||
|
public ObjectType(int id, String name, String imgStr) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.imgStr = imgStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectType(String name, String imgStr) {
|
||||||
|
this.name = name;
|
||||||
|
this.imgStr = imgStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImgStr() {
|
||||||
|
return imgStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImgStr(String imgStr) {
|
||||||
|
this.imgStr = imgStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package jnet.lib.object;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
public class OnlineClients implements Serializable{
|
||||||
|
|
||||||
|
public static final int PLATFORM_PC = 1;
|
||||||
|
public static final int PLATFORM_MOBILE = 2;
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String username;
|
||||||
|
private String ip;
|
||||||
|
private String port;
|
||||||
|
private int platform;
|
||||||
|
|
||||||
|
public OnlineClients(String id, String username, String ip, String port, int platform) {
|
||||||
|
this.id = id;
|
||||||
|
this.username = username;
|
||||||
|
this.ip = ip;
|
||||||
|
this.port = port;
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIp() {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIp(String ip) {
|
||||||
|
this.ip = ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatform(int platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPort() {
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPort(String port) {
|
||||||
|
this.port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
package jnet.lib.object;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class ServerConfig implements Serializable {
|
||||||
|
|
||||||
|
private int pingAttempt;
|
||||||
|
private int pingTimeout;
|
||||||
|
private int instabilityAttempt;
|
||||||
|
private int instabilityLimit;
|
||||||
|
|
||||||
|
public ServerConfig(int pingAttempt, int pingTimeout, int instabilityAttempt, int instabilityLimit) {
|
||||||
|
this.pingAttempt = pingAttempt;
|
||||||
|
this.pingTimeout = pingTimeout;
|
||||||
|
this.instabilityAttempt = instabilityAttempt;
|
||||||
|
this.instabilityLimit = instabilityLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPingAttempt() {
|
||||||
|
return pingAttempt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPingAttempt(int pingAttempt) {
|
||||||
|
this.pingAttempt = pingAttempt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPingTimeout() {
|
||||||
|
return pingTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPingTimeout(int pingTimeout) {
|
||||||
|
this.pingTimeout = pingTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInstabilityAttempt() {
|
||||||
|
return instabilityAttempt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInstabilityAttempt(int instabilityAttempt) {
|
||||||
|
this.instabilityAttempt = instabilityAttempt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInstabilityLimit() {
|
||||||
|
return instabilityLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInstabilityLimit(int instabilityLimit) {
|
||||||
|
this.instabilityLimit = instabilityLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package jnet.lib.object;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
public class SnmpProbe implements Serializable {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private int objId;
|
||||||
|
|
||||||
|
public SnmpProbe(int id, String name, int objId) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.objId = objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getObjId() {
|
||||||
|
return objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjId(int objId) {
|
||||||
|
this.objId = objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
package jnet.lib.object;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
public class SnmpProfile implements Serializable {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private int version;
|
||||||
|
private String port;
|
||||||
|
private String communityRead;
|
||||||
|
private String communityWrite;
|
||||||
|
|
||||||
|
public SnmpProfile(int id, String name, int version, String port, String communityRead, String communityWrite) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.version = version;
|
||||||
|
this.port = port;
|
||||||
|
this.communityRead = communityRead;
|
||||||
|
this.communityWrite = communityWrite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SnmpProfile() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(int version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPort() {
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPort(String port) {
|
||||||
|
this.port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCommunityRead() {
|
||||||
|
return communityRead;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommunityRead(String communityRead) {
|
||||||
|
this.communityRead = communityRead;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCommunityWrite() {
|
||||||
|
return communityWrite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommunityWrite(String communityWrite) {
|
||||||
|
this.communityWrite = communityWrite;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
package jnet.lib.object;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
public class User implements Serializable {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private boolean addMap;
|
||||||
|
private boolean removeMap;
|
||||||
|
private boolean editMap;
|
||||||
|
private boolean addObject;
|
||||||
|
private boolean removeObject;
|
||||||
|
private boolean editObject;
|
||||||
|
private boolean editServer;
|
||||||
|
|
||||||
|
public User(int id, String username, String password, boolean addMap, boolean removeMap, boolean editMap, boolean addObject, boolean removeObject, boolean editObject, boolean editServer) {
|
||||||
|
this.id = id;
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
this.addMap = addMap;
|
||||||
|
this.removeMap = removeMap;
|
||||||
|
this.editMap = editMap;
|
||||||
|
this.addObject = addObject;
|
||||||
|
this.removeObject = removeObject;
|
||||||
|
this.editObject = editObject;
|
||||||
|
this.editServer = editServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAddMap() {
|
||||||
|
return addMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddMap(boolean addMap) {
|
||||||
|
this.addMap = addMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRemoveMap() {
|
||||||
|
return removeMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemoveMap(boolean removeMap) {
|
||||||
|
this.removeMap = removeMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEditMap() {
|
||||||
|
return editMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEditMap(boolean editMap) {
|
||||||
|
this.editMap = editMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAddObject() {
|
||||||
|
return addObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddObject(boolean addObject) {
|
||||||
|
this.addObject = addObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRemoveObject() {
|
||||||
|
return removeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemoveObject(boolean removeObject) {
|
||||||
|
this.removeObject = removeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEditObject() {
|
||||||
|
return editObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEditObject(boolean editObject) {
|
||||||
|
this.editObject = editObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEditServer() {
|
||||||
|
return editServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEditServer(boolean editServer) {
|
||||||
|
this.editServer = editServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue