From ece58d1d4ff2dd79594be39ba8f3d936247a0f3d Mon Sep 17 00:00:00 2001
From: tonschnoer <kmtegtmeier@tonschnoer.de>
Date: Fri, 5 Apr 2024 20:19:09 +0200
Subject: [PATCH] updated project settings

fixed code assist issues
---
 MediaBackupEJB/.classpath                     |  6 +-
 .../src/main/java/de/kmt/ndr/Main.java        | 69 +++++++++++++++++++
 2 files changed, 72 insertions(+), 3 deletions(-)
 create mode 100644 MediaBackupEJB/src/main/java/de/kmt/ndr/Main.java

diff --git a/MediaBackupEJB/.classpath b/MediaBackupEJB/.classpath
index f7e4a1d..0c3974d 100644
--- a/MediaBackupEJB/.classpath
+++ b/MediaBackupEJB/.classpath
@@ -14,15 +14,15 @@
 	</classpathentry>
 	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
 		<attributes>
+			<attribute name="test" value="true"/>
 			<attribute name="optional" value="true"/>
 			<attribute name="maven.pomderived" value="true"/>
-			<attribute name="test" value="true"/>
 		</attributes>
 	</classpathentry>
 	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
 		<attributes>
-			<attribute name="maven.pomderived" value="true"/>
 			<attribute name="test" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
 			<attribute name="optional" value="true"/>
 		</attributes>
 	</classpathentry>
@@ -31,7 +31,7 @@
 			<attribute name="maven.pomderived" value="true"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+	<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
 		<attributes>
 			<attribute name="maven.pomderived" value="true"/>
 		</attributes>
diff --git a/MediaBackupEJB/src/main/java/de/kmt/ndr/Main.java b/MediaBackupEJB/src/main/java/de/kmt/ndr/Main.java
new file mode 100644
index 0000000..084680f
--- /dev/null
+++ b/MediaBackupEJB/src/main/java/de/kmt/ndr/Main.java
@@ -0,0 +1,69 @@
+package de.kmt.ndr;
+
+
+import jakarta.annotation.PostConstruct;
+import jakarta.annotation.PreDestroy;
+import jakarta.annotation.Resource;
+import jakarta.ejb.ScheduleExpression;
+import jakarta.ejb.Singleton;
+import jakarta.ejb.Startup;
+import jakarta.ejb.Timeout;
+import jakarta.ejb.Timer;
+import jakarta.ejb.TimerConfig;
+import jakarta.ejb.TimerService;
+
+
+@Singleton
+@Startup
+
+public class Main {
+	
+    @Resource
+    private TimerService timerService;
+    
+    private void _setUP() {
+  	
+    }
+    
+    @Timeout
+    public void scheduler(Timer timer) {
+    	try {
+    		_setUP();
+    		System.out.println("Timer fired.");
+    	}
+    	catch(Exception _ex) {
+    		
+    	}
+    }
+
+    @PostConstruct
+    public void initialize() {
+    	try {
+    		_setUP();
+            ScheduleExpression se = new ScheduleExpression();
+            se.hour("*").minute("0/1").second("0/1");
+            
+            timerService.createCalendarTimer(se, new TimerConfig("ARD-ZDF-Box Cleanup Service scheduled at ", false));
+    	}
+    	catch(Exception _ex) {
+    		
+    	}
+    }
+
+    @PreDestroy
+    public void stop() {
+    	
+    	try {
+    		_setUP();
+	        for (Timer timer : timerService.getTimers()) {
+        	
+	            timer.cancel();
+	        }
+    	}
+    	catch(Exception _ex) {
+    		
+    	}
+    }
+
+}
+
-- 
GitLab