Index: lams_build/lib/lams/lams-monitoring.jar
===================================================================
diff -u -r13f28765828c265f82ca9f6e3206d686a16b3e10 -rd2c7363ac0242caa259b49112d85ffa9671c30e6
Binary files differ
Index: lams_build/lib/lams/lams.jar
===================================================================
diff -u -re8fc6decfb0098e678c1819f3d2fa98d6aa42820 -rd2c7363ac0242caa259b49112d85ffa9671c30e6
Binary files differ
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml
===================================================================
diff -u -rfbc4711c5f152ed8e63aab0d75efcd76e7c1e158 -rd2c7363ac0242caa259b49112d85ffa9671c30e6
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml (.../monitoringApplicationContext.xml) (revision fbc4711c5f152ed8e63aab0d75efcd76e7c1e158)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml (.../monitoringApplicationContext.xml) (revision d2c7363ac0242caa259b49112d85ffa9671c30e6)
@@ -92,55 +92,36 @@
- org.lamsfoundation.lams.monitoring.service.OpenScheduleGateJob
+ org.lamsfoundation.lams.monitoring.quartz.job.OpenScheduleGateJob
-
-
-
- org.lamsfoundation.lams.monitoring.service.CloseScheduleGateJob
+ org.lamsfoundation.lams.monitoring.quartz.job.CloseScheduleGateJob
-
-
-
- org.lamsfoundation.lams.monitoring.service.StartScheduleLesson
+ org.lamsfoundation.lams.monitoring.quartz.job.StartScheduleLessonJob
-
-
-
- org.lamsfoundation.lams.monitoring.service.FinishScheduleLesson
+ org.lamsfoundation.lams.monitoring.quartz.job.FinishScheduleLessonJob
-
-
-
+
+
+
+ org.springframework.scheduling.quartz.LocalDataSourceJobStore
+ org.quartz.impl.jdbcjobstore.StdJDBCDelegate
+ lams_quartz_
+
+
+
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/CloseScheduleGateJob.java
===================================================================
diff -u
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/CloseScheduleGateJob.java (revision 0)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/CloseScheduleGateJob.java (revision d2c7363ac0242caa259b49112d85ffa9671c30e6)
@@ -0,0 +1,68 @@
+/***************************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ***********************************************************************/
+
+package org.lamsfoundation.lams.monitoring.quartz.job;
+
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.monitoring.service.IMonitoringService;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+
+/**
+ * The Quartz sheduling job that closes the gate. It is configured as a Spring
+ * bean and will be triggered by the scheduler to perform its work.
+ *
+ * @author Jacky Fang
+ * @since 2005-4-12
+ * @version 1.1
+ */
+public class CloseScheduleGateJob extends MonitoringJob
+{
+
+ //---------------------------------------------------------------------
+ // Instance variables
+ //---------------------------------------------------------------------
+ private static Logger log = Logger.getLogger(CloseScheduleGateJob.class);
+
+ /**
+ * @see org.springframework.scheduling.quartz.QuartzJobBean#executeInternal(org.quartz.JobExecutionContext)
+ */
+ protected void executeInternal(JobExecutionContext context) throws JobExecutionException
+ {
+ IMonitoringService monitoringService = getMonitoringService(context);
+
+ //getting gate id set from scheduler
+ Map properties = context.getJobDetail().getJobDataMap();
+ Long gateId = (Long)properties.get("gateId");
+
+ if(log.isDebugEnabled())
+ log.debug("Closing gate......["+gateId.longValue()+"]");
+
+ monitoringService.closeGate(gateId);
+
+ if(log.isDebugEnabled())
+ log.debug("Gate......["+gateId.longValue()+"] Closed");
+ }
+}
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/FinishScheduleLessonJob.java
===================================================================
diff -u
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/FinishScheduleLessonJob.java (revision 0)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/FinishScheduleLessonJob.java (revision d2c7363ac0242caa259b49112d85ffa9671c30e6)
@@ -0,0 +1,53 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *This program is free software; you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program; if not, write to the Free Software
+ *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+package org.lamsfoundation.lams.monitoring.quartz.job;
+
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.monitoring.MonitoringConstants;
+import org.lamsfoundation.lams.monitoring.service.IMonitoringService;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+public class FinishScheduleLessonJob extends MonitoringJob{
+ //---------------------------------------------------------------------
+ // Instance variables
+ //---------------------------------------------------------------------
+ private static Logger log = Logger.getLogger(FinishScheduleLessonJob.class);
+
+ protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
+ IMonitoringService monitoringService = getMonitoringService(context);
+
+ //getting gate id set from scheduler
+ Map properties = context.getJobDetail().getJobDataMap();
+ long lessonId = ((Long)properties.get(MonitoringConstants.KEY_LESSON_ID)).longValue();
+
+ if(log.isDebugEnabled())
+ log.debug("Lesson ["+lessonId+"] is stopping...");
+
+
+ monitoringService.finishLesson(lessonId);
+
+ if(log.isDebugEnabled())
+ log.debug("Lesson ["+lessonId+"] stopped");
+ }
+}
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/MonitoringJob.java
===================================================================
diff -u
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/MonitoringJob.java (revision 0)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/MonitoringJob.java (revision d2c7363ac0242caa259b49112d85ffa9671c30e6)
@@ -0,0 +1,44 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *This program is free software; you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program; if not, write to the Free Software
+ *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+package org.lamsfoundation.lams.monitoring.quartz.job;
+
+import org.lamsfoundation.lams.monitoring.service.IMonitoringService;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.quartz.SchedulerContext;
+import org.quartz.SchedulerException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.quartz.QuartzJobBean;
+
+public abstract class MonitoringJob extends QuartzJobBean{
+ private static final String CONTEXT_NAME = "monitoringApplicationContext";
+ private static final String SERVICE_NAME = "monitoringService";
+
+ protected IMonitoringService getMonitoringService(JobExecutionContext context) throws JobExecutionException{
+ try {
+ SchedulerContext sc = context.getScheduler().getContext();
+ ApplicationContext cxt = (ApplicationContext) sc.get(CONTEXT_NAME);
+ return (IMonitoringService) cxt.getBean(SERVICE_NAME);
+ } catch (SchedulerException e) {
+ throw new JobExecutionException("Failed look up the Scheduler" + e.toString());
+ }
+ }
+}
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/OpenScheduleGateJob.java
===================================================================
diff -u
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/OpenScheduleGateJob.java (revision 0)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/OpenScheduleGateJob.java (revision d2c7363ac0242caa259b49112d85ffa9671c30e6)
@@ -0,0 +1,71 @@
+/***************************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ***********************************************************************/
+
+package org.lamsfoundation.lams.monitoring.quartz.job;
+
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.monitoring.service.IMonitoringService;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+
+/**
+ * The Quartz sheduling job that opens the gate. It is configured as a Spring
+ * bean and will be triggered by the scheduler to perform its work.
+ * @author Jacky Fang
+ * @since 2005-4-12
+ * @version 1.1
+ *
+ */
+public class OpenScheduleGateJob extends MonitoringJob
+{
+ //---------------------------------------------------------------------
+ // Instance variables
+ //---------------------------------------------------------------------
+ private static Logger log = Logger.getLogger(OpenScheduleGateJob.class);
+
+ /**
+ * @throws JobExecutionException
+ * @see org.springframework.scheduling.quartz.QuartzJobBean#executeInternal(org.quartz.JobExecutionContext)
+ */
+ protected void executeInternal(JobExecutionContext context) throws JobExecutionException
+ {
+ IMonitoringService monitoringService = getMonitoringService(context);
+
+ //getting gate id set from scheduler
+ Map properties = context.getJobDetail().getJobDataMap();
+ Long gateId = (Long)properties.get("gateId");
+
+ if(log.isDebugEnabled())
+ log.debug("Openning gate......["+gateId.longValue()+"]");
+
+ monitoringService.openGate(gateId);
+
+ if(log.isDebugEnabled())
+ log.debug("Gate......["+gateId.longValue()+"] opened");
+
+ }
+
+
+}
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/StartScheduleLessonJob.java
===================================================================
diff -u
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/StartScheduleLessonJob.java (revision 0)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/StartScheduleLessonJob.java (revision d2c7363ac0242caa259b49112d85ffa9671c30e6)
@@ -0,0 +1,53 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *This program is free software; you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program; if not, write to the Free Software
+ *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+package org.lamsfoundation.lams.monitoring.quartz.job;
+
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.monitoring.MonitoringConstants;
+import org.lamsfoundation.lams.monitoring.service.IMonitoringService;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+public class StartScheduleLessonJob extends MonitoringJob{
+ //---------------------------------------------------------------------
+ // Instance variables
+ //---------------------------------------------------------------------
+ private static Logger log = Logger.getLogger(StartScheduleLessonJob.class);
+
+ protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
+ IMonitoringService monitoringService = getMonitoringService(context);
+
+ //getting gate id set from scheduler
+ Map properties = context.getJobDetail().getJobDataMap();
+ long lessonId = ((Long)properties.get(MonitoringConstants.KEY_LESSON_ID)).longValue();
+
+ if(log.isDebugEnabled())
+ log.debug("Lesson ["+lessonId+"] is starting...");
+
+
+ monitoringService.startLesson(lessonId);
+
+ if(log.isDebugEnabled())
+ log.debug("Lesson ["+lessonId+"] started");
+ }
+}
Fisheye: Tag d2c7363ac0242caa259b49112d85ffa9671c30e6 refers to a dead (removed) revision in file `lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/CloseScheduleGateJob.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag d2c7363ac0242caa259b49112d85ffa9671c30e6 refers to a dead (removed) revision in file `lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/FinishScheduleLesson.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java
===================================================================
diff -u -r9caa0418dd527221031dd5828fa3b3e32da2a7fc -rd2c7363ac0242caa259b49112d85ffa9671c30e6
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision 9caa0418dd527221031dd5828fa3b3e32da2a7fc)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision d2c7363ac0242caa259b49112d85ffa9671c30e6)
@@ -482,10 +482,10 @@
JobDetail startLessonJob = getStartScheduleLessonJob();
//setup the message for scheduling job
- startLessonJob.setName("startLessonOnSchedule");
+ startLessonJob.setName("startLessonOnSchedule:" + lessonId);
startLessonJob.getJobDataMap().put(MonitoringConstants.KEY_LESSON_ID,new Long(lessonId));
//create customized triggers
- Trigger startLessonTrigger = new SimpleTrigger("startLessonOnScheduleTrigger",
+ Trigger startLessonTrigger = new SimpleTrigger("startLessonOnScheduleTrigger:"+ lessonId,
Scheduler.DEFAULT_GROUP,
startDate);
//start the scheduling job
@@ -521,10 +521,10 @@
JobDetail finishLessonJob = getFinishScheduleLessonJob();
//setup the message for scheduling job
- finishLessonJob.setName("finishLessonOnSchedule");
+ finishLessonJob.setName("finishLessonOnSchedule:"+lessonId);
finishLessonJob.getJobDataMap().put(MonitoringConstants.KEY_LESSON_ID,new Long(lessonId));
//create customized triggers
- Trigger finishLessonTrigger = new SimpleTrigger("finishLessonOnScheduleTrigger",
+ Trigger finishLessonTrigger = new SimpleTrigger("finishLessonOnScheduleTrigger:"+lessonId,
Scheduler.DEFAULT_GROUP,
endDate);
//start the scheduling job
@@ -1420,19 +1420,19 @@
JobDetail openScheduleGateJob = getOpenScheduleGateJob();
JobDetail closeScheduleGateJob = getCloseScheduleGateJob();
//setup the message for scheduling job
- openScheduleGateJob.setName("openGate");
+ openScheduleGateJob.setName("openGate:" + scheduleGate.getActivityId());
openScheduleGateJob.getJobDataMap().put("gateId",scheduleGate.getActivityId());
closeScheduleGateJob.setName("closeGate");
closeScheduleGateJob.getJobDataMap().put("gateId",scheduleGate.getActivityId());
//create customized triggers
- Trigger openGateTrigger = new SimpleTrigger("openGateTrigger",
+ Trigger openGateTrigger = new SimpleTrigger("openGateTrigger:" + scheduleGate.getActivityId(),
Scheduler.DEFAULT_GROUP,
scheduleGate.getLessonGateOpenTime(lessonStartTime));
- Trigger closeGateTrigger = new SimpleTrigger("closeGateTrigger",
+ Trigger closeGateTrigger = new SimpleTrigger("closeGateTrigger:" + scheduleGate.getActivityId(),
Scheduler.DEFAULT_GROUP,
scheduleGate.getLessonGateCloseTime(lessonStartTime));
Fisheye: Tag d2c7363ac0242caa259b49112d85ffa9671c30e6 refers to a dead (removed) revision in file `lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/OpenScheduleGateJob.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag d2c7363ac0242caa259b49112d85ffa9671c30e6 refers to a dead (removed) revision in file `lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/StartScheduleLesson.java'.
Fisheye: No comparison available. Pass `N' to diff?