Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 68655 invoked from network); 27 Sep 2004 13:40:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 27 Sep 2004 13:40:08 -0000 Received: (qmail 63164 invoked by uid 500); 27 Sep 2004 13:39:43 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 62906 invoked by uid 500); 27 Sep 2004 13:39:40 -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 62805 invoked by uid 99); 27 Sep 2004 13:39:39 -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; Mon, 27 Sep 2004 06:39:38 -0700 Received: (qmail 68144 invoked by uid 65534); 27 Sep 2004 13:39:37 -0000 Date: 27 Sep 2004 13:39:37 -0000 Message-ID: <20040927133937.68140.qmail@minotaur.apache.org> From: vgritsenko@apache.org To: cvs@cocoon.apache.org Subject: svn commit: rev 47288 - cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: vgritsenko Date: Mon Sep 27 06:39:36 2004 New Revision: 47288 Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java Log: dos2unix Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java Mon Sep 27 06:39:36 2004 @@ -1,92 +1,92 @@ -/* - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.cocoon.components.cron; - -import org.apache.avalon.framework.CascadingRuntimeException; -import org.apache.avalon.framework.configuration.Configurable; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; - -import org.apache.excalibur.source.Source; -import org.apache.excalibur.source.SourceResolver; - -import java.io.InputStream; -import java.io.InputStreamReader; - -/** - * A simple CronJob which calls an internal cocoon:// pipeline. - * - * You must provide it with a <pipeline>pipeline/to/call</pipeline> parameter in cocoon.xconf - * Your supplied pipeline String will have "cocoon://" prepended to it. - * If you set info log enabled, this will write the output of the pipeline to the cron log - * - * @author Giacomo Pati - * @author Reinhard Poetz - * @author Jeremy Quinn - * @version CVS $Id: CocoonPipelineCronJob.java 30941 2004-07-29 19:56:58Z vgritsenko $ - * - * @since 2.1.5 - */ -public class CocoonPipelineCronJob extends ServiceableCronJob - implements Configurable { - - private static final String CONFIG_FILE_PARAM = "pipeline"; - - private String pipeline; - - public void execute(String name) { - if (getLogger ().isDebugEnabled ()) { - getLogger().debug ("CocoonPipelineCronJob: " + name + ", calling pipeline: " + pipeline); - } - - SourceResolver resolver = null; - Source src = null; - try { - resolver = (SourceResolver)this.manager.lookup (SourceResolver.ROLE); - src = resolver.resolveURI ("cocoon://" + pipeline); - - InputStream is = src.getInputStream(); - InputStreamReader reader = new InputStreamReader (is); - StringBuffer sb = new StringBuffer (); - char[] b = new char[8192]; - int n; - while((n = reader.read (b)) > 0) { - sb.append (b, 0, n); - } - reader.close (); - if (getLogger ().isInfoEnabled ()) { - getLogger ().info ("CocoonPipelineCronJob: " + name + ", called pipeline: " + - pipeline + ", and received following content:\n" + sb.toString() ); - } - } catch(Exception e) { - throw new CascadingRuntimeException ("CocoonPipelineCronJob: " + name + ", raised an exception: ", e); - } finally { - if (resolver != null) { - resolver.release (src); - this.manager.release (resolver); - resolver = null; - src = null; - } - } - } - - public void configure(final Configuration config) throws ConfigurationException { - this.pipeline = config.getChild(CONFIG_FILE_PARAM).getValue(null); - if (this.pipeline == null) { - throw new ConfigurationException("CocoonPipelineCronJob has no pipeline configured."); - } - } -} +/* + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cocoon.components.cron; + +import org.apache.avalon.framework.CascadingRuntimeException; +import org.apache.avalon.framework.configuration.Configurable; +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; + +import org.apache.excalibur.source.Source; +import org.apache.excalibur.source.SourceResolver; + +import java.io.InputStream; +import java.io.InputStreamReader; + +/** + * A simple CronJob which calls an internal cocoon:// pipeline. + * + * You must provide it with a <pipeline>pipeline/to/call</pipeline> parameter in cocoon.xconf + * Your supplied pipeline String will have "cocoon://" prepended to it. + * If you set info log enabled, this will write the output of the pipeline to the cron log + * + * @author Giacomo Pati + * @author Reinhard Poetz + * @author Jeremy Quinn + * @version CVS $Id: CocoonPipelineCronJob.java 30941 2004-07-29 19:56:58Z vgritsenko $ + * + * @since 2.1.5 + */ +public class CocoonPipelineCronJob extends ServiceableCronJob + implements Configurable { + + private static final String CONFIG_FILE_PARAM = "pipeline"; + + private String pipeline; + + public void execute(String name) { + if (getLogger ().isDebugEnabled ()) { + getLogger().debug ("CocoonPipelineCronJob: " + name + ", calling pipeline: " + pipeline); + } + + SourceResolver resolver = null; + Source src = null; + try { + resolver = (SourceResolver)this.manager.lookup (SourceResolver.ROLE); + src = resolver.resolveURI ("cocoon://" + pipeline); + + InputStream is = src.getInputStream(); + InputStreamReader reader = new InputStreamReader (is); + StringBuffer sb = new StringBuffer (); + char[] b = new char[8192]; + int n; + while((n = reader.read (b)) > 0) { + sb.append (b, 0, n); + } + reader.close (); + if (getLogger ().isInfoEnabled ()) { + getLogger ().info ("CocoonPipelineCronJob: " + name + ", called pipeline: " + + pipeline + ", and received following content:\n" + sb.toString() ); + } + } catch(Exception e) { + throw new CascadingRuntimeException ("CocoonPipelineCronJob: " + name + ", raised an exception: ", e); + } finally { + if (resolver != null) { + resolver.release (src); + this.manager.release (resolver); + resolver = null; + src = null; + } + } + } + + public void configure(final Configuration config) throws ConfigurationException { + this.pipeline = config.getChild(CONFIG_FILE_PARAM).getValue(null); + if (this.pipeline == null) { + throw new ConfigurationException("CocoonPipelineCronJob has no pipeline configured."); + } + } +}