Author: vgritsenko
Date: Fri Mar 11 19:22:51 2005
New Revision: 157222
URL: http://svn.apache.org/viewcvs?view=rev&rev=157222
Log:
whitespaces, etc
Modified:
cocoon/blocks/unsupported/profiler/trunk/java/org/apache/cocoon/components/profiler/ProfilingCachingProcessingPipeline.java
cocoon/blocks/unsupported/profiler/trunk/java/org/apache/cocoon/components/profiler/ProfilingNonCachingProcessingPipeline.java
Modified:
cocoon/blocks/unsupported/profiler/trunk/java/org/apache/cocoon/components/profiler/ProfilingCachingProcessingPipeline.java
URL:
http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/profiler/trunk/java/org/apache/cocoon/components/profiler/ProfilingCachingProcessingPipeline.java?view=diff&r1=157221&r2=157222
==============================================================================
---
cocoon/blocks/unsupported/profiler/trunk/java/org/apache/cocoon/components/profiler/ProfilingCachingProcessingPipeline.java
(original)
+++
cocoon/blocks/unsupported/profiler/trunk/java/org/apache/cocoon/components/profiler/ProfilingCachingProcessingPipeline.java
Fri Mar 11 19:22:51 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,19 +34,18 @@
* @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;
- /* (non-Javadoc)
- * @see
org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+ /**
+ * Composable
*/
public void service(ServiceManager manager) throws ServiceException {
super.service(manager);
@@ -87,7 +86,7 @@
*/
public void setGenerator(String role, String source, Parameters param,
Parameters hintParam)
- throws ProcessingException {
+ throws ProcessingException {
super.setGenerator(role, source, param, hintParam);
@@ -111,7 +110,7 @@
*/
public void addTransformer(String role, String source, Parameters param,
Parameters hintParam)
- throws ProcessingException {
+ throws ProcessingException {
super.addTransformer(role, source, param, hintParam);
@@ -125,15 +124,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);
@@ -146,13 +146,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);
@@ -163,27 +164,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(this.processor.getSourceResolver(),
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();
@@ -191,10 +189,10 @@
trans.setup(this.processor.getSourceResolver(),
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(
@@ -204,24 +202,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();
}
/**
@@ -232,91 +230,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/blocks/unsupported/profiler/trunk/java/org/apache/cocoon/components/profiler/ProfilingNonCachingProcessingPipeline.java
URL:
http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/profiler/trunk/java/org/apache/cocoon/components/profiler/ProfilingNonCachingProcessingPipeline.java?view=diff&r1=157221&r2=157222
==============================================================================
---
cocoon/blocks/unsupported/profiler/trunk/java/org/apache/cocoon/components/profiler/ProfilingNonCachingProcessingPipeline.java
(original)
+++
cocoon/blocks/unsupported/profiler/trunk/java/org/apache/cocoon/components/profiler/ProfilingNonCachingProcessingPipeline.java
Fri Mar 11 19:22:51 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,23 +39,23 @@
* @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;
/* (non-Javadoc)
* @see
org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
*/
public void service(ServiceManager manager) throws ServiceException {
super.service(manager);
- this.profiler = (Profiler) manager.lookup(Profiler.ROLE);
+` this.profiler = (Profiler) manager.lookup(Profiler.ROLE);
}
/**
@@ -91,7 +91,7 @@
*/
public void setGenerator(String role, String source, Parameters param,
Parameters hintParam)
- throws ProcessingException {
+ throws ProcessingException {
super.setGenerator(role, source, param, hintParam);
@@ -115,29 +115,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);
@@ -150,13 +151,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);
@@ -172,12 +174,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(this.processor.getSourceResolver(),
environment.getObjectModel(),
generatorSource, generatorParam);
this.data.setSetupTime(0, System.currentTimeMillis()-time);
@@ -186,8 +186,8 @@
Iterator transformerSourceItt = this.transformerSources.iterator();
Iterator transformerParamItt = this.transformerParams.iterator();
+ // Setup transformers
int index = 1;
-
while (transformerItt.hasNext()) {
Transformer trans = (Transformer) transformerItt.next();
@@ -199,6 +199,7 @@
System.currentTimeMillis()-time);
}
+ // Setup serializer
time = System.currentTimeMillis();
if (this.serializer instanceof SitemapModelComponent) {
((SitemapModelComponent)this.serializer).setup(
@@ -210,7 +211,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) {
@@ -270,8 +271,8 @@
getLogger().warn("Profiler Data havn't any components to measure");
return super.processXMLPipeline(environment);
}
- }
-
+ }
+
/**
* Process the pipeline using a reader.
*/
@@ -293,7 +294,7 @@
} else {
getLogger().warn("Profiler Data havn't any components to
measure");
return super.processReader(environment);
- }
+ }
}
@@ -301,8 +302,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 {