Permalink
Browse files

Created a web application wrapper

  • Loading branch information...
1 parent 931bf39 commit 857127ffc24cfd1cfbdeebab8bfbb32bf1920be8 Oleg Poleshuk committed Jul 21, 2011
View
47 pom.xml
@@ -10,7 +10,7 @@
<url>http://relgames.org</url>
- <packaging>jar</packaging>
+ <packaging>war</packaging>
<properties>
<scala.version>2.8.1</scala.version>
@@ -30,20 +30,33 @@
<artifactId>joda-time</artifactId>
<version>1.6.2</version>
</dependency>
-<!--
+ <!--
+ <dependency>
+ <groupId>com.google.api.client</groupId>
+ <artifactId>google-api-client</artifactId>
+ <version>1.4.1-beta</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.api.services.tasks</groupId>
+ <artifactId>google-api-services-tasks-v1</artifactId>
+ <version>1.0.0-beta</version>
+ <scope>system</scope>
+ <systemPath>${project.basedir}/lib/google-api-services-tasks-v1-1.0.0-beta.jar</systemPath>
+ </dependency>
+ -->
+
<dependency>
- <groupId>com.google.api.client</groupId>
- <artifactId>google-api-client</artifactId>
- <version>1.4.1-beta</version>
+ <groupId>org.quartz-scheduler</groupId>
+ <artifactId>quartz</artifactId>
+ <version>2.0.2</version>
</dependency>
<dependency>
- <groupId>com.google.api.services.tasks</groupId>
- <artifactId>google-api-services-tasks-v1</artifactId>
- <version>1.0.0-beta</version>
- <scope>system</scope>
- <systemPath>${project.basedir}/lib/google-api-services-tasks-v1-1.0.0-beta.jar</systemPath>
+ <groupId>javax</groupId>
+ <artifactId>javaee-web-api</artifactId>
+ <version>6.0</version>
+ <scope>provided</scope>
</dependency>
--->
+
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -157,6 +170,18 @@
</executions>
</plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ </plugin>
</plugins>
</build>
+
+ <repositories>
+ <repository>
+ <id>java.net2</id>
+ <name>Repository hosting the jee6 artifacts</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
</project>
View
20 src/main/java/org/relgames/gtasksdaemon/QuartzJob.java
@@ -0,0 +1,20 @@
+package org.relgames.gtasksdaemon;
+
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author Oleg Poleshuk
+ */
+public class QuartzJob implements Job{
+ private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+ @Override
+ public void execute(JobExecutionContext context) throws JobExecutionException {
+ log.info("Calling MainService.process()");
+ //MainService.process();
+ }
+}
View
22 src/main/resources/jobs.xml
@@ -0,0 +1,22 @@
+<?xml version='1.0' encoding='utf-8'?>
+<job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd"
+ version="1.8">
+
+ <schedule>
+ <job>
+ <name>main-job</name>
+ <job-class>org.relgames.gtasksdaemon.QuartzJob</job-class>
+ </job>
+
+ <trigger>
+ <cron>
+ <name>main-trigger</name>
+ <job-name>main-job</job-name>
+ <!-- trigger every night at 05:00 am -->
+ <cron-expression>0 0 5 * * ?</cron-expression>
+ </cron>
+ </trigger>
+ </schedule>
+</job-scheduling-data>
View
9 src/main/resources/quartz.properties
@@ -0,0 +1,9 @@
+org.quartz.scheduler.instanceName = MyScheduler
+org.quartz.threadPool.threadCount = 1
+org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
+
+org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin
+org.quartz.plugin.jobInitializer.fileNames = jobs.xml
+org.quartz.plugin.jobInitializer.failOnFileNotFound = true
+org.quartz.plugin.jobInitializer.scanInterval = 0
+org.quartz.plugin.jobInitializer.wrapInUserTransaction = false
View
23 src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,23 @@
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
+ <context-param>
+ <param-name>quartz:config-file</param-name>
+ <param-value>quartz.properties</param-value>
+ </context-param>
+ <context-param>
+ <param-name>quartz:shutdown-on-unload</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>quartz:wait-on-shutdown</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <context-param>
+ <param-name>quartz:start-scheduler-on-load</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <listener>
+ <listener-class>
+ org.quartz.ee.servlet.QuartzInitializerListener
+ </listener-class>
+ </listener>
+</web-app>

0 comments on commit 857127f

Please sign in to comment.