Commit ccc08545d7dfb379445848c4ec0da99a5cbcf600

Authored by mfcb
1 parent 9a81b653

Fixed SchedulerBean Skeleton.

BeuthBot.ipr
... ... @@ -631,6 +631,9 @@
631 631 <element id="library" level="project" name="Gradle: org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:1.0.0.Final" />
632 632 <element id="library" level="project" name="Gradle: javax.el:javax.el-api:3.0.0" />
633 633 <element id="library" level="project" name="Gradle: javax.interceptor:javax.interceptor-api:1.2" />
  634 + <element id="library" level="project" name="Gradle: org.apache.httpcomponents:httpclient:4.5.3" />
  635 + <element id="library" level="project" name="Gradle: org.apache.httpcomponents:httpmime:4.3.1" />
  636 + <element id="library" level="project" name="Gradle: org.apache.httpcomponents:httpcore:4.4.6" />
634 637 </element>
635 638 </element>
636 639 </root>
... ...
services/Scheduler/Scheduler_main.iml
... ... @@ -19,6 +19,10 @@
19 19 <orderEntry type="inheritedJdk" />
20 20 <orderEntry type="sourceFolder" forTests="false" />
21 21 <orderEntry type="module" module-name="Common_main" />
  22 + <orderEntry type="library" scope="PROVIDED" name="Gradle: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
  23 + <orderEntry type="library" scope="PROVIDED" name="Gradle: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
  24 + <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpclient:4.5.3" level="project" />
  25 + <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpmime:4.3.1" level="project" />
22 26 <orderEntry type="library" scope="PROVIDED" name="Gradle: org.slf4j:slf4j-api:1.7.25" level="project" />
23 27 <orderEntry type="library" scope="PROVIDED" name="Gradle: org.jboss.resteasy:resteasy-client:3.1.3.Final" level="project" />
24 28 <orderEntry type="library" name="Gradle: com.google.code.gson:gson:2.8.1" level="project" />
... ... @@ -49,16 +53,15 @@
49 53 <orderEntry type="library" name="Gradle: org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.2_spec:1.0.4.Final" level="project" />
50 54 <orderEntry type="library" name="Gradle: org.jboss.spec.javax.xml.soap:jboss-saaj-api_1.3_spec:1.0.3.Final" level="project" />
51 55 <orderEntry type="library" name="Gradle: org.jboss.spec.javax.xml.ws:jboss-jaxws-api_2.2_spec:2.0.3.Final" level="project" />
  56 + <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore:4.4.6" level="project" />
  57 + <orderEntry type="library" scope="PROVIDED" name="Gradle: commons-logging:commons-logging:1.2" level="project" />
  58 + <orderEntry type="library" scope="PROVIDED" name="Gradle: commons-codec:commons-codec:1.9" level="project" />
52 59 <orderEntry type="library" scope="PROVIDED" name="Gradle: org.jboss.resteasy:resteasy-jaxrs:3.1.3.Final" level="project" />
53 60 <orderEntry type="library" scope="PROVIDED" name="Gradle: org.jboss.resteasy:resteasy-jaxrs-services:3.1.3.Final" level="project" />
54 61 <orderEntry type="library" scope="PROVIDED" name="Gradle: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" />
55   - <orderEntry type="library" scope="PROVIDED" name="Gradle: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
56 62 <orderEntry type="library" name="Gradle: org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:1.0.0.Final" level="project" />
57 63 <orderEntry type="library" scope="PROVIDED" name="Gradle: commons-io:commons-io:2.5" level="project" />
58 64 <orderEntry type="library" scope="PROVIDED" name="Gradle: net.jcip:jcip-annotations:1.0" level="project" />
59   - <orderEntry type="library" scope="PROVIDED" name="Gradle: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
60   - <orderEntry type="library" scope="PROVIDED" name="Gradle: commons-logging:commons-logging:1.2" level="project" />
61   - <orderEntry type="library" scope="PROVIDED" name="Gradle: commons-codec:commons-codec:1.9" level="project" />
62 65 <orderEntry type="library" name="Gradle: javax.el:javax.el-api:3.0.0" level="project" />
63 66 <orderEntry type="library" name="Gradle: javax.interceptor:javax.interceptor-api:1.2" level="project" />
64 67 </component>
... ...
services/Scheduler/Scheduler_test.iml
... ... @@ -10,7 +10,11 @@
10 10 <orderEntry type="inheritedJdk" />
11 11 <orderEntry type="sourceFolder" forTests="false" />
12 12 <orderEntry type="module" module-name="Scheduler_main" />
  13 + <orderEntry type="library" scope="PROVIDED" name="Gradle: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
  14 + <orderEntry type="library" scope="PROVIDED" name="Gradle: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
13 15 <orderEntry type="module" module-name="Common_main" />
  16 + <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpclient:4.5.3" level="project" />
  17 + <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpmime:4.3.1" level="project" />
14 18 <orderEntry type="library" name="Gradle: org.slf4j:slf4j-api:1.7.25" level="project" />
15 19 <orderEntry type="library" name="Gradle: org.jboss.resteasy:resteasy-client:3.1.3.Final" level="project" />
16 20 <orderEntry type="library" name="Gradle: com.google.code.gson:gson:2.8.1" level="project" />
... ... @@ -41,16 +45,15 @@
41 45 <orderEntry type="library" name="Gradle: org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.2_spec:1.0.4.Final" level="project" />
42 46 <orderEntry type="library" name="Gradle: org.jboss.spec.javax.xml.soap:jboss-saaj-api_1.3_spec:1.0.3.Final" level="project" />
43 47 <orderEntry type="library" name="Gradle: org.jboss.spec.javax.xml.ws:jboss-jaxws-api_2.2_spec:2.0.3.Final" level="project" />
  48 + <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore:4.4.6" level="project" />
  49 + <orderEntry type="library" name="Gradle: commons-logging:commons-logging:1.2" level="project" />
  50 + <orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.9" level="project" />
44 51 <orderEntry type="library" name="Gradle: org.jboss.resteasy:resteasy-jaxrs:3.1.3.Final" level="project" />
45 52 <orderEntry type="library" name="Gradle: org.jboss.resteasy:resteasy-jaxrs-services:3.1.3.Final" level="project" />
46 53 <orderEntry type="library" name="Gradle: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" />
47   - <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
48 54 <orderEntry type="library" name="Gradle: org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:1.0.0.Final" level="project" />
49 55 <orderEntry type="library" name="Gradle: commons-io:commons-io:2.5" level="project" />
50 56 <orderEntry type="library" name="Gradle: net.jcip:jcip-annotations:1.0" level="project" />
51   - <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
52   - <orderEntry type="library" name="Gradle: commons-logging:commons-logging:1.2" level="project" />
53   - <orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.9" level="project" />
54 57 <orderEntry type="library" name="Gradle: javax.el:javax.el-api:3.0.0" level="project" />
55 58 <orderEntry type="library" name="Gradle: javax.interceptor:javax.interceptor-api:1.2" level="project" />
56 59 </component>
... ...
services/Scheduler/src/main/java/de/bht/beuthbot/scheduler/JAXActivator.java 0 → 100755
  1 +package de.bht.beuthbot.scheduler;
  2 +
  3 +import javax.ws.rs.ApplicationPath;
  4 +import javax.ws.rs.core.Application;
  5 +
  6 +/**
  7 + * JAXActivator is an arbitrary name, what is important is that javax.ws.rs.core.Application is extended
  8 + * and the @ApplicationPath annotation is used with a "rest" path. Without this the rest routes linked to
  9 + * from index.html would not be found.
  10 + */
  11 +@ApplicationPath("")
  12 +public class JAXActivator extends Application {
  13 + // Left empty intentionally
  14 +}
... ...
services/Scheduler/src/main/java/de/bht/beuthbot/scheduler/SchedulerBean.java
... ... @@ -14,14 +14,13 @@ import de.bht.beuthbot.jms.TaskMessage;
14 14 import java.util.*;
15 15 import javax.annotation.PostConstruct;
16 16 import javax.annotation.Resource;
17   -import javax.ejb.Singleton;
18   -import javax.ejb.Schedule;
19   -import javax.ejb.Stateless;
20   -import javax.ejb.Timeout;
  17 +import javax.ejb.*;
21 18 import javax.ejb.Timer;
22   -import javax.ejb.TimerService;
  19 +import javax.ws.rs.GET;
  20 +import javax.ws.rs.Path;
23 21  
24 22 @Singleton
  23 +@Startup
25 24 public class SchedulerBean {
26 25 /**
27 26 * slf4j Logger
... ... @@ -48,11 +47,10 @@ public class SchedulerBean {
48 47 //CONSTRUCTOR
49 48 @PostConstruct
50 49 public void init(){
51   -
  50 + logger.debug("SchedulerBean initiated!");
52 51 }
53 52  
54   -
55   - @Schedule(minute="*")
  53 + @Schedule(hour="*", minute="*")
56 54 public void fetchReminders() {
57 55 //TODO: Establish DB connection and retrieve list of reminders
58 56 logger.debug("SchedulerBean fired!");
... ...