Author: vgritsenko Date: Fri Mar 11 19:20:53 2005 New Revision: 157221 URL: http://svn.apache.org/viewcvs?view=rev&rev=157221 Log: whitespaces, etc
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon/components/profiler/ProfilingCachingProcessingPipeline.java cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon/components/profiler/ProfilingNonCachingProcessingPipeline.java Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon/components/profiler/ProfilingCachingProcessingPipeline.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon/components/profiler/ProfilingCachingProcessingPipeline.java?view=diff&r1=157220&r2=157221 ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon/components/profiler/ProfilingCachingProcessingPipeline.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon/components/profiler/ProfilingCachingProcessingPipeline.java Fri Mar 11 19:20:53 2005 @@ -1,12 +1,12 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. - * + * Copyright 1999-2005 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. @@ -34,24 +34,22 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a> * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a> * @author <a href="mailto:[EMAIL PROTECTED]">Bruno Dumon</a> - * @version CVS $Id$ + * @version $Id$ */ -public class ProfilingCachingProcessingPipeline - extends CachingProcessingPipeline { +public class ProfilingCachingProcessingPipeline extends CachingProcessingPipeline { private Profiler profiler; - private ProfilerData data = null; + private ProfilerData data; - private int index = 0; + private int index; /** * Composable * - * @param manager + * @param manager */ public void compose(ComponentManager manager) throws ComponentException { - super.compose(manager); this.profiler = (Profiler) manager.lookup(Profiler.ROLE); } @@ -91,7 +89,7 @@ */ public void setGenerator(String role, String source, Parameters param, Parameters hintParam) - throws ProcessingException { + throws ProcessingException { super.setGenerator(role, source, param, hintParam); @@ -116,7 +114,7 @@ */ public void addTransformer(String role, String source, Parameters param, Parameters hintParam) - throws ProcessingException { + throws ProcessingException { super.addTransformer(role, source, param, hintParam); @@ -130,15 +128,16 @@ /** * Set the serializer for this pipeline * - * @param role - * @param source - * @param param - * @param hintParam - * @param mimeType + * @param role + * @param source + * @param param + * @param hintParam + * @param mimeType */ public void setSerializer(String role, String source, Parameters param, Parameters hintParam, - String mimeType) throws ProcessingException { + String mimeType) + throws ProcessingException { super.setSerializer(role, source, param, hintParam, mimeType); @@ -151,13 +150,14 @@ /** * Set the reader for this pipeline * - * @param role - * @param source - * @param param - * @param mimeType + * @param role + * @param source + * @param param + * @param mimeType */ public void setReader(String role, String source, Parameters param, - String mimeType) throws ProcessingException { + String mimeType) + throws ProcessingException { super.setReader(role, source, param, mimeType); @@ -168,27 +168,24 @@ } /** - * Setup pipeline components. - * - * @param environment + * Timed version of [EMAIL PROTECTED] org.apache.cocoon.components.pipeline.AbstractProcessingPipeline#setupPipeline} + * and [EMAIL PROTECTED] org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline#setupPipeline}. */ protected void setupPipeline(Environment environment) - throws ProcessingException { + throws ProcessingException { try { - - // setup the generator + // Setup the generator long time = System.currentTimeMillis(); - this.generator.setup(environment, environment.getObjectModel(), generatorSource, generatorParam); - this.data.setSetupTime(0, System.currentTimeMillis()-time); + this.data.setSetupTime(0, System.currentTimeMillis() - time); Iterator transformerItt = this.transformers.iterator(); Iterator transformerSourceItt = this.transformerSources.iterator(); Iterator transformerParamItt = this.transformerParams.iterator(); + // Setup transformers int index = 1; - while (transformerItt.hasNext()) { Transformer trans = (Transformer) transformerItt.next(); @@ -196,10 +193,10 @@ trans.setup(environment, environment.getObjectModel(), (String) transformerSourceItt.next(), (Parameters) transformerParamItt.next()); - this.data.setSetupTime(index++, - System.currentTimeMillis()-time); + this.data.setSetupTime(index++, System.currentTimeMillis() - time); } + // Setup serializer time = System.currentTimeMillis(); if (this.serializer instanceof SitemapModelComponent) { ((SitemapModelComponent)this.serializer).setup( @@ -209,24 +206,24 @@ serializerParam ); } - this.data.setSetupTime(index++, System.currentTimeMillis()-time); + this.data.setSetupTime(index++, System.currentTimeMillis() - time); - this.setMimeTypeForSerializer(environment); + setMimeTypeForSerializer(environment); } catch (SAXException e) { throw new ProcessingException("Could not setup pipeline.", e); } catch (IOException e) { throw new ProcessingException("Could not setup pipeline.", e); } - // generate the key to fill the cache - this.generateCachingKey(environment); + // Generate the key to fill the cache + generateCachingKey(environment); - // test the cache for a valid response + // Test the cache for a valid response if (this.toCacheKey!=null) { - this.validatePipeline(environment); + validatePipeline(environment); } - this.setupValidities(); + setupValidities(); } /** @@ -237,91 +234,89 @@ * @return true on success */ public boolean process(Environment environment) - throws ProcessingException { - + throws ProcessingException { this.index = 0; - if (this.data!=null) { + if (this.data != null) { // Capture environment info this.data.setEnvironmentInfo(new EnvironmentInfo(environment)); // Execute pipeline long time = System.currentTimeMillis(); boolean result = super.process(environment); - - this.data.setTotalTime(System.currentTimeMillis()-time); + this.data.setTotalTime(System.currentTimeMillis() - time); // Report profiler.addResult(environment.getURI(), this.data); return result; } else { - getLogger().warn("Profiler Data havn't any components to measure"); + getLogger().warn("Profiler data has no components to measure"); return super.process(environment); } } /** * Process the SAX event pipeline + * FIXME: VG: Why override processXMLPipeline, not process(env, consumer)? */ - protected boolean processXMLPipeline(Environment environment) throws ProcessingException { + protected boolean processXMLPipeline(Environment environment) + throws ProcessingException { this.index = 0; - if (this.data!=null) { + if (this.data != null) { // Capture environment info this.data.setEnvironmentInfo(new EnvironmentInfo(environment)); // Execute pipeline long time = System.currentTimeMillis(); boolean result = super.processXMLPipeline(environment); - - this.data.setTotalTime(System.currentTimeMillis()-time); + this.data.setTotalTime(System.currentTimeMillis() - time); // Report profiler.addResult(environment.getURI(), this.data); return result; } else { - getLogger().warn("Profiler Data havn't any components to measure"); + getLogger().warn("Profiler data has no components to measure"); return super.processXMLPipeline(environment); } - } - + } + /** * Process the pipeline using a reader. */ - protected boolean processReader(Environment environment) throws ProcessingException { + protected boolean processReader(Environment environment) + throws ProcessingException { this.index = 0; - if (this.data!=null) { - // Capture environment info - this.data.setEnvironmentInfo(new EnvironmentInfo(environment)); - - // Execute pipeline - long time = System.currentTimeMillis(); - boolean result = super.processReader(environment); - - this.data.setTotalTime(System.currentTimeMillis()-time); - - // Report - profiler.addResult(environment.getURI(), this.data); - return result; - } else { - getLogger().warn("Profiler Data havn't any components to measure"); - return super.processReader(environment); - } + if (this.data != null) { + // Capture environment info + this.data.setEnvironmentInfo(new EnvironmentInfo(environment)); + + // Execute pipeline + long time = System.currentTimeMillis(); + boolean result = super.processReader(environment); + this.data.setTotalTime(System.currentTimeMillis() - time); + + // Report + profiler.addResult(environment.getURI(), this.data); + return result; + } else { + getLogger().warn("Profiler data has no components to measure"); + return super.processReader(environment); + } } /** * Connect the next component * * @param environment - * @param producer - * @param consumer + * @param producer + * @param consumer */ protected void connect(Environment environment, XMLProducer producer, - XMLConsumer consumer) throws ProcessingException { + XMLConsumer consumer) + throws ProcessingException { ProfilingXMLPipe connector = new ProfilingXMLPipe(); - connector.setup(this.index, this.data); this.index++; super.connect(environment, producer, connector); super.connect(environment, connector, consumer); } - } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon/components/profiler/ProfilingNonCachingProcessingPipeline.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon/components/profiler/ProfilingNonCachingProcessingPipeline.java?view=diff&r1=157220&r2=157221 ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon/components/profiler/ProfilingNonCachingProcessingPipeline.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon/components/profiler/ProfilingNonCachingProcessingPipeline.java Fri Mar 11 19:20:53 2005 @@ -1,12 +1,12 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. - * + * Copyright 1999-2005 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. @@ -39,16 +39,16 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a> * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a> * @author <a href="mailto:[EMAIL PROTECTED]">Bruno Dumon</a> - * @version CVS $Id$ + * @version $Id$ */ -public class ProfilingNonCachingProcessingPipeline - extends NonCachingProcessingPipeline implements Disposable { +public class ProfilingNonCachingProcessingPipeline extends NonCachingProcessingPipeline + implements Disposable { private Profiler profiler; - private ProfilerData data = null; + private ProfilerData data; - private int index = 0; + private int index; /** * Composable @@ -56,7 +56,6 @@ * @param manager */ public void compose(ComponentManager manager) throws ComponentException { - super.compose(manager); this.profiler = (Profiler) manager.lookup(Profiler.ROLE); } @@ -95,7 +94,7 @@ */ public void setGenerator(String role, String source, Parameters param, Parameters hintParam) - throws ProcessingException { + throws ProcessingException { super.setGenerator(role, source, param, hintParam); @@ -120,29 +119,30 @@ */ public void addTransformer(String role, String source, Parameters param, Parameters hintParam) - throws ProcessingException { + throws ProcessingException { super.addTransformer(role, source, param, hintParam); if (this.data==null) { this.data = new ProfilerData(); } - this.data.addComponent(super.transformers.get(super.transformers.size()- - 1), role, source); + this.data.addComponent(super.transformers.get(super.transformers.size() - 1), + role, source); } /** * Set the serializer for this pipeline * - * @param role - * @param source - * @param param - * @param hintParam - * @param mimeType + * @param role + * @param source + * @param param + * @param hintParam + * @param mimeType */ public void setSerializer(String role, String source, Parameters param, Parameters hintParam, - String mimeType) throws ProcessingException { + String mimeType) + throws ProcessingException { super.setSerializer(role, source, param, hintParam, mimeType); @@ -155,13 +155,14 @@ /** * Set the reader for this pipeline * - * @param role - * @param source - * @param param - * @param mimeType + * @param role + * @param source + * @param param + * @param mimeType */ public void setReader(String role, String source, Parameters param, - String mimeType) throws ProcessingException { + String mimeType) + throws ProcessingException { super.setReader(role, source, param, mimeType); @@ -177,12 +178,10 @@ * @param environment */ protected void setupPipeline(Environment environment) - throws ProcessingException { + throws ProcessingException { try { - - // setup the generator + // Setup the generator long time = System.currentTimeMillis(); - this.generator.setup(environment, environment.getObjectModel(), generatorSource, generatorParam); this.data.setSetupTime(0, System.currentTimeMillis()-time); @@ -191,8 +190,8 @@ Iterator transformerSourceItt = this.transformerSources.iterator(); Iterator transformerParamItt = this.transformerParams.iterator(); + // Setup transformers int index = 1; - while (transformerItt.hasNext()) { Transformer trans = (Transformer) transformerItt.next(); @@ -204,6 +203,7 @@ System.currentTimeMillis()-time); } + // Setup serializer time = System.currentTimeMillis(); if (this.serializer instanceof SitemapModelComponent) { ((SitemapModelComponent)this.serializer).setup( @@ -215,7 +215,7 @@ } this.data.setSetupTime(index++, System.currentTimeMillis()-time); - this.setMimeTypeForSerializer(environment); + setMimeTypeForSerializer(environment); } catch (SAXException e) { throw new ProcessingException("Could not setup pipeline.", e); } catch (IOException e) { @@ -275,8 +275,8 @@ getLogger().warn("Profiler Data havn't any components to measure"); return super.processXMLPipeline(environment); } - } - + } + /** * Process the pipeline using a reader. */ @@ -298,7 +298,7 @@ } else { getLogger().warn("Profiler Data havn't any components to measure"); return super.processReader(environment); - } + } } @@ -306,8 +306,8 @@ * Connect the next component * * @param environment - * @param producer - * @param consumer + * @param producer + * @param consumer */ protected void connect(Environment environment, XMLProducer producer, XMLConsumer consumer) throws ProcessingException {