Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'test-apps/quartz-scheduler/quartz.bundle.same1/src')
-rw-r--r--test-apps/quartz-scheduler/quartz.bundle.same1/src/main/java/quartz/bundle/same1/Service.java28
-rw-r--r--test-apps/quartz-scheduler/quartz.bundle.same1/src/main/java/quartz/bundle/same1/internal/StandardService.java47
-rw-r--r--test-apps/quartz-scheduler/quartz.bundle.same1/src/main/resources/META-INF/MANIFEST.MF7
-rw-r--r--test-apps/quartz-scheduler/quartz.bundle.same1/src/main/resources/META-INF/spring/module-context.xml27
-rw-r--r--test-apps/quartz-scheduler/quartz.bundle.same1/src/main/resources/META-INF/spring/osgi-context.xml12
5 files changed, 121 insertions, 0 deletions
diff --git a/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/java/quartz/bundle/same1/Service.java b/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/java/quartz/bundle/same1/Service.java
new file mode 100644
index 00000000..66f43b52
--- /dev/null
+++ b/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/java/quartz/bundle/same1/Service.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package quartz.bundle.same1;
+
+import org.quartz.Scheduler;
+
+/**
+ * Simple test service to serve as a scheduled job.
+ *
+ */
+public interface Service {
+
+ int getCount();
+
+ Scheduler getScheduler();
+
+ void process();
+
+}
diff --git a/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/java/quartz/bundle/same1/internal/StandardService.java b/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/java/quartz/bundle/same1/internal/StandardService.java
new file mode 100644
index 00000000..36db66ab
--- /dev/null
+++ b/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/java/quartz/bundle/same1/internal/StandardService.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package quartz.bundle.same1.internal;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.quartz.Scheduler;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+import quartz.bundle.same1.Service;
+
+/**
+ */
+public class StandardService implements Service, ApplicationContextAware {
+
+ private final AtomicInteger count = new AtomicInteger(0);
+
+ private ApplicationContext applicationContext;
+
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+ this.applicationContext = applicationContext;
+ }
+
+ public int getCount() {
+ return this.count.get();
+ }
+
+ public Scheduler getScheduler() {
+ return (Scheduler) this.applicationContext.getBean("schedulerFactoryBean");
+ }
+
+ public void process() {
+ System.err.println(getClass().getName() + " called " + this.count.incrementAndGet() + " times.");
+ }
+
+}
diff --git a/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/resources/META-INF/MANIFEST.MF b/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..a7f5d990
--- /dev/null
+++ b/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: quartz.bundle.same1
+Bundle-Version: 1.0.0
+Import-Bundle: com.springsource.org.quartz;version="[1.6.0,1.6.0]"
+Import-Library: org.springframework.spring;version="[2.5.5,3.1.0)"
+Export-Package: quartz.bundle.same1
diff --git a/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/resources/META-INF/spring/module-context.xml b/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/resources/META-INF/spring/module-context.xml
new file mode 100644
index 00000000..635e5718
--- /dev/null
+++ b/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/resources/META-INF/spring/module-context.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+ <bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
+ <property name="jobDetail" ref="jobDetail" />
+ <property name="startDelay" value="500" />
+ <property name="repeatInterval" value="1000" />
+ </bean>
+ <bean id="jobDetail"
+ class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
+ <property name="targetObject" ref="service" />
+ <property name="targetMethod" value="process" />
+ <property name="concurrent" value="false" />
+ </bean>
+ <bean id="schedulerFactoryBean"
+ class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
+ <property name="triggers">
+ <list>
+ <ref bean="simpleTrigger" />
+ </list>
+ </property>
+ </bean>
+ <bean id="service" class="quartz.bundle.same1.internal.StandardService" />
+</beans>
diff --git a/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/resources/META-INF/spring/osgi-context.xml b/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/resources/META-INF/spring/osgi-context.xml
new file mode 100644
index 00000000..0b42dcbf
--- /dev/null
+++ b/test-apps/quartz-scheduler/quartz.bundle.same1/src/main/resources/META-INF/spring/osgi-context.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/osgi"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+ <service ref="service" interface="quartz.bundle.same1.Service" />
+
+</beans:beans>

Back to the top