collection = ctx.getLoggers();
+ return collection;
+ }
+
+ public boolean getDebug() { return isDebug; }
+
+ /**
+ * Get's name of Logger (Class)
+ *
+ * @return loggername
+ *
+ */
+ public String getLoggerName() { return LOGGER.getName(); }
+
+ /**
+ *
+ * @return
+ * Current loggedin User
+ */
+ public String getUser() { return user; }
+
+ /**
+ * Logs entry to a method. Used when the method in question has no parameters or when the parameters should not belogged.
+ *
+ * SOURCE: SYSTEM
+ */
+ public void logEntry() {
+ setMethod();
+ setParam("SOURCE", Log4j2Source.SYSTEM.name());
+ LOGGER.traceEntry();
+ }
+
+ /**
+ * Logs exit from a method. Used for methods that do not return anything.
+ *
+ * SOURCE: SYSTEM
+ */
+ public void logExit() {
+ setMethod();
+ setParam("SOURCE", Log4j2Source.SYSTEM.name());
+ LOGGER.traceExit();
+ }
+
+ /**
+ * Logs a message object with the given level.
+ *
+ * @param logLevel
+ * TRACE / DEBUG / INFO / WARN / ERROR / FATAL
+ * @param log4j2Source
+ * DATABASE / SYSTEM / PROGRAM / TOOLS
+ * @param msg
+ * Optional Message
+ */
+ public void log(Level logLevel, Log4j2Source log4j2Source, String msg) {
+ setMethod();
+ setUsername(getUser());
+ setParam("SOURCE", log4j2Source.name());
+ LOGGER.log(logLevel, msg);
+ }
+
+ /**
+ * Logs a message object with the given level.
+ *
+ * @param logLevel
+ * TRACE / DEBUG / INFO / WARN / ERROR / FATAL
+ * @param log4j2Source
+ * DATABASE / SYSTEM / PROGRAM / TOOLS
+ * @param exception
+ * Thrown Exeption
+ */
+ public void log(Level logLevel, Log4j2Source log4j2Source, Exception exception) {
+ setMethod(exception);
+ setUsername(getUser());
+ setParam("SOURCE", log4j2Source.name());
+ LOGGER.log(logLevel, subExceptionMsg(ExceptionWriter(exception)));
+ }
+
+ /**
+ * Logs a message object with the given level.
+ *
+ * @param logLevel
+ * TRACE / DEBUG / INFO / WARN / ERROR / FATAL
+ * @param log4j2Source
+ * DATABASE / SYSTEM / PROGRAM / TOOLS
+ * @param exception
+ * Thrown Exeption
+ * @param msg
+ * Optional Message
+ *
+ */
+ public void log(Level logLevel, Log4j2Source log4j2Source, Exception exception, String msg) {
+ setMethod(exception);
+ setUsername(getUser());
+ setParam("SOURCE", log4j2Source.name());
+ LOGGER.log(logLevel, msg, subExceptionMsg(ExceptionWriter(exception)));
+ }
+
+ /**
+ * Logs a message object with the given level.
+ *
+ * @param logLevel
+ * TRACE / DEBUG / INFO / WARN / ERROR / FATAL
+ * @param log4j2Source
+ * DATABASE / SYSTEM / PROGRAM / TOOLS
+ * @param obj
+ * Does object.toString()
+ *
+ */
+ public void log(Level logLevel, Log4j2Source log4j2Source, Object obj) {
+ setMethod();
+ setUsername(getUser());
+ setParam("SOURCE", log4j2Source.name());
+ LOGGER.log(logLevel, obj);
+ }
+
+ /**
+ *
+ * Logs a message object with the given level.
+ * Send Mail even if email = null, else only to the Mail who specified
+ *
+ * @param logLevel
+ * TRACE / DEBUG / INFO / WARN / ERROR / FATAL
+ * @param log4j2Source
+ * DATABASE / SYSTEM / PROGRAM / TOOLS
+ * @param msg
+ * Optional Message
+ * @param exception
+ * Thrown Exeption
+ * @param emails
+ */
+ public void log(Level logLevel, Log4j2Source log4j2Source, String msg, Exception exception, String[] emails) {
+// setMethod(exception);
+// setUsername(getUser());
+// setParam("SOURCE", log4j2Source.name());
+// if (msg == null) {
+// LOGGER.log(logLevel, ExceptionWriter(exception));
+// if (emails != null) {
+// sendMail(logLevel, log4j2Source, prettyExceptionEmail(subExceptionMsg(ExceptionWriter(exception))), emails, null);
+// }
+// else {
+// sendMail(logLevel, log4j2Source, prettyExceptionEmail(subExceptionMsg(ExceptionWriter(exception))), new String[0], null);
+// }
+// }
+// else if (msg.equals("") || msg.equals(exception.getMessage())) {
+// LOGGER.log(logLevel, ExceptionWriter(exception));
+// if (emails != null) {
+// sendMail(logLevel, log4j2Source, prettyExceptionEmail(subExceptionMsg(ExceptionWriter(exception))), emails, null);
+// }
+// else {
+// sendMail(logLevel, log4j2Source, prettyExceptionEmail(subExceptionMsg(ExceptionWriter(exception))), new String[0], null);
+// }
+// }
+// else {
+// LOGGER.log(logLevel, msg, exception);
+// if (emails != null) {
+// sendMail(logLevel, log4j2Source, prettyExceptionEmail(subExceptionMsg(ExceptionWriter(exception))), subExceptionMsg(msg), emails, null);
+// }
+// else {
+// sendMail(logLevel, log4j2Source, prettyExceptionEmail(subExceptionMsg(ExceptionWriter(exception))), subExceptionMsg(msg), new String[0], null);
+// }
+// }
+ }
+
+ /**
+ * Logs a message object with the given level.
+ *
+ * @param logLevel
+ * TRACE / DEBUG / INFO / WARN / ERROR / FATAL
+ * @param log4j2Source
+ * DATABASE / SYSTEM / PROGRAM / TOOLS
+ * @param exception
+ * Thrown Exeption
+ *
+ */
+ public void log(Level logLevel, Log4j2Source log4j2Source, Throwable throwable) {
+ setMethod(throwable);
+ setUsername(getUser());
+ setParam("SOURCE", log4j2Source.name());
+ LOGGER.log(logLevel, subExceptionMsg(ExceptionWriter(throwable)));
+ }
+
+ /**
+ * Logs a message object with the given level.
+ * Ignores msg if null
+ *
+ * @param logLevel
+ * TRACE / DEBUG / INFO / WARN / ERROR / FATAL
+ * @param log4j2Source
+ * DATABASE / SYSTEM / PROGRAM / TOOLS
+ * @param msg
+ * Optional Message
+ * @param throwable
+ * Throwable
+ */
+ public void log(Level logLevel, Log4j2Source log4j2Source, String msg, Throwable throwable) {
+ setMethod(throwable);
+ setUsername(getUser());
+ setParam("SOURCE", log4j2Source.name());
+ if (msg == null) {
+ LOGGER.log(logLevel, subExceptionMsg(ExceptionWriter(throwable)));
+ }
+ LOGGER.log(logLevel, msg, throwable);
+ }
+
+ /**
+ *
+ * Logs a message object with the given level.
+ * Send Mail even if email = null, else only to the Mail who specified
+ *
+ * @param logLevel
+ * TRACE / DEBUG / INFO / WARN / ERROR / FATAL
+ * @param log4j2Source
+ * DATABASE / SYSTEM / PROGRAM / TOOLS
+ * @param msg
+ * Optional Message
+ * @param throwable
+ * Throwable
+ * @param emails
+ */
+ public void log(Level logLevel, Log4j2Source log4j2Source, String msg, Throwable throwable, String[] emails) {
+// setMethod(throwable);
+// setUsername(getUser());
+// setParam("SOURCE", log4j2Source.name());
+// if (msg == null) {
+// LOGGER.log(logLevel, ExceptionWriter(throwable));
+// if (emails != null) {
+// sendMail(logLevel, log4j2Source, prettyExceptionEmail(ExceptionWriter(throwable)), emails, null);
+// }
+// else {
+// sendMail(logLevel, log4j2Source, prettyExceptionEmail(ExceptionWriter(throwable)), new String[0], null);
+// }
+// }
+// else if (msg.equals("") || msg.equals(throwable.getMessage())) {
+// LOGGER.log(logLevel, ExceptionWriter(throwable));
+// if (emails != null) {
+// sendMail(logLevel, log4j2Source, prettyExceptionEmail(ExceptionWriter(throwable)), emails, null);
+// }
+// else {
+// sendMail(logLevel, log4j2Source, prettyExceptionEmail(ExceptionWriter(throwable)), new String[0], null);
+// }
+// }
+// else {
+// LOGGER.log(logLevel, msg, throwable);
+// if (emails != null) {
+// sendMail(logLevel, log4j2Source, prettyExceptionEmail(ExceptionWriter(throwable)), msg, emails, null);
+// }
+// else {
+// sendMail(logLevel, log4j2Source, prettyExceptionEmail(ExceptionWriter(throwable)), msg, new String[0], null);
+// }
+// }
+ }
+
+ /**
+ * Only Used for Dispatcher Error
+ * Logs a message object with the FATAL level.
+ *
+ * @param msg
+ * Optional Message
+ * @param exception
+ * Thrown Exception
+ */
+ public void logFatalDispatcher(String msg, Exception exception) {
+ setMethod(exception);
+ setUsername(getUser());
+ Log4j2Source source = Log4j2Source.SYSTEM;
+ setParam("SOURCE", source.name());
+ LOGGER.fatal(ExceptionWriter(exception));
+// sendMail(Level.FATAL, source, prettyExceptionEmail(ExceptionWriter(exception)), new String[0], null);
+ }
+
+ /**
+ * Only Used for Dispatcher Error
+ * Logs a message object with the FATAL level.
+ *
+ * @param msg
+ * Optional Message
+ * @param throwable
+ * Throwable
+ */
+ public void logFatalDispatcher(String msg, Throwable throwable) {
+ setMethod(throwable);
+ setUsername(getUser());
+ Log4j2Source source = Log4j2Source.SYSTEM;
+ setParam("SOURCE", source.name());
+ LOGGER.fatal(ExceptionWriter(throwable));
+// sendMail(Level.FATAL, source, prettyExceptionEmail(ExceptionWriter(throwable)), new String[0], null);
+ }
+
+ /**
+ * Replaces \t with tabs who is understanding from Email-Client
+ *
+ * @param s
+ * Exeption as String
+ * @return
+ * String
+ */
+ private String prettyExceptionEmail(String s) {
+ return s.replace("\t", " ");
+ }
+
+ /**
+ * Wird nur in der PIC_Log4j2Bean benötigt. Reloads die Config von xml
+ */
+ public void reconfigureLogger() {
+ ctx.reconfigure();
+ }
+
+ /**
+ * Private method to send Mail if needed
+ *
+ * @param level
+ * @param source
+ * @param freitext
+ * @param email
+ * @param emailanhang
+ */
+// private void sendMail(Level level, Log4j2Source source, String freitext, String msg, String[] email, MailAttachment[] emailanhang) {
+// try {
+// StringBuilder mb = new StringBuilder();
+// String subject = "";
+//
+// SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
+//
+// mb.append(df.format(new Date()));
+// mb.append(" - ");
+// mb.append(source.name());
+// mb.append(" - ");
+// if (WorkplaceConfig.getWorkplaceEnvironment())
+// mb.append("Test");
+// else
+// mb.append("Echt");
+// mb.append(" - ");
+// mb.append(level.name());
+// mb.append(" - ");
+// mb.append(clazz.getCanonicalName());
+// user = (!getUser().isEmpty() ? user : ("UNKNOWN"));
+// if (user != null) {
+// mb.append(" - " + user);
+// }
+//
+// mb.append(" -- " + SessionUtil.getServerHostname());
+// mb.append(" -- " + SessionUtil.getSessionName());
+//
+// subject = mb.toString();
+// mb = new StringBuilder();
+// mb.append(msg);
+// mb.append("\r\n");
+// mb.append(System.getProperty("line.separator"));
+// mb.append(freitext);
+// mb.append(System.getProperty("line.separator"));
+//
+// String body = mb.toString();
+//
+// if (email != null) {
+// if (isDebug) {
+// System.out.println("Subject: " + subject + "\nMesage: " + body);
+// }
+// if (email.length <= 0) {
+// EmailHandler.sentLog4jMail(subject, body, null, emailanhang);
+//// logInfo("Sent Email", Log4j2Source.PROGRAM);
+// }
+// else {
+// EmailHandler.sentLog4jMail(subject, body, email, emailanhang);
+//// logInfo("Sent Email", Log4j2Source.PROGRAM);
+// }
+// }
+// }
+// catch (Exception e) {
+// setMethod();
+// LOGGER.fatal(e);
+// }
+// }
+
+ /**
+ * Private method to send Mail if needed
+ *
+ * @param level
+ * @param source
+ * @param freitext
+ * @param email
+ * @param emailanhang
+ */
+ private void sendMail(Level level, Log4j2Source source, String freitext, String[] email, MailAttachment[] emailanhang) {
+ try {
+ StringBuilder mb = new StringBuilder();
+ String subject = "";
+
+ SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
+
+ mb.append(df.format(new Date()));
+ mb.append(" - ");
+ mb.append(source.name());
+ mb.append(" - ");
+ if (WorkplaceConfig.getWorkplaceEnvironment())
+ mb.append("Test");
+ else
+ mb.append("Echt");
+ mb.append(" - ");
+ mb.append(level.name());
+ mb.append(" - ");
+ mb.append(clazz.getCanonicalName());
+ user = (!getUser().isEmpty() ? user : ("UNKNOWN"));
+ if (user != null) {
+ mb.append(" - " + user);
+ }
+
+ mb.append(" -- " + SessionUtil.getServerHostname());
+ mb.append(" -- " + SessionUtil.getSessionName());
+
+ subject = mb.toString();
+
+ mb.append(System.getProperty("line.separator"));
+ mb.append(freitext);
+ mb.append(System.getProperty("line.separator"));
+
+ if (email != null) {
+ if (isDebug) {
+ System.out.println("Subject: " + subject + "\nMesage: " + freitext);
+ }
+ if (email.length <= 0) {
+// EmailHandler.sentLog4jMail(subject, freitext, null, emailanhang);
+// logInfo("Sent Email", Log4j2Source.PROGRAM);
+ }
+ else {
+// EmailHandler.sentLog4jMail(subject, freitext, email, emailanhang);
+// logInfo("Sent Email", Log4j2Source.PROGRAM);
+ }
+ }
+ }
+ catch (Exception e) {
+ setMethod();
+ LOGGER.fatal(e);
+ }
+ }
+
+ /**
+ *
+ * Method to create own Errormails
+ *
+ * @param level
+ * TRACE / DEBUG / INFO / WARN / ERROR / FATAL
+ * @param source
+ * DATABASE / SYSTEM / PROGRAM / TOOLS
+ * @param text
+ * Optional Message
+ * @param emails
+ * @param errorUser
+ * User who is Displayed in Mail
+ * @param emailArrachment
+ * @param logClass
+ * Which class called this Method
+ */
+ public void sendMail(Level level, Log4j2Source source, String text, String[] email, String errorUser, MailAttachment[] emailArrachment, Object logClass) {
+ try {
+ StringBuilder mb = new StringBuilder();
+ String subject = "";
+ String message = "";
+
+ SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
+
+ if (level == null) {
+ level = LOGGER.getLevel();
+ }
+
+ mb.append(df.format(new Date()));
+ mb.append(" - ");
+ mb.append(source.name());
+ mb.append(" - ");
+ if (WorkplaceConfig.getWorkplaceEnvironment())
+ mb.append("Test");
+ else
+ mb.append("Echt");
+ mb.append(" - ");
+ mb.append(level.name());
+ mb.append(" - ");
+ mb.append(logClass.getClass().getCanonicalName());
+ user = (!getUser().isEmpty() ? user : ("UNKNOWN"));
+ if (user != null) {
+ mb.append(" - " + user);
+ }
+
+ mb.append(" -- " + SessionUtil.getServerHostname());
+ mb.append(" -- " + SessionUtil.getSessionName());
+
+ subject = mb.toString();
+
+ mb.append(System.getProperty("line.separator"));
+ mb.append(text);
+ mb.append(System.getProperty("line.separator"));
+
+ message = text;
+
+ setMethod();
+ if (errorUser == null) {
+ setUser(getUser());
+ } else {
+ setUsername(errorUser);
+ }
+
+ setParam("SOURCE", source.name());
+ LOGGER.log(level, text);
+
+ if (isDebug) {
+ System.out.println("Subject: " + subject + "\nMesage: " + text);
+ }
+ if (email == null || email.length <= 0) {
+// EmailHandler.sentLog4jMail(subject, message, null, emailArrachment);
+// logInfo("Sent Email", Log4j2Source.PROGRAM);
+ }
+ else {
+// EmailHandler.sentLog4jMail(subject, message, email, emailArrachment);
+// logInfo("Sent Email", Log4j2Source.PROGRAM);
+ }
+ }
+ catch (Exception e) {
+ setMethod();
+ LOGGER.fatal(e);
+ }
+ }
+
+ /**
+ * Aktuell nur für Email-Debugging
+ * Sendet EMail und gibt in Console aus
+ *
+ * @param isDebug
+ */
+ public void setDebug(boolean isDebug) { this.isDebug = isDebug; }
+
+ /**
+ * Sets Class, Methodname, linenumber for Log
+ */
+ private void setMethod() {
+ StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
+ String methodName = "";
+ int lineNumber = 0;
+ String fileName = "";
+ for (StackTraceElement stackTraceElement : stackTraceElements) {
+ methodName = stackTraceElement.getMethodName();
+ lineNumber = stackTraceElement.getLineNumber();
+ fileName = stackTraceElement.getFileName();
+
+ if (stackTraceElement.getClassName().startsWith("de.geis") && !methodName.equals("setMethod") && !methodName.equals("log") && !methodName.equals("subExceptionMsg")) {
+ break;
+ }
+ }
+ methodName = methodName.replace("<", "");
+ methodName = methodName.replace(">", "");
+
+ if (fileName != null) {
+ fileName = fileName.replace(".java", "");
+ }
+ ThreadContext.put("METHOD".toUpperCase(), methodName);
+ ThreadContext.put("LINE", lineNumber + "");
+ ThreadContext.put("FILE", fileName);
+ }
+
+ private void setMethod(Object exceptionOrThrowable) {
+ if (exceptionOrThrowable instanceof Exception) {
+ Exception exception = (Exception) exceptionOrThrowable;
+ StackTraceElement[] stackTraceElements = exception.getStackTrace();
+ for (StackTraceElement stackTraceElement : stackTraceElements) {
+ if (stackTraceElement.getClassName().startsWith("de.geis") && !stackTraceElement.getMethodName().equals("setMethod") && !stackTraceElement.getMethodName().equals("log") && !stackTraceElement.getMethodName().equals("subExceptionMsg")) {
+ setMethod(stackTraceElement.getMethodName(), stackTraceElement.getFileName(), stackTraceElement.getLineNumber(), exception.getClass().getSimpleName());
+ break;
+ }
+ }
+ }
+ else if (exceptionOrThrowable instanceof Throwable) {
+ Throwable throwable = (Throwable) exceptionOrThrowable;
+ StackTraceElement[] stackTraceElements = throwable.getStackTrace();
+ for (StackTraceElement stackTraceElement : stackTraceElements) {
+ if (stackTraceElement.getClassName().startsWith("de.geis") && !stackTraceElement.getMethodName().equals("setMethod") && !stackTraceElement.getMethodName().equals("log") && !stackTraceElement.getMethodName().equals("subExceptionMsg")) {
+ setMethod(stackTraceElement.getMethodName(), stackTraceElement.getFileName(), stackTraceElement.getLineNumber(), throwable.getClass().getSimpleName());
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Only use if setMethod() does not work
+ *
+ * @param method
+ * @param file
+ * @param line
+ * @param exception
+ */
+ private void setMethod(String method, String file, Integer line, String exception) {
+ method = method.replace("<", "");
+ method = method.replace(">", "");
+
+ file = file.replace(".java", "");
+ ThreadContext.put("METHOD".toUpperCase(), method);
+ ThreadContext.put("LINE", line + "");
+ ThreadContext.put("FILE", file);
+ ThreadContext.put("EXCEPTION", exception);
+ }
+
+ /**
+ * Setzt weitere parameter
+ *
+ *
+ * Aktuell nicht benötigt bzw. sinnvoll
+ *
+ *
+ * @param Param
+ * @param value
+ */
+ private void setParam(String Param, String value) {
+ ThreadContext.put(Param.toUpperCase(), value);
+ }
+
+ public void setUser(String username) { user = username; }
+
+ /**
+ * Sets Username for Log
+ *
+ * @param username
+ */
+ public void setUsername(String username) {
+ ThreadContext.put("USERNAME", username);
+ user = username;
+ }
+
+ /**
+ * Removes the "java.lang.Error:" in front of Exception
+ *
+ * @param msg
+ * @return
+ */
+ private String subExceptionMsg(String msg) {
+ try {
+ if (msg.trim().startsWith("java.lang.Error: ")) {
+ while (msg.trim().startsWith("java.lang.Error: ")) {
+ int index = msg.trim().indexOf("java.lang.Error: ") + 17;
+ msg = msg.trim().substring(index, msg.trim().length());
+ }
+
+ return msg;
+ }
+ else {
+ return msg;
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ return msg;
+ }
+ }
+}
diff --git a/src/main/java/de/tvo/mailer/MailAttachment.java b/src/main/java/de/tvo/mailer/MailAttachment.java
new file mode 100644
index 0000000..408c9ac
--- /dev/null
+++ b/src/main/java/de/tvo/mailer/MailAttachment.java
@@ -0,0 +1,65 @@
+package de.tvo.mailer;
+
+import java.io.File;
+import java.io.Serializable;
+
+import org.apache.commons.codec.binary.Base64;
+
+
+public class MailAttachment implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String fileName = "emptyfile.dat";
+ private byte[] fileContent = null;
+ private File file = null;
+ private boolean deleteFile = false;
+
+ public MailAttachment(String fileName, byte[] fileContent) {
+ this.fileName = fileName;
+ this.fileContent = fileContent;
+ }
+
+ public MailAttachment(String fileName, File file, boolean deleteFile) {
+ this.fileName = fileName;
+ this.file = file;
+ this.deleteFile = deleteFile;
+ }
+
+ public MailAttachment(String fileName, File file) {
+ this(fileName, file, false);
+ }
+
+ public byte[] getFileContent() {
+ return fileContent;
+ }
+
+ public void setFileContent(byte[] fileContent) {
+ this.fileContent = fileContent;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+ public boolean getDeleteFile() {
+ return deleteFile;
+ }
+
+ public String getBase64EncodedString() {
+ return Base64.encodeBase64String(getFileContent());
+ }
+
+}
diff --git a/src/main/java/de/tvo/nanoleaf/enums/NanoTypeEnum.java b/src/main/java/de/tvo/nanoleaf/enums/NanoTypeEnum.java
new file mode 100644
index 0000000..caed469
--- /dev/null
+++ b/src/main/java/de/tvo/nanoleaf/enums/NanoTypeEnum.java
@@ -0,0 +1,14 @@
+package de.tvo.nanoleaf.enums;
+
+public enum NanoTypeEnum {
+
+ CANVAS,
+
+ SHAPES,
+
+
+
+ ;
+
+
+}
diff --git a/src/main/java/de/tvo/nanoleaf/oclasses/MatrixInfo.java b/src/main/java/de/tvo/nanoleaf/oclasses/MatrixInfo.java
new file mode 100644
index 0000000..092b855
--- /dev/null
+++ b/src/main/java/de/tvo/nanoleaf/oclasses/MatrixInfo.java
@@ -0,0 +1,33 @@
+package de.tvo.nanoleaf.oclasses;
+
+public class MatrixInfo {
+
+ int m_matrixX = 0;
+ int m_matrixY = 0;
+ //int m_Panels = 1;
+
+ public MatrixInfo(int matrixX, int matrixY) {
+ //this.m_Panels = Panels;
+ this.m_matrixX = matrixX;
+ this.m_matrixY = matrixY;
+ }
+
+ public int getMatrixX() {
+ return m_matrixX;
+ }
+
+ public void setMatrixX(int matrixX) {
+ m_matrixX = matrixX;
+ }
+
+ public int getMatrixY() {
+ return m_matrixY;
+ }
+
+ public void setMatrixY(int matrixY) {
+ m_matrixY = matrixY;
+ }
+
+
+
+}
diff --git a/src/main/java/de/tvo/session/SessionTyp.java b/src/main/java/de/tvo/session/SessionTyp.java
new file mode 100644
index 0000000..025a648
--- /dev/null
+++ b/src/main/java/de/tvo/session/SessionTyp.java
@@ -0,0 +1,12 @@
+package de.tvo.session;
+
+public enum SessionTyp {
+
+ PORTAL_SESSION, // Reguläre User Session
+ PORTAL_TOKEN_SESSION, // Sitzung die sich automatisch anmeldet über ein valides Token (gatway.risc?token=abc)
+ MDE_SESSION, // der MDE Server mit anderen Menüs speziell für die MDEs
+ CLIENT_SESSION, // Wenn Server und Client die selbe IP hat, quasi Embedded
+
+
+ ;
+}
diff --git a/src/main/java/de/tvo/session/SessionUtil.java b/src/main/java/de/tvo/session/SessionUtil.java
new file mode 100644
index 0000000..a9e58b9
--- /dev/null
+++ b/src/main/java/de/tvo/session/SessionUtil.java
@@ -0,0 +1,416 @@
+package de.tvo.session;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.time.Duration;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import org.eclnt.jsfserver.util.HttpSessionAccess;
+import org.xbill.DNS.Lookup;
+import org.xbill.DNS.PTRRecord;
+import org.xbill.DNS.Record;
+import org.xbill.DNS.SimpleResolver;
+import org.xbill.DNS.Type;
+
+import de.tvo.tools.StringUtil;
+import jakarta.servlet.http.HttpSession;
+
+public class SessionUtil {
+
+ private SessionUtil() {
+
+ }
+
+ /**
+ * Function to return Client IP
+ * @return Client IP
+ */
+ public static String getClientIP(){
+ return HttpSessionAccess.getCurrentRequest().getRemoteAddr();
+ }
+
+ /**
+ * Function to return Client Hostname for Portal Server
+ * @return Client Hostname
+ */
+ public static String getClientHostname() {
+ return getClientHostname(SessionTyp.PORTAL_SESSION);
+ }
+
+ /**
+ * Function to return Client Hostname
+ * @return Client Hostname
+ */
+ public static String getClientHostname(SessionTyp sessionTyp) {
+ System.out.println("getClientHostname: " + sessionTyp);
+
+ String clientIP = getClientIP();
+ System.out.println("clientIP " + clientIP);
+
+ if (StringUtil.safeTrim(clientIP).equals("0:0:0:0:0:0:0:1") || StringUtil.safeTrim(clientIP).equals("127.0.0.1")) {
+ sessionTyp = SessionTyp.PORTAL_SESSION;
+ }
+
+ try {
+ switch (sessionTyp) {
+ case CLIENT_SESSION:
+ case PORTAL_SESSION: {
+
+
+ String ipAddress = InetAddress.getByName(HttpSessionAccess.getCurrentRequest().getRemoteAddr()).getHostName();
+ if (ipAddress != null) {
+ if (ipAddress.indexOf(".") != -1) {
+ return ipAddress.substring(0, ipAddress.indexOf(".")).toUpperCase();
+ } else {
+ return ipAddress.toUpperCase();
+ }
+ }
+
+ break;
+ }
+
+// case MDE_SESSION: {
+// String clientName = null;
+// System.out.println("clientIP " + clientIP);
+//
+// if (StringUtil.safeTrim(clientIP).equals("0:0:0:0:0:0:0:1")) {
+// clientIP = getServerIP();
+// }
+//
+//
+//
+// if (StringUtil.getCountLetter(clientIP, '.') == 3) {
+// DBHandler dbHandler = new DBHandler(WorkplaceConfig.getWorkplaceEnvironment() ? SchemataENUM.GEISV8T : SchemataENUM.GEISV8E);
+// StringBuilder sqlBuilder = new StringBuilder();
+// sqlBuilder.append("select pakey2 ");
+// sqlBuilder.append("from Gxpadat ");
+// sqlBuilder.append("where pakonz='EDV' and pafirm='MDE' ");
+// sqlBuilder.append("and pawert='MDEHOSTNAMEN' and pakey1='" + clientIP + "' ");
+//
+//
+// List