You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by il...@apache.org on 2013/02/26 14:25:03 UTC
svn commit: r1450163 -
/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/
Author: ilgrosso
Date: Tue Feb 26 13:25:02 2013
New Revision: 1450163
URL: http://svn.apache.org/r1450163
Log:
White noise: formatting
Modified:
cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/ControllerContextAwareStringTemplateGenerator.java
cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/STRenderer.java
cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java
cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateReader.java
cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateTransformer.java
Modified: cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/ControllerContextAwareStringTemplateGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/ControllerContextAwareStringTemplateGenerator.java?rev=1450163&r1=1450162&r2=1450163&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/ControllerContextAwareStringTemplateGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/ControllerContextAwareStringTemplateGenerator.java Tue Feb 26 13:25:02 2013
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -37,8 +37,7 @@ public class ControllerContextAwareStrin
throws IOException {
// put all objects that are passed by the controller context
- Map<String, Object> controllerContext =
- ControllerContextHelper.getContext(this.parameters);
+ Map<String, Object> controllerContext = ControllerContextHelper.getContext(this.parameters);
if (controllerContext == null || controllerContext.isEmpty()) {
controllerContext = this.parameters;
@@ -47,7 +46,6 @@ public class ControllerContextAwareStrin
controllerContext.putAll(this.parameters);
}
- return STRenderer.getInstance().render(
- getTemplate(), controllerContext);
+ return STRenderer.getInstance().render(getTemplate(), controllerContext);
}
}
Modified: cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/STRenderer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/STRenderer.java?rev=1450163&r1=1450162&r2=1450163&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/STRenderer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/STRenderer.java Tue Feb 26 13:25:02 2013
@@ -1,9 +1,12 @@
/*
- * 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ * 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,
@@ -20,13 +23,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.stringtemplate.v4.ST;
-public class STRenderer {
+public final class STRenderer {
/**
* Logger.
*/
- private static final Logger LOG =
- LoggerFactory.getLogger(STRenderer.class);
+ private static final Logger LOG = LoggerFactory.getLogger(STRenderer.class);
private static final STRenderer SINGLETON;
@@ -35,15 +37,14 @@ public class STRenderer {
}
private STRenderer() {
- super();
+ // Empty private constructor for singleton classes
}
public static STRenderer getInstance() {
return SINGLETON;
}
- public String render(final String template,
- final Map<String, Object> parameters)
+ public String render(final String template, final Map<String, Object> parameters)
throws IOException {
final ST stringTemplate = new ST(template, '$', '$');
@@ -54,12 +55,11 @@ public class STRenderer {
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
stringTemplate.add(entry.getKey().replace(".", "_"),
(entry.getValue() instanceof String)
- ? StringEscapeUtils.escapeXml(
- entry.getValue().toString())
+ ? StringEscapeUtils.escapeXml(entry.getValue().toString())
: entry.getValue());
- LOG.debug("Passing pipeline parameter as attribute: key={}"
- + ", value={}", entry.getKey(), entry.getValue());
+ LOG.debug("Passing pipeline parameter as attribute: key={}, value={}",
+ entry.getKey(), entry.getValue());
}
}
Modified: cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java?rev=1450163&r1=1450162&r2=1450163&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java Tue Feb 26 13:25:02 2013
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -80,7 +80,7 @@ public class StringTemplateGenerator ext
this.string = string;
}
- public void setStream(InputStream stream) {
+ public void setStream(final InputStream stream) {
this.stream = stream;
}
@@ -126,14 +126,10 @@ public class StringTemplateGenerator ext
templateLocation = String.class.getName();
}
} finally {
- if (localStream != null) {
- IOUtils.closeQuietly(localStream);
- }
+ IOUtils.closeQuietly(localStream);
}
- if (LOG.isDebugEnabled() && templateLocation != null) {
- LOG.debug("Using template: {}", templateLocation);
- }
+ LOG.debug("Using template: {}", templateLocation);
return template;
}
@@ -178,6 +174,6 @@ public class StringTemplateGenerator ext
@Override
public void setConfiguration(final Map<String, ? extends Object> parameters) {
this.url = (URL) parameters.get("source");
- setup((Map<String, Object>) parameters);
+ this.setup((Map<String, Object>) parameters);
}
}
Modified: cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateReader.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateReader.java?rev=1450163&r1=1450162&r2=1450163&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateReader.java (original)
+++ cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateReader.java Tue Feb 26 13:25:02 2013
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -23,7 +23,6 @@ import java.io.OutputStreamWriter;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
-import java.util.Map.Entry;
import org.apache.cocoon.pipeline.ProcessingException;
import org.apache.cocoon.pipeline.caching.CacheKey;
import org.apache.cocoon.pipeline.caching.CompoundCacheKey;
@@ -96,7 +95,7 @@ public class StringTemplateReader extend
final ST stringTemplate = new ST(IOUtils.toString(inputStream, "UTF-8"), '$', '$');
final Map<String, Object> controllerContext = ControllerContextHelper.getContext(this.parameters);
- for (Entry<String, Object> eachEntry : controllerContext.entrySet()) {
+ for (Map.Entry<String, Object> eachEntry : controllerContext.entrySet()) {
stringTemplate.add(eachEntry.getKey(),
StringEscapeUtils.escapeXml(eachEntry.getValue().toString()));
}
Modified: cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateTransformer.java?rev=1450163&r1=1450162&r2=1450163&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateTransformer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateTransformer.java Tue Feb 26 13:25:02 2013
@@ -1,11 +1,12 @@
/*
- * Copyright 2011 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
*
- * 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
+ * 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,