Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 12858 invoked from network); 22 Sep 2004 16:02:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 22 Sep 2004 16:02:37 -0000 Received: (qmail 49191 invoked by uid 500); 22 Sep 2004 16:02:33 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 49110 invoked by uid 500); 22 Sep 2004 16:02:33 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 49041 invoked by uid 99); 22 Sep 2004 16:02:32 -0000 X-ASF-Spam-Status: No, hits=-10.0 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 22 Sep 2004 09:02:29 -0700 Received: (qmail 12668 invoked by uid 65534); 22 Sep 2004 16:02:27 -0000 Date: 22 Sep 2004 16:02:27 -0000 Message-ID: <20040922160227.12665.qmail@minotaur.apache.org> From: vgritsenko@apache.org To: cvs@cocoon.apache.org Subject: svn commit: rev 47058 - in cocoon/trunk/src/blocks/cron/java/org/apache/cocoon: components/cron environment/background X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: vgritsenko Date: Wed Sep 22 09:02:25 2004 New Revision: 47058 Modified: cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobExecutor.java cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/environment/background/BackgroundEnvironment.java Log: finish syncing with 2.1. now test cron job should work. 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:02:25 2004 @@ -19,8 +19,10 @@ import org.apache.avalon.framework.context.Context; 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.Processor; import org.apache.cocoon.environment.background.BackgroundEnvironment; import org.apache.cocoon.environment.internal.EnvironmentHelper; @@ -78,11 +80,18 @@ Object job = null; String jobrole = null; + Processor processor; + try { + processor = (Processor)manager.lookup(Processor.ROLE); + } catch (ServiceException e) { + throw new JobExecutionException(e); + } + boolean release = false; boolean dispose = false; try { env.startingProcessing(); - EnvironmentHelper.enterProcessor(env.getProcessor(), manager, env); + EnvironmentHelper.enterProcessor(processor, manager, env); jobrole = (String)data.get(QuartzJobScheduler.DATA_MAP_ROLE); Modified: cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/environment/background/BackgroundEnvironment.java ============================================================================== --- cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/environment/background/BackgroundEnvironment.java (original) +++ cocoon/trunk/src/blocks/cron/java/org/apache/cocoon/environment/background/BackgroundEnvironment.java Wed Sep 22 09:02:25 2004 @@ -1,12 +1,12 @@ /* * Copyright 1999-2004 The Apache Software Foundation. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,65 +15,55 @@ */ package org.apache.cocoon.environment.background; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - import org.apache.avalon.framework.logger.Logger; -import org.apache.cocoon.Processor; + import org.apache.cocoon.environment.AbstractEnvironment; import org.apache.cocoon.environment.Context; -import org.apache.cocoon.environment.Environment; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Request; -import org.apache.cocoon.environment.SourceResolver; import org.apache.cocoon.environment.commandline.CommandLineContext; import org.apache.cocoon.environment.commandline.CommandLineRequest; import org.apache.cocoon.environment.commandline.CommandLineResponse; import org.apache.cocoon.util.NullOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Collections; +import java.util.HashMap; + /** * A simple implementation of org.apache.cocoon.environment.Environment * for pipeline calls which are not externally triggered. - * - * @author Reinhard Poetz - * @version CVS $Id: BackgroundEnvironment.java,v 1.7 2004/06/04 11:08:08 cziegeler Exp $ + * + * @author Reinhard Poetz + * @version CVS $Id$ * * @since 2.1.4 */ public class BackgroundEnvironment extends AbstractEnvironment { - - public BackgroundEnvironment(Logger logger, Context ctx) { - super("", null, null); - - this.enableLogging(logger); - - this.outputStream = new NullOutputStream(); - - // TODO Would special Background*-objects have advantages? - Request request = new CommandLineRequest( - this, // environment - "", // context path - "", // servlet path - "", // path info - new HashMap(), // attributes - Collections.EMPTY_MAP, // parameters - Collections.EMPTY_MAP // headers + + public BackgroundEnvironment(Logger logger, Context ctx) { + super("", null, null); + enableLogging(logger); + this.outputStream = new NullOutputStream(); + + // TODO Would special Background*-objects have advantages? + Request request = new CommandLineRequest( + this, // environment + "", // context path + "", // servlet path + "", // path info + new HashMap(), // attributes + Collections.EMPTY_MAP, // parameters + Collections.EMPTY_MAP // headers ); - this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request); - this.objectModel.put(ObjectModelHelper.RESPONSE_OBJECT, - new CommandLineResponse()); - this.objectModel.put(ObjectModelHelper.CONTEXT_OBJECT, ctx); - } - - /** Needed by EnvironmentHelper.enterEnvironment */ - public Processor getProcessor() { - return NullProcessor.INSTANCE; - } - + this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request); + this.objectModel.put(ObjectModelHelper.RESPONSE_OBJECT, + new CommandLineResponse()); + this.objectModel.put(ObjectModelHelper.CONTEXT_OBJECT, ctx); + } + /** * @param uri * @param view @@ -81,38 +71,35 @@ * @param stream * @param logger */ - public BackgroundEnvironment(String uri, - String view, - File context, + public BackgroundEnvironment(String uri, + String view, + File context, OutputStream stream, Logger logger) { - super(uri, view); - this.enableLogging(logger); - this.outputStream = stream; - + enableLogging(logger); + this.outputStream = stream; + // TODO Would special Background*-objects have advantages? Request request = new CommandLineRequest(this, "", uri, null, null, null); - this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request); + this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request); this.objectModel.put(ObjectModelHelper.RESPONSE_OBJECT, new CommandLineResponse()); this.objectModel.put(ObjectModelHelper.CONTEXT_OBJECT, - new CommandLineContext(context.getAbsolutePath()) ); - + new CommandLineContext(context.getAbsolutePath())); } /* (non-Javadoc) * @see org.apache.cocoon.environment.Environment#redirect(java.lang.String, boolean, boolean) */ public void redirect(String newURL, boolean global, boolean permanent) throws IOException { - + } /** * @see org.apache.cocoon.environment.Environment#setContentType(java.lang.String) */ public void setContentType(String mimeType) { - } /** @@ -126,46 +113,14 @@ * @see org.apache.cocoon.environment.Environment#setContentLength(int) */ public void setContentLength(int length) { - } /** * Always return false - * + * * @see org.apache.cocoon.environment.Environment#isExternal() */ public boolean isExternal() { return false; - } - - /** Dumb implementation needed by CocoonComponentManager.enterEnvironment() */ - public static class NullProcessor implements Processor { - - public static final Processor INSTANCE = new NullProcessor(); - - public boolean process(Environment environment) throws Exception { - throw new UnsupportedOperationException(); - } - - public Map getComponentConfigurations() { - throw new UnsupportedOperationException(); - } - - public Processor getRootProcessor() { - throw new UnsupportedOperationException(); - } - - public InternalPipelineDescription buildPipeline(Environment environment) - throws Exception { - throw new UnsupportedOperationException(); - } - - public String getContext() { - throw new UnsupportedOperationException(); - } - - public SourceResolver getSourceResolver() { - throw new UnsupportedOperationException(); - } } }