cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject svn commit: rev 47061 - cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron
Date Wed, 22 Sep 2004 16:34:55 GMT
Author: unico
Date: Wed Sep 22 09:34:53 2004
New Revision: 47061

Modified:
   cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzDriverDelegate.java
   cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobExecutor.java
   cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobScheduler.java
   cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobStoreCMT.java
   cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobStoreTX.java
   cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/TestCronJob.java
Log:
pass the application context instead of the environment context 
and remove and add transient context object to the data map

Modified: cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzDriverDelegate.java
==============================================================================
--- cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzDriverDelegate.java
(original)
+++ cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzDriverDelegate.java
Wed Sep 22 09:34:53 2004
@@ -15,11 +15,10 @@
  */
 package org.apache.cocoon.components.cron;
 
+import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceManager;
 
-import org.apache.cocoon.environment.Context;
-
 import org.quartz.Calendar;
 import org.quartz.CronTrigger;
 import org.quartz.JobDataMap;
@@ -90,7 +89,7 @@
             this.logger.debug("QuartzDriverDelegate: Removing transient data");
             map.remove(QuartzJobScheduler.DATA_MAP_LOGGER);
             map.remove(QuartzJobScheduler.DATA_MAP_MANAGER);
-            map.remove(QuartzJobScheduler.DATA_MAP_ENV_CONTEXT);
+            map.remove(QuartzJobScheduler.DATA_MAP_CONTEXT);
         }
     }
 
@@ -105,7 +104,7 @@
                 this.logger.debug("QuartzDriverDelegate: Adding transient data");
                 map.put(QuartzJobScheduler.DATA_MAP_LOGGER, this.logger);
                 map.put(QuartzJobScheduler.DATA_MAP_MANAGER, this.manager);
-                map.put(QuartzJobScheduler.DATA_MAP_ENV_CONTEXT, this.context);
+                map.put(QuartzJobScheduler.DATA_MAP_CONTEXT, this.context);
             }
         }
         return job;

Modified: cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobExecutor.java
==============================================================================
--- cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobExecutor.java
(original)
+++ cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobExecutor.java
Wed Sep 22 09:34:53 2004
@@ -17,12 +17,15 @@
 
 import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 
+import org.apache.cocoon.Constants;
 import org.apache.cocoon.Processor;
+
 import org.apache.cocoon.environment.background.BackgroundEnvironment;
 import org.apache.cocoon.environment.internal.EnvironmentHelper;
 
@@ -72,8 +75,13 @@
 
         Context appContext = (Context) data.get(QuartzJobScheduler.DATA_MAP_CONTEXT);
         ServiceManager manager = (ServiceManager)data.get(QuartzJobScheduler.DATA_MAP_MANAGER);
-        org.apache.cocoon.environment.Context envContext =
-                (org.apache.cocoon.environment.Context)data.get(QuartzJobScheduler.DATA_MAP_ENV_CONTEXT);
+        org.apache.cocoon.environment.Context envContext;
+        try {
+        	envContext = (org.apache.cocoon.environment.Context) appContext.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
+        }
+        catch (ContextException e) {
+        	throw new JobExecutionException(e);
+        }
 
         BackgroundEnvironment env = new BackgroundEnvironment(logger, envContext);
 

Modified: cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobScheduler.java
==============================================================================
--- cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobScheduler.java
(original)
+++ cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobScheduler.java
Wed Sep 22 09:34:53 2004
@@ -105,9 +105,6 @@
     /** Map key for the service manager */
     static final String DATA_MAP_MANAGER = "QuartzJobScheduler.ServiceManager";
 
-    /** Map key for the environment context (needed by BackgroundEnvironment) */
-    static final String DATA_MAP_ENV_CONTEXT = "QuartzJobScheduler.EnvironmentContext";
-
     /** Map key for the logger */
     static final String DATA_MAP_LOGGER = "QuartzJobScheduler.Logger";
 
@@ -134,10 +131,7 @@
     static final String DEFAULT_QUARTZ_SCHEDULER_NAME = "Cocoon";
 
     /** The Avalon Context instance */
-    private Context applicationContext;
-
-    /** The Cocoon environment Context instance */
-    private org.apache.cocoon.environment.Context environmentContext;
+    private Context context;
 
     /** The PooledExecutor instance */
     private PooledExecutor executor;
@@ -314,8 +308,7 @@
      * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
      */
     public void contextualize(Context context) throws ContextException {
-    	this.applicationContext = context;
-        this.environmentContext = (org.apache.cocoon.environment.Context)context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
+    	this.context = context;
     }
 
     public void initialize() throws Exception {
@@ -555,9 +548,8 @@
 
         jobDataMap.put(DATA_MAP_NAME, name);
         jobDataMap.put(DATA_MAP_LOGGER, getLogger());
-        jobDataMap.put(DATA_MAP_CONTEXT, this.applicationContext);
+        jobDataMap.put(DATA_MAP_CONTEXT, this.context);
         jobDataMap.put(DATA_MAP_MANAGER, this.manager);
-        jobDataMap.put(DATA_MAP_ENV_CONTEXT, this.environmentContext);
         jobDataMap.put(DATA_MAP_RUN_CONCURRENT, new Boolean(canRunConcurrently));
 
         if (null != params) {
@@ -715,9 +707,9 @@
 
         JobStoreSupport store = null;
         if (type.equals("tx")) {
-            store = new QuartzJobStoreTX(getLogger(), this.manager, this.environmentContext);
+            store = new QuartzJobStoreTX(getLogger(), this.manager, this.context);
         } else if (type.equals("cmt")) {
-            store = new QuartzJobStoreCMT(getLogger(), this.manager, this.environmentContext);
+            store = new QuartzJobStoreCMT(getLogger(), this.manager, this.context);
         } else {
             throw new ConfigurationException("Unknown store type: " + type);
         }

Modified: cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobStoreCMT.java
==============================================================================
--- cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobStoreCMT.java
(original)
+++ cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobStoreCMT.java
Wed Sep 22 09:34:53 2004
@@ -15,10 +15,9 @@
  */
 package org.apache.cocoon.components.cron;
 
+import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceManager;
-
-import org.apache.cocoon.environment.Context;
 
 import org.quartz.impl.jdbcjobstore.DriverDelegate;
 import org.quartz.impl.jdbcjobstore.JobStoreCMT;

Modified: cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobStoreTX.java
==============================================================================
--- cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobStoreTX.java
(original)
+++ cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobStoreTX.java
Wed Sep 22 09:34:53 2004
@@ -15,10 +15,9 @@
  */
 package org.apache.cocoon.components.cron;
 
+import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceManager;
-
-import org.apache.cocoon.environment.Context;
 
 import org.quartz.impl.jdbcjobstore.JobStoreTX;
 import org.quartz.impl.jdbcjobstore.DriverDelegate;

Modified: cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/TestCronJob.java
==============================================================================
--- cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/TestCronJob.java	(original)
+++ cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/TestCronJob.java	Wed
Sep 22 09:34:53 2004
@@ -15,7 +15,6 @@
  */
 package org.apache.cocoon.components.cron;
 
-import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.Date;
 import java.util.Map;

Mime
View raw message