You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by pa...@apache.org on 2019/01/23 14:51:31 UTC
svn commit: r1851929 - in /turbine/fulcrum/trunk/xslt/src:
java/org/apache/fulcrum/xslt/ test/org/apache/fulcrum/xslt/
Author: painter
Date: Wed Jan 23 14:51:31 2019
New Revision: 1851929
URL: http://svn.apache.org/viewvc?rev=1851929&view=rev
Log:
JavaDoc cleanup, enforce Turbine coding standards
Modified:
turbine/fulcrum/trunk/xslt/src/java/org/apache/fulcrum/xslt/DefaultXSLTService.java
turbine/fulcrum/trunk/xslt/src/java/org/apache/fulcrum/xslt/XSLTServiceFacade.java
turbine/fulcrum/trunk/xslt/src/test/org/apache/fulcrum/xslt/XSLTServiceFacadeTest.java
turbine/fulcrum/trunk/xslt/src/test/org/apache/fulcrum/xslt/XSLTServiceTest.java
Modified: turbine/fulcrum/trunk/xslt/src/java/org/apache/fulcrum/xslt/DefaultXSLTService.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/xslt/src/java/org/apache/fulcrum/xslt/DefaultXSLTService.java?rev=1851929&r1=1851928&r2=1851929&view=diff
==============================================================================
--- turbine/fulcrum/trunk/xslt/src/java/org/apache/fulcrum/xslt/DefaultXSLTService.java (original)
+++ turbine/fulcrum/trunk/xslt/src/java/org/apache/fulcrum/xslt/DefaultXSLTService.java Wed Jan 23 14:51:31 2019
@@ -76,7 +76,7 @@ public class DefaultXSLTService extends
protected boolean caching = false;
/**
- * Path to style sheets used for tranforming well-formed XML documents. The
+ * Path to style sheets used for transforming well-formed XML documents. The
* path is relative to the webapp context.
*/
protected String path;
@@ -188,6 +188,15 @@ public class DefaultXSLTService extends
}
}
+ /**
+ * Transform the XML file
+ *
+ * @param xslName the name of the XSL file
+ * @param xmlin source xml
+ * @param xmlout resulting xml
+ * @param params A set of parameters that will be forwarded to the XSLT
+ * @throws Exception if the transform fails
+ */
protected void transform(String xslName, Source xmlin, Result xmlout, Map<?, ?> params)
throws Exception
{
@@ -229,6 +238,8 @@ public class DefaultXSLTService extends
* The reader that passes the xml to be transformed
* @param out
* The writer for the transformed output
+ *
+ * @throws Exception if the transform fails
*/
public void transform(String xslName, Reader in, Writer out)
throws Exception
@@ -246,6 +257,8 @@ public class DefaultXSLTService extends
* The name of the file that contains the xsl stylesheet.
* @param in
* The reader that passes the xml to be transformed
+ *
+ * @throws Exception if the transform fails
*/
public String transform(String xslName, Reader in) throws Exception
{
@@ -258,12 +271,16 @@ public class DefaultXSLTService extends
* Uses an xsl file to transform xml input from a DOM note and writes the
* output to a writer.
*
+ * @see org.apache.fulcrum.xslt.XSLTService#transform(java.lang.String, org.w3c.dom.Node, java.io.Writer)
+ *
* @param xslName
* The name of the file that contains the xsl stylesheet.
* @param in
* The DOM Node to be transformed
* @param out
* The writer for the transformed output
+ *
+ * @throws Exception if the transform fails
*/
public void transform(String xslName, Node in, Writer out)
throws Exception
@@ -281,6 +298,8 @@ public class DefaultXSLTService extends
* The name of the file that contains the xsl stylesheet.
* @param in
* The DOM Node to be transformed
+ *
+ * @throws Exception if the transform fails
*/
public String transform(String xslName, Node in)
throws Exception
@@ -302,6 +321,8 @@ public class DefaultXSLTService extends
* The writer for the transformed output
* @param params
* A set of parameters that will be forwarded to the XSLT
+ *
+ * @throws Exception if the transform fails
*/
public void transform(String xslName, Reader in, Writer out, Map<?, ?> params)
throws Exception
@@ -321,6 +342,8 @@ public class DefaultXSLTService extends
* The reader that passes the xml to be transformed
* @param params
* A set of parameters that will be forwarded to the XSLT
+ *
+ * @throws Exception if the transform fails
*/
public String transform(String xslName, Reader in, Map<?, ?> params)
throws Exception
@@ -342,6 +365,8 @@ public class DefaultXSLTService extends
* The writer for the transformed output
* @param params
* A set of parameters that will be forwarded to the XSLT
+ *
+ * @throws Exception if the transform fails
*/
public void transform(String xslName, Node in, Writer out, Map<?, ?> params)
throws Exception
@@ -361,6 +386,8 @@ public class DefaultXSLTService extends
* The DOM Node to be transformed
* @param params
* A set of parameters that will be forwarded to the XSLT
+ *
+ * @throws Exception if the transform fails
*/
public String transform(String xslName, Node in, Map<?, ?> params)
throws Exception
@@ -376,10 +403,11 @@ public class DefaultXSLTService extends
* @param xslName The name of the file that contains the xsl stylesheet.
* @param params A set of parameters that will be forwarded to the XSLT
* @return the transformed output
- * @throws Exception the transformation failed
+ *
+ * @throws Exception if the transform fails
*/
- public String transform(String xslName, Map<?, ?> params) throws Exception {
-
+ public String transform(String xslName, Map<?, ?> params) throws Exception
+ {
StringWriter sw = new StringWriter();
transform(xslName, sw, params);
return sw.toString();
@@ -393,8 +421,8 @@ public class DefaultXSLTService extends
* @param params A set of parameters that will be forwarded to the XSLT
* @throws Exception the transformation failed
*/
- public void transform(String xslName, Writer out, Map<?, ?> params) throws Exception {
-
+ public void transform(String xslName, Writer out, Map<?, ?> params) throws Exception
+ {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.newDocument();
@@ -437,8 +465,7 @@ public class DefaultXSLTService extends
*/
public void configure(Configuration conf) throws ConfigurationException
{
- StringBuilder sb = new StringBuilder(conf.getAttribute(STYLESHEET_PATH,
- "/"));
+ StringBuilder sb = new StringBuilder(conf.getAttribute(STYLESHEET_PATH, "/"));
// is URL?
if (!sb.toString().matches("[a-zA-Z]{3,}://.*"))
@@ -469,6 +496,9 @@ public class DefaultXSLTService extends
tfactory = TransformerFactory.newInstance();
}
+ /* (non-Javadoc)
+ * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+ */
public void contextualize(Context context) throws ContextException
{
this.applicationRoot = context.get("urn:avalon:home").toString();
Modified: turbine/fulcrum/trunk/xslt/src/java/org/apache/fulcrum/xslt/XSLTServiceFacade.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/xslt/src/java/org/apache/fulcrum/xslt/XSLTServiceFacade.java?rev=1851929&r1=1851928&r2=1851929&view=diff
==============================================================================
--- turbine/fulcrum/trunk/xslt/src/java/org/apache/fulcrum/xslt/XSLTServiceFacade.java (original)
+++ turbine/fulcrum/trunk/xslt/src/java/org/apache/fulcrum/xslt/XSLTServiceFacade.java Wed Jan 23 14:51:31 2019
@@ -182,7 +182,8 @@ public class XSLTServiceFacade
* @return the transformed output
* @throws Exception the transformation failed
*/
- public String transform(String xslName, Map<?, ?> params) throws Exception {
+ public String transform(String xslName, Map<?, ?> params) throws Exception
+ {
return getService().transform(xslName, params);
}
@@ -194,7 +195,8 @@ public class XSLTServiceFacade
* @param params A set of parameters that will be forwarded to the XSLT
* @throws Exception the transformation failed
*/
- public void transform(String xslName, Writer out, Map<?, ?> params) throws Exception {
+ public void transform(String xslName, Writer out, Map<?, ?> params) throws Exception
+ {
getService().transform(xslName, out, params);
}
}
Modified: turbine/fulcrum/trunk/xslt/src/test/org/apache/fulcrum/xslt/XSLTServiceFacadeTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/xslt/src/test/org/apache/fulcrum/xslt/XSLTServiceFacadeTest.java?rev=1851929&r1=1851928&r2=1851929&view=diff
==============================================================================
--- turbine/fulcrum/trunk/xslt/src/test/org/apache/fulcrum/xslt/XSLTServiceFacadeTest.java (original)
+++ turbine/fulcrum/trunk/xslt/src/test/org/apache/fulcrum/xslt/XSLTServiceFacadeTest.java Wed Jan 23 14:51:31 2019
@@ -1,7 +1,5 @@
package org.apache.fulcrum.xslt;
-import org.apache.fulcrum.testcontainer.BaseUnit5Test;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,39 +19,41 @@ import org.apache.fulcrum.testcontainer.
* under the License.
*/
-
-import org.apache.fulcrum.testcontainer.BaseUnitTest;
+import org.apache.fulcrum.testcontainer.BaseUnit5Test;
import org.junit.jupiter.api.Test;
-
/**
* Test the XSLTServiceFacade.
*
* @author <a href="epugh@upstate.com">Eric Pugh</a>
* @version $Id$
*/
-public class XSLTServiceFacadeTest extends BaseUnit5Test
+public class XSLTServiceFacadeTest extends BaseUnit5Test
{
+ /**
+ * @throws Exception generic exception
+ */
@Test
- public void testWorkflowFacadeNotConfigured() throws Exception
- {
- try
- {
- XSLTServiceFacade.getService();
- }
- catch (RuntimeException re)
- {
- //good;
- }
- }
-
+ public void testWorkflowFacadeNotConfigured() throws Exception
+ {
+ try
+ {
+ XSLTServiceFacade.getService();
+ } catch (RuntimeException re) {
+ // good;
+ }
+ }
+
+ /**
+ * @throws Exception generic exception
+ */
@Test
- public void testWorkflowFacadeConfigured() throws Exception
- {
- // this.lookup causes the workflow service to be configured.
+ public void testWorkflowFacadeConfigured() throws Exception
+ {
+ // this.lookup causes the workflow service to be configured.
this.lookup(XSLTService.ROLE);
XSLTServiceFacade.getService();
- }
+ }
}
Modified: turbine/fulcrum/trunk/xslt/src/test/org/apache/fulcrum/xslt/XSLTServiceTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/xslt/src/test/org/apache/fulcrum/xslt/XSLTServiceTest.java?rev=1851929&r1=1851928&r2=1851929&view=diff
==============================================================================
--- turbine/fulcrum/trunk/xslt/src/test/org/apache/fulcrum/xslt/XSLTServiceTest.java (original)
+++ turbine/fulcrum/trunk/xslt/src/test/org/apache/fulcrum/xslt/XSLTServiceTest.java Wed Jan 23 14:51:31 2019
@@ -46,9 +46,12 @@ import org.junit.jupiter.api.Test;
*/
public class XSLTServiceTest extends BaseUnit5Test
{
- private XSLTService xsltService = null;
-
+ /** The XSLTService **/
+ private XSLTService xsltService = null;
+ /**
+ * @throws Exception generic exception
+ */
@BeforeEach
protected void setUp() throws Exception
{
@@ -96,7 +99,7 @@ public class XSLTServiceTest extends Bas
@Test
public void testTransformXsltOnly() throws Exception
{
- Map values = new HashMap();
+ Map<String, String> values = new HashMap<String, String>();
values.put("name", "Fulcrum");
String result = xsltService.transform("hello.xslt", values );
assertTrue(result.contains("Hello Fulcrum"));