SLING-941: Lots of svn:eol-style settings missing
Set svn:eol-style to native on all Java files that lack the setting.
git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk@768268 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java b/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java
index f605ad9..64d4f31 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java
@@ -1,75 +1,75 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc;
-
-import java.io.Reader;
-
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-import javax.script.ScriptException;
-
-import org.apache.sling.api.scripting.SlingBindings;
-import org.apache.sling.api.scripting.SlingScriptHelper;
-import org.apache.sling.scripting.api.AbstractSlingScriptEngine;
-import org.apache.sling.scripting.xproc.xpl.XplBuilder;
-import org.apache.sling.scripting.xproc.xpl.api.Pipeline;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A {@link ScriptEngine} that uses XPL definition files
- * in order to execute pipelines over Sling resources.
- *
- * @see http://www.w3.org/TR/xproc/
- */
-public class XProcScriptEngine extends AbstractSlingScriptEngine {
-
- private static final Logger log = LoggerFactory.getLogger(XProcScriptEngine.class);
-
- protected XProcScriptEngine(ScriptEngineFactory factory) {
- super(factory);
- }
-
- public Object eval(Reader reader, ScriptContext scriptContext) throws ScriptException {
- Bindings bindings = scriptContext.getBindings(ScriptContext.ENGINE_SCOPE);
- SlingScriptHelper helper = (SlingScriptHelper) bindings.get(SlingBindings.SLING);
- if (helper == null) {
- throw new ScriptException("SlingScriptHelper missing from bindings");
- }
-
- String scriptName = helper.getScript().getScriptResource().getPath();
-
- try {
- XplBuilder xplBuilder = new XplBuilder();
- Pipeline xpl = (Pipeline) xplBuilder.build(reader);
- xpl.getEnv().setSling(helper);
- xpl.eval();
- } catch (Throwable t) {
- log.error("Failure running XProc script.", t);
- final ScriptException se = new ScriptException("Failure running XProc script " + scriptName);
- se.initCause(t);
- throw se;
- }
-
- return null;
- }
-
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc;
+
+import java.io.Reader;
+
+import javax.script.Bindings;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptException;
+
+import org.apache.sling.api.scripting.SlingBindings;
+import org.apache.sling.api.scripting.SlingScriptHelper;
+import org.apache.sling.scripting.api.AbstractSlingScriptEngine;
+import org.apache.sling.scripting.xproc.xpl.XplBuilder;
+import org.apache.sling.scripting.xproc.xpl.api.Pipeline;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A {@link ScriptEngine} that uses XPL definition files
+ * in order to execute pipelines over Sling resources.
+ *
+ * @see http://www.w3.org/TR/xproc/
+ */
+public class XProcScriptEngine extends AbstractSlingScriptEngine {
+
+ private static final Logger log = LoggerFactory.getLogger(XProcScriptEngine.class);
+
+ protected XProcScriptEngine(ScriptEngineFactory factory) {
+ super(factory);
+ }
+
+ public Object eval(Reader reader, ScriptContext scriptContext) throws ScriptException {
+ Bindings bindings = scriptContext.getBindings(ScriptContext.ENGINE_SCOPE);
+ SlingScriptHelper helper = (SlingScriptHelper) bindings.get(SlingBindings.SLING);
+ if (helper == null) {
+ throw new ScriptException("SlingScriptHelper missing from bindings");
+ }
+
+ String scriptName = helper.getScript().getScriptResource().getPath();
+
+ try {
+ XplBuilder xplBuilder = new XplBuilder();
+ Pipeline xpl = (Pipeline) xplBuilder.build(reader);
+ xpl.getEnv().setSling(helper);
+ xpl.eval();
+ } catch (Throwable t) {
+ log.error("Failure running XProc script.", t);
+ final ScriptException se = new ScriptException("Failure running XProc script " + scriptName);
+ se.initCause(t);
+ throw se;
+ }
+
+ return null;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngineFactory.java b/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngineFactory.java
index fa047d5..fd49b82 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngineFactory.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngineFactory.java
@@ -1,55 +1,55 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc;
-
-import javax.script.ScriptEngine;
-
-import org.apache.sling.scripting.api.AbstractScriptEngineFactory;
-
-public class XProcScriptEngineFactory extends AbstractScriptEngineFactory {
-
- public final static String XPROC_SCRIPT_EXTENSION = "xpl";
-
- public final static String XPROC_MIME_TYPE = "application/xml";
-
- public final static String SHORT_NAME = "XProc";
-
- private static final String XPROC_NAME = "XMLProc";
-
- private static final String DEFAULT_XPROC_VERSION = "1.0";
-
- public XProcScriptEngineFactory() {
- setExtensions(XPROC_SCRIPT_EXTENSION);
- setMimeTypes(XPROC_MIME_TYPE);
- setNames(SHORT_NAME, "xml processing", "xml pipeline processor");
- }
-
- public ScriptEngine getScriptEngine() {
- return new XProcScriptEngine(this);
- }
-
- public String getLanguageName() {
- return XPROC_NAME;
- }
-
- public String getLanguageVersion() {
- return DEFAULT_XPROC_VERSION;
- }
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc;
+
+import javax.script.ScriptEngine;
+
+import org.apache.sling.scripting.api.AbstractScriptEngineFactory;
+
+public class XProcScriptEngineFactory extends AbstractScriptEngineFactory {
+
+ public final static String XPROC_SCRIPT_EXTENSION = "xpl";
+
+ public final static String XPROC_MIME_TYPE = "application/xml";
+
+ public final static String SHORT_NAME = "XProc";
+
+ private static final String XPROC_NAME = "XMLProc";
+
+ private static final String DEFAULT_XPROC_VERSION = "1.0";
+
+ public XProcScriptEngineFactory() {
+ setExtensions(XPROC_SCRIPT_EXTENSION);
+ setMimeTypes(XPROC_MIME_TYPE);
+ setNames(SHORT_NAME, "xml processing", "xml pipeline processor");
+ }
+
+ public ScriptEngine getScriptEngine() {
+ return new XProcScriptEngine(this);
+ }
+
+ public String getLanguageName() {
+ return XPROC_NAME;
+ }
+
+ public String getLanguageVersion() {
+ return DEFAULT_XPROC_VERSION;
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/cocoon/generator/SlingGenerator.java b/src/main/java/org/apache/sling/scripting/xproc/cocoon/generator/SlingGenerator.java
index de80c7f..7cfbe86 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/cocoon/generator/SlingGenerator.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/cocoon/generator/SlingGenerator.java
@@ -1,106 +1,106 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.cocoon.generator;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import javax.jcr.Session;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletResponse;
-
-import org.apache.cocoon.pipeline.component.sax.AbstractGenerator;
-import org.apache.cocoon.pipeline.util.XMLUtils;
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.scripting.SlingScriptHelper;
-import org.apache.sling.commons.mime.MimeTypeService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A Cocoon Generator that uses internal Sling
- * request processing in order to get the initial
- * XML for the pipeline.
- *
- * In order of preference the generator tries
- * to resolve the current resource as:
- *
- * +-- a XML file (adapts to {@link InputStream})
- * +-- dynamically generated XML (using inclusion procedure)
- * +-- the underlying node´s export document view
- */
-public class SlingGenerator extends AbstractGenerator {
-
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- private static final String XML_MIME_TYPE = "text/xml";
-
- private SlingHttpServletRequest request;
- private SlingHttpServletResponse response;
- private MimeTypeService mimeTypeService;
-
- public SlingGenerator(SlingScriptHelper sling) {
- this.request = sling.getRequest();
- this.response = sling.getResponse();
- this.mimeTypeService = sling.getService(MimeTypeService.class);
- }
-
- public void execute() {
- try {
- Session session;
- InputStream srcIs = genXmlSource();
- if (srcIs != null)
- XMLUtils.toSax(srcIs, this.getXMLConsumer());
- else if ((session = request.getResource().adaptTo(Session.class)) != null) {
- session.exportDocumentView(request.getResource().getPath(), this.getXMLConsumer(), true, true);
- } else
- throw new IllegalArgumentException("cannot generate xml source for " + request.getResource().getPath());
-
- } catch (Throwable t) {
- log.error("SlingGenerator: cannot generate xml source for "
- + request.getResource().getPath(), t);
- }
- }
-
- private InputStream genXmlSource() throws Exception {
-
- String xmlPath = request.getResource().getPath() + "." + mimeTypeService.getExtension(XML_MIME_TYPE);
-
- // The source is a xml file
- Resource xmlResource = this.request.getResourceResolver().resolve(xmlPath);
- InputStream xmlSourceFile = xmlResource.adaptTo(InputStream.class);
- if (xmlSourceFile != null)
- return xmlSourceFile;
-
- // The source is dynamically generated
- RequestDispatcher dispatcher = request.getRequestDispatcher(xmlPath);
- SlingGeneratorServletOutputStream output = new SlingGeneratorServletOutputStream();
- ServletResponse newResponse = new SlingGeneratorServletResponse(response, output);
- dispatcher.include(request, newResponse);
- byte[] bytes = output.toByteArray();
- if (bytes.length > 0)
- return new ByteArrayInputStream(bytes);
-
- return null;
-
- }
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.cocoon.generator;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import javax.jcr.Session;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletResponse;
+
+import org.apache.cocoon.pipeline.component.sax.AbstractGenerator;
+import org.apache.cocoon.pipeline.util.XMLUtils;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.scripting.SlingScriptHelper;
+import org.apache.sling.commons.mime.MimeTypeService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A Cocoon Generator that uses internal Sling
+ * request processing in order to get the initial
+ * XML for the pipeline.
+ *
+ * In order of preference the generator tries
+ * to resolve the current resource as:
+ *
+ * +-- a XML file (adapts to {@link InputStream})
+ * +-- dynamically generated XML (using inclusion procedure)
+ * +-- the underlying node´s export document view
+ */
+public class SlingGenerator extends AbstractGenerator {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private static final String XML_MIME_TYPE = "text/xml";
+
+ private SlingHttpServletRequest request;
+ private SlingHttpServletResponse response;
+ private MimeTypeService mimeTypeService;
+
+ public SlingGenerator(SlingScriptHelper sling) {
+ this.request = sling.getRequest();
+ this.response = sling.getResponse();
+ this.mimeTypeService = sling.getService(MimeTypeService.class);
+ }
+
+ public void execute() {
+ try {
+ Session session;
+ InputStream srcIs = genXmlSource();
+ if (srcIs != null)
+ XMLUtils.toSax(srcIs, this.getXMLConsumer());
+ else if ((session = request.getResource().adaptTo(Session.class)) != null) {
+ session.exportDocumentView(request.getResource().getPath(), this.getXMLConsumer(), true, true);
+ } else
+ throw new IllegalArgumentException("cannot generate xml source for " + request.getResource().getPath());
+
+ } catch (Throwable t) {
+ log.error("SlingGenerator: cannot generate xml source for "
+ + request.getResource().getPath(), t);
+ }
+ }
+
+ private InputStream genXmlSource() throws Exception {
+
+ String xmlPath = request.getResource().getPath() + "." + mimeTypeService.getExtension(XML_MIME_TYPE);
+
+ // The source is a xml file
+ Resource xmlResource = this.request.getResourceResolver().resolve(xmlPath);
+ InputStream xmlSourceFile = xmlResource.adaptTo(InputStream.class);
+ if (xmlSourceFile != null)
+ return xmlSourceFile;
+
+ // The source is dynamically generated
+ RequestDispatcher dispatcher = request.getRequestDispatcher(xmlPath);
+ SlingGeneratorServletOutputStream output = new SlingGeneratorServletOutputStream();
+ ServletResponse newResponse = new SlingGeneratorServletResponse(response, output);
+ dispatcher.include(request, newResponse);
+ byte[] bytes = output.toByteArray();
+ if (bytes.length > 0)
+ return new ByteArrayInputStream(bytes);
+
+ return null;
+
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/cocoon/transform/SlingTransformer.java b/src/main/java/org/apache/sling/scripting/xproc/cocoon/transform/SlingTransformer.java
index befefba..cc8b5e8 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/cocoon/transform/SlingTransformer.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/cocoon/transform/SlingTransformer.java
@@ -1,160 +1,160 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.cocoon.transform;
-
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TemplatesHandler;
-import javax.xml.transform.sax.TransformerHandler;
-
-import org.apache.cocoon.pipeline.component.sax.AbstractTransformer;
-import org.apache.cocoon.pipeline.component.sax.XMLConsumer;
-import org.apache.cocoon.pipeline.component.sax.XMLConsumerAdapter;
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.scripting.SlingScriptHelper;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * A Cocoon transformer that executes XSLT
- * transformations. The templates are Sling
- * resources supporting to be adapted to
- * {@link InputStream}.
- */
-public class SlingTransformer extends AbstractTransformer {
-
- private SlingHttpServletRequest request;
- private Map<String, Object> parameters;
- private String srcAbsPath;
-
- public SlingTransformer() {
- super();
- }
-
- public SlingTransformer(SlingScriptHelper sling, String srcAbsPath) {
- this(sling, srcAbsPath, null);
- }
-
- public SlingTransformer(SlingScriptHelper sling, String srcAbsPath, Map<String, Object> parameters) {
- super();
- if (srcAbsPath == null) {
- throw new IllegalArgumentException("The parameter 'source' mustn't be null.");
- }
-
- this.request = sling.getRequest();
- this.parameters = parameters;
- this.srcAbsPath = srcAbsPath;
- }
-
- /**
- * Test if the name is a valid parameter name for XSLT
- */
- private static boolean isValidXSLTParameterName(String name) {
- return name.matches("[a-zA-Z_][\\w\\-\\.]*");
- }
-
- @Override
- public void setConfiguration(Map<String, ? extends Object> configuration) {
- this.parameters = new HashMap<String, Object>(configuration);
- }
-
- @Override
- protected void setXMLConsumer(XMLConsumer consumer) {
- TransformerHandler transformerHandler;
- try {
- transformerHandler = this.createTransformerHandler();
- } catch (Exception ex) {
- throw new RuntimeException("Could not initialize transformer handler.", ex);
- }
-
- final Map<String, Object> map = this.getLogicSheetParameters();
- if (map != null) {
- final Transformer transformer = transformerHandler.getTransformer();
-
- for (Entry<String, Object> entry : map.entrySet()) {
- transformer.setParameter(entry.getKey(), entry.getValue());
- }
- }
-
- final SAXResult result = new SAXResult();
- result.setHandler(consumer);
- // According to TrAX specs, all TransformerHandlers are LexicalHandlers
- result.setLexicalHandler(consumer);
- transformerHandler.setResult(result);
-
- super.setXMLConsumer(new XMLConsumerAdapter(transformerHandler, transformerHandler));
- }
-
- private TransformerHandler createTransformerHandler() throws Exception {
- SAXTransformerFactory transformerFactory = (SAXTransformerFactory) TransformerFactory.newInstance();
- TemplatesHandler templatesHandler = transformerFactory.newTemplatesHandler();
-
- XMLReader xmlReader = XMLReaderFactory.createXMLReader();
- xmlReader.setContentHandler(templatesHandler);
- InputSource inputSource = new InputSource(getXsltSource());
- xmlReader.parse(inputSource);
-
- // Create transformer handler
- final TransformerHandler handler = transformerFactory.newTransformerHandler(templatesHandler.getTemplates());
-
- return handler;
- }
-
- private Map<String, Object> getLogicSheetParameters() {
- if (this.parameters == null) {
- return null;
- }
-
- Map<String, Object> result = new HashMap<String, Object>();
-
- for (Entry<String, Object> entry : this.parameters.entrySet()) {
- String name = entry.getKey();
-
- if (isValidXSLTParameterName(name)) {
- result.put(name, entry.getValue());
- }
- }
-
- return result;
- }
-
- /**
- * Get the XSLT source. For the time being, the
- * path must be absolute.
- */
- private InputStream getXsltSource() throws Exception {
- // The source is a xml file
- Resource xmlResource = this.request.getResourceResolver().resolve(srcAbsPath);
- InputStream xmlSourceFile = xmlResource.adaptTo(InputStream.class);
- if (xmlSourceFile != null)
- return xmlSourceFile;
- return null;
-
- }
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.cocoon.transform;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TemplatesHandler;
+import javax.xml.transform.sax.TransformerHandler;
+
+import org.apache.cocoon.pipeline.component.sax.AbstractTransformer;
+import org.apache.cocoon.pipeline.component.sax.XMLConsumer;
+import org.apache.cocoon.pipeline.component.sax.XMLConsumerAdapter;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.scripting.SlingScriptHelper;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * A Cocoon transformer that executes XSLT
+ * transformations. The templates are Sling
+ * resources supporting to be adapted to
+ * {@link InputStream}.
+ */
+public class SlingTransformer extends AbstractTransformer {
+
+ private SlingHttpServletRequest request;
+ private Map<String, Object> parameters;
+ private String srcAbsPath;
+
+ public SlingTransformer() {
+ super();
+ }
+
+ public SlingTransformer(SlingScriptHelper sling, String srcAbsPath) {
+ this(sling, srcAbsPath, null);
+ }
+
+ public SlingTransformer(SlingScriptHelper sling, String srcAbsPath, Map<String, Object> parameters) {
+ super();
+ if (srcAbsPath == null) {
+ throw new IllegalArgumentException("The parameter 'source' mustn't be null.");
+ }
+
+ this.request = sling.getRequest();
+ this.parameters = parameters;
+ this.srcAbsPath = srcAbsPath;
+ }
+
+ /**
+ * Test if the name is a valid parameter name for XSLT
+ */
+ private static boolean isValidXSLTParameterName(String name) {
+ return name.matches("[a-zA-Z_][\\w\\-\\.]*");
+ }
+
+ @Override
+ public void setConfiguration(Map<String, ? extends Object> configuration) {
+ this.parameters = new HashMap<String, Object>(configuration);
+ }
+
+ @Override
+ protected void setXMLConsumer(XMLConsumer consumer) {
+ TransformerHandler transformerHandler;
+ try {
+ transformerHandler = this.createTransformerHandler();
+ } catch (Exception ex) {
+ throw new RuntimeException("Could not initialize transformer handler.", ex);
+ }
+
+ final Map<String, Object> map = this.getLogicSheetParameters();
+ if (map != null) {
+ final Transformer transformer = transformerHandler.getTransformer();
+
+ for (Entry<String, Object> entry : map.entrySet()) {
+ transformer.setParameter(entry.getKey(), entry.getValue());
+ }
+ }
+
+ final SAXResult result = new SAXResult();
+ result.setHandler(consumer);
+ // According to TrAX specs, all TransformerHandlers are LexicalHandlers
+ result.setLexicalHandler(consumer);
+ transformerHandler.setResult(result);
+
+ super.setXMLConsumer(new XMLConsumerAdapter(transformerHandler, transformerHandler));
+ }
+
+ private TransformerHandler createTransformerHandler() throws Exception {
+ SAXTransformerFactory transformerFactory = (SAXTransformerFactory) TransformerFactory.newInstance();
+ TemplatesHandler templatesHandler = transformerFactory.newTemplatesHandler();
+
+ XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+ xmlReader.setContentHandler(templatesHandler);
+ InputSource inputSource = new InputSource(getXsltSource());
+ xmlReader.parse(inputSource);
+
+ // Create transformer handler
+ final TransformerHandler handler = transformerFactory.newTransformerHandler(templatesHandler.getTemplates());
+
+ return handler;
+ }
+
+ private Map<String, Object> getLogicSheetParameters() {
+ if (this.parameters == null) {
+ return null;
+ }
+
+ Map<String, Object> result = new HashMap<String, Object>();
+
+ for (Entry<String, Object> entry : this.parameters.entrySet()) {
+ String name = entry.getKey();
+
+ if (isValidXSLTParameterName(name)) {
+ result.put(name, entry.getValue());
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Get the XSLT source. For the time being, the
+ * path must be absolute.
+ */
+ private InputStream getXsltSource() throws Exception {
+ // The source is a xml file
+ Resource xmlResource = this.request.getResourceResolver().resolve(srcAbsPath);
+ InputStream xmlSourceFile = xmlResource.adaptTo(InputStream.class);
+ if (xmlSourceFile != null)
+ return xmlSourceFile;
+ return null;
+
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/XplBuilder.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/XplBuilder.java
index 3925962..5bb2c8f 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/XplBuilder.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/XplBuilder.java
@@ -1,111 +1,111 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl;
-
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.sling.scripting.xproc.xpl.api.Step;
-import org.apache.sling.scripting.xproc.xpl.api.XplElement;
-import org.apache.sling.scripting.xproc.xpl.api.XplElementFactory;
-import org.apache.sling.scripting.xproc.xpl.impl.XplElementFactoryImpl;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Builds a W3C XML Processing pipeline
- * from a XPL file.
- */
-public class XplBuilder {
-
- private XplElementFactory xplElementFactory;
-
- public XplBuilder() {
- this.xplElementFactory = new XplElementFactoryImpl();
- }
-
- public Step build(Reader xplReader) throws Exception {
- XMLReader xMLReader = XMLReaderFactory.createXMLReader();
- XplHandler xplHandler = new XplHandler();
- xMLReader.setContentHandler(xplHandler);
- InputSource inputSource = new InputSource(xplReader);
- xMLReader.parse(inputSource);
- return xplHandler.getRootStep();
- }
-
- protected XplElement createXplElement(String localName, Map<String, String> attributes) {
- return XplBuilder.this.xplElementFactory.createXplElement(new QName(XplConstants.NS_XPROC, localName), attributes);
- }
-
- class XplHandler extends DefaultHandler {
-
- private XplElement currentXplElement;
- private Step rootStep;
-
- @Override
- public void endElement(String uri, String localName, String name) throws SAXException {
- if (this.currentXplElement == null) {
- throw new IllegalStateException("Received closing '" + localName + "' but there was no element to close.");
- }
-
- this.currentXplElement = this.currentXplElement.getParent();
- }
-
- @Override
- public void error(SAXParseException e) throws SAXException {
- throw e;
- }
-
- public Step getRootStep() {
- return this.rootStep;
- }
-
- @Override
- public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
- if (this.currentXplElement == null) {
- if (XplConstants.QNAME_PIPELINE.getLocalPart().equals(localName)) {
- this.rootStep = (Step) XplBuilder.this.createXplElement(localName, null);
- this.currentXplElement = this.rootStep;
- return;
- }
- throw new IllegalStateException("Expected 'pipeline' as first element, but received '" + localName + "'");
- }
-
- Map<String, String> atts = new HashMap<String, String>();
- int length = attributes.getLength();
- for (int i = 0; i < length; i++) {
- atts.put(attributes.getQName(i), attributes.getValue(i));
- }
-
- XplElement xplElement = createXplElement(localName, atts);
- this.currentXplElement.addChild(xplElement);
- this.currentXplElement = xplElement;
- }
-
- }
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl;
+
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.sling.scripting.xproc.xpl.api.Step;
+import org.apache.sling.scripting.xproc.xpl.api.XplElement;
+import org.apache.sling.scripting.xproc.xpl.api.XplElementFactory;
+import org.apache.sling.scripting.xproc.xpl.impl.XplElementFactoryImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Builds a W3C XML Processing pipeline
+ * from a XPL file.
+ */
+public class XplBuilder {
+
+ private XplElementFactory xplElementFactory;
+
+ public XplBuilder() {
+ this.xplElementFactory = new XplElementFactoryImpl();
+ }
+
+ public Step build(Reader xplReader) throws Exception {
+ XMLReader xMLReader = XMLReaderFactory.createXMLReader();
+ XplHandler xplHandler = new XplHandler();
+ xMLReader.setContentHandler(xplHandler);
+ InputSource inputSource = new InputSource(xplReader);
+ xMLReader.parse(inputSource);
+ return xplHandler.getRootStep();
+ }
+
+ protected XplElement createXplElement(String localName, Map<String, String> attributes) {
+ return XplBuilder.this.xplElementFactory.createXplElement(new QName(XplConstants.NS_XPROC, localName), attributes);
+ }
+
+ class XplHandler extends DefaultHandler {
+
+ private XplElement currentXplElement;
+ private Step rootStep;
+
+ @Override
+ public void endElement(String uri, String localName, String name) throws SAXException {
+ if (this.currentXplElement == null) {
+ throw new IllegalStateException("Received closing '" + localName + "' but there was no element to close.");
+ }
+
+ this.currentXplElement = this.currentXplElement.getParent();
+ }
+
+ @Override
+ public void error(SAXParseException e) throws SAXException {
+ throw e;
+ }
+
+ public Step getRootStep() {
+ return this.rootStep;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
+ if (this.currentXplElement == null) {
+ if (XplConstants.QNAME_PIPELINE.getLocalPart().equals(localName)) {
+ this.rootStep = (Step) XplBuilder.this.createXplElement(localName, null);
+ this.currentXplElement = this.rootStep;
+ return;
+ }
+ throw new IllegalStateException("Expected 'pipeline' as first element, but received '" + localName + "'");
+ }
+
+ Map<String, String> atts = new HashMap<String, String>();
+ int length = attributes.getLength();
+ for (int i = 0; i < length; i++) {
+ atts.put(attributes.getQName(i), attributes.getValue(i));
+ }
+
+ XplElement xplElement = createXplElement(localName, atts);
+ this.currentXplElement.addChild(xplElement);
+ this.currentXplElement = xplElement;
+ }
+
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/XplConstants.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/XplConstants.java
index 550e463..6208afe 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/XplConstants.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/XplConstants.java
@@ -1,32 +1,32 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl;
-
-import javax.xml.namespace.QName;
-
-public class XplConstants {
-
- public static final String NS_XPROC = "http://www.w3.org/ns/xproc";
-
- public static final QName QNAME_PIPELINE = new QName(NS_XPROC, "pipeline");
- public static final QName QNAME_XSLT = new QName(NS_XPROC, "xslt");
- public static final QName QNAME_INPUT = new QName(NS_XPROC, "input");
- public static final QName QNAME_DOCUMENT = new QName(NS_XPROC, "document");
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl;
+
+import javax.xml.namespace.QName;
+
+public class XplConstants {
+
+ public static final String NS_XPROC = "http://www.w3.org/ns/xproc";
+
+ public static final QName QNAME_PIPELINE = new QName(NS_XPROC, "pipeline");
+ public static final QName QNAME_XSLT = new QName(NS_XPROC, "xslt");
+ public static final QName QNAME_INPUT = new QName(NS_XPROC, "input");
+ public static final QName QNAME_DOCUMENT = new QName(NS_XPROC, "document");
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/AtomicStep.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/AtomicStep.java
index 9753145..ee525f1 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/AtomicStep.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/AtomicStep.java
@@ -1,23 +1,23 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.api;
-
-public interface AtomicStep extends Step {
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.api;
+
+public interface AtomicStep extends Step {
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/CompoundStep.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/CompoundStep.java
index 0177e29..ee17637 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/CompoundStep.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/CompoundStep.java
@@ -1,29 +1,29 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.api;
-
-import java.util.Vector;
-
-public interface CompoundStep extends Step {
-
- Vector<Step> getSubpipeline();
-
- void setSubpipeline(Vector<Step> subpipeline);
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.api;
+
+import java.util.Vector;
+
+public interface CompoundStep extends Step {
+
+ Vector<Step> getSubpipeline();
+
+ void setSubpipeline(Vector<Step> subpipeline);
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Document.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Document.java
index cc8857c..3a847c8 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Document.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Document.java
@@ -1,27 +1,27 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.api;
-
-public interface Document extends XplElement {
-
- String getHref();
-
- void setHref(String href);
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.api;
+
+public interface Document extends XplElement {
+
+ String getHref();
+
+ void setHref(String href);
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Environment.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Environment.java
index 725f4fc..de0dfc5 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Environment.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Environment.java
@@ -1,34 +1,34 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.api;
-
-import org.apache.cocoon.pipeline.Pipeline;
-import org.apache.sling.api.scripting.SlingScriptHelper;
-
-public interface Environment {
-
- SlingScriptHelper getSling();
-
- void setSling(SlingScriptHelper sling);
-
- Pipeline getCcPipeline();
-
- void setCcPipeline(Pipeline ccPipeline);
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.api;
+
+import org.apache.cocoon.pipeline.Pipeline;
+import org.apache.sling.api.scripting.SlingScriptHelper;
+
+public interface Environment {
+
+ SlingScriptHelper getSling();
+
+ void setSling(SlingScriptHelper sling);
+
+ Pipeline getCcPipeline();
+
+ void setCcPipeline(Pipeline ccPipeline);
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Input.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Input.java
index 07474c1..23287f2 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Input.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Input.java
@@ -1,31 +1,31 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.api;
-
-public interface Input extends XplElement {
-
- String getPort();
-
- void setPort(String port);
-
- Document getDocument();
-
- void setDocument(Document document);
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.api;
+
+public interface Input extends XplElement {
+
+ String getPort();
+
+ void setPort(String port);
+
+ Document getDocument();
+
+ void setDocument(Document document);
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/MultiContainerStep.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/MultiContainerStep.java
index 7e1fc8d..0b4bab2 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/MultiContainerStep.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/MultiContainerStep.java
@@ -1,23 +1,23 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.api;
-
-public interface MultiContainerStep extends Step {
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.api;
+
+public interface MultiContainerStep extends Step {
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Pipeline.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Pipeline.java
index 672cacd..a84cc54 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Pipeline.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Pipeline.java
@@ -1,24 +1,24 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.api;
-
-public interface Pipeline extends CompoundStep {
-
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.api;
+
+public interface Pipeline extends CompoundStep {
+
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Step.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Step.java
index 24e0b09..eb4728f 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Step.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Step.java
@@ -1,33 +1,33 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.api;
-
-public interface Step extends XplElement {
-
- void eval() throws Exception;
-
- Step getContainer();
-
- void setContainer(Step container);
-
- Environment getEnv();
-
- void setEnv(Environment env);
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.api;
+
+public interface Step extends XplElement {
+
+ void eval() throws Exception;
+
+ Step getContainer();
+
+ void setContainer(Step container);
+
+ Environment getEnv();
+
+ void setEnv(Environment env);
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/XplElement.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/XplElement.java
index 4b598b4..420b62d 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/XplElement.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/XplElement.java
@@ -1,44 +1,44 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.api;
-
-import java.util.LinkedList;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-public interface XplElement {
-
- QName getQName();
-
- XplElement getParent();
-
- void setAttributes(Map<String, String> attributes);
-
- void setParent(XplElement parent);
-
- LinkedList<XplElement> getChildren();
-
- void addChild(XplElement child);
-
- int getDepth();
-
- void setDepth(int depth);
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.api;
+
+import java.util.LinkedList;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+public interface XplElement {
+
+ QName getQName();
+
+ XplElement getParent();
+
+ void setAttributes(Map<String, String> attributes);
+
+ void setParent(XplElement parent);
+
+ LinkedList<XplElement> getChildren();
+
+ void addChild(XplElement child);
+
+ int getDepth();
+
+ void setDepth(int depth);
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/XplElementFactory.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/XplElementFactory.java
index a2dbc39..a884008 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/XplElementFactory.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/XplElementFactory.java
@@ -1,29 +1,29 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.api;
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-public interface XplElementFactory {
-
- XplElement createXplElement(QName type, Map<String, String> parameters);
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.api;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+public interface XplElementFactory {
+
+ XplElement createXplElement(QName type, Map<String, String> parameters);
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Xslt.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Xslt.java
index 1b31637..6d3a708 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Xslt.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/api/Xslt.java
@@ -1,27 +1,27 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.api;
-
-public interface Xslt extends AtomicStep {
-
- Input getStylesheet();
-
- void setStylesheet(Input stylesheet);
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.api;
+
+public interface Xslt extends AtomicStep {
+
+ Input getStylesheet();
+
+ void setStylesheet(Input stylesheet);
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractCompoundStepImpl.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractCompoundStepImpl.java
index 09db138..99ca489 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractCompoundStepImpl.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractCompoundStepImpl.java
@@ -1,56 +1,56 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.impl;
-
-import java.util.Vector;
-
-import org.apache.sling.scripting.xproc.xpl.api.CompoundStep;
-import org.apache.sling.scripting.xproc.xpl.api.Step;
-import org.apache.sling.scripting.xproc.xpl.api.XplElement;
-
-public abstract class AbstractCompoundStepImpl extends AbstractStepImpl implements CompoundStep {
-
- private Vector<Step> subpipeline = new Vector<Step>();
-
- @Override
- public void eval() throws Exception {
- for (Step step : subpipeline) {
- step.eval();
- }
- }
-
- @Override
- public void addChild(XplElement child) {
- super.addChild(child);
- if (child instanceof Step) {
- Step stepChild = (Step) child;
- stepChild.setEnv(this.getEnv());
- subpipeline.add(stepChild);
- }
- }
-
- public Vector<Step> getSubpipeline() {
- return subpipeline;
- }
-
- public void setSubpipeline(Vector<Step> subpipeline) {
- this.subpipeline = subpipeline;
- }
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.impl;
+
+import java.util.Vector;
+
+import org.apache.sling.scripting.xproc.xpl.api.CompoundStep;
+import org.apache.sling.scripting.xproc.xpl.api.Step;
+import org.apache.sling.scripting.xproc.xpl.api.XplElement;
+
+public abstract class AbstractCompoundStepImpl extends AbstractStepImpl implements CompoundStep {
+
+ private Vector<Step> subpipeline = new Vector<Step>();
+
+ @Override
+ public void eval() throws Exception {
+ for (Step step : subpipeline) {
+ step.eval();
+ }
+ }
+
+ @Override
+ public void addChild(XplElement child) {
+ super.addChild(child);
+ if (child instanceof Step) {
+ Step stepChild = (Step) child;
+ stepChild.setEnv(this.getEnv());
+ subpipeline.add(stepChild);
+ }
+ }
+
+ public Vector<Step> getSubpipeline() {
+ return subpipeline;
+ }
+
+ public void setSubpipeline(Vector<Step> subpipeline) {
+ this.subpipeline = subpipeline;
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractStepImpl.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractStepImpl.java
index 7538a19..2577480 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractStepImpl.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractStepImpl.java
@@ -1,55 +1,55 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.impl;
-
-import org.apache.sling.scripting.xproc.xpl.api.Environment;
-import org.apache.sling.scripting.xproc.xpl.api.Step;
-
-public abstract class AbstractStepImpl extends AbstractXplElementImpl implements Step {
-
- private Step container;
- private Environment env;
-
- public abstract void eval() throws Exception;
-
- public AbstractStepImpl() {
- this.env = new EnvironmentImpl();
- }
-
- public AbstractStepImpl(Environment env) {
- this.env = env;
- }
-
- public Step getContainer() {
- return container;
- }
-
- public void setContainer(Step container) {
- this.container = container;
- }
-
- public Environment getEnv() {
- return env;
- }
-
- public void setEnv(Environment env) {
- this.env = env;
- }
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.impl;
+
+import org.apache.sling.scripting.xproc.xpl.api.Environment;
+import org.apache.sling.scripting.xproc.xpl.api.Step;
+
+public abstract class AbstractStepImpl extends AbstractXplElementImpl implements Step {
+
+ private Step container;
+ private Environment env;
+
+ public abstract void eval() throws Exception;
+
+ public AbstractStepImpl() {
+ this.env = new EnvironmentImpl();
+ }
+
+ public AbstractStepImpl(Environment env) {
+ this.env = env;
+ }
+
+ public Step getContainer() {
+ return container;
+ }
+
+ public void setContainer(Step container) {
+ this.container = container;
+ }
+
+ public Environment getEnv() {
+ return env;
+ }
+
+ public void setEnv(Environment env) {
+ this.env = env;
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractXplElementImpl.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractXplElementImpl.java
index 6db3ef0..bd2d65f 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractXplElementImpl.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractXplElementImpl.java
@@ -1,219 +1,219 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.impl;
-
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.xml.namespace.QName;
-
-import org.apache.sling.api.scripting.SlingScriptHelper;
-import org.apache.sling.scripting.xproc.xpl.api.XplElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractXplElementImpl implements XplElement {
-
- protected final Logger log = LoggerFactory.getLogger(this.getClass());
-
- private SlingScriptHelper sling;
- private final Map<String, String> attributes = new HashMap<String, String>();
- private XplElement parent;
- private final LinkedList<XplElement> children = new LinkedList<XplElement>();
- private int depth = 0;
-
- public LinkedList<XplElement> getChildren() {
- return children;
- }
-
- public void addChild(XplElement child) {
-
- if (child == null) {
- String msg = "Element of class " + this.getClass().getName() + " received null child.";
- this.log.error(msg);
- throw new IllegalArgumentException(msg);
- }
-
- Field childField = this.getChildField(child);
- if (childField != null) {
- childField.setAccessible(true);
- try {
- childField.set(this, child);
- } catch (IllegalArgumentException e) {
- this.log.error("Failed to set child field for child class '" + child.getClass().getName(), e);
- } catch (IllegalAccessException e) {
- this.log.error("Failed to set child field for child class '" + child.getClass().getName(), e);
- }
- }
- child.setDepth(this.getDepth() + 1);
- this.children.add(child);
- child.setParent(this);
-
- }
-
- public void setAttributes(Map<String, String> attributes) {
- if (attributes == null || attributes.isEmpty()) {
- // nothing to do
- return;
- }
-
- // check for special attribute fields
- Map<String, Field> attributeFields = this.getAttributeFields();
- for (Entry<String, String> entry : attributes.entrySet()) {
- String key = entry.getKey();
- String value = entry.getValue();
-
- Field attributeField = attributeFields.get(key);
- if (attributeField != null) {
- attributeField.setAccessible(true);
- try {
- attributeField.set(this, value);
- } catch (IllegalArgumentException e) {
- String message = "Failed to set attribute field " + key;
- this.log.error(message, e);
- throw new RuntimeException(message, e);
- } catch (IllegalAccessException e) {
- String message = "Failed to set attribute field " + key;
- this.log.error(message, e);
- throw new RuntimeException(message, e);
- }
- }
-
- // default attribute processing
- this.processAttribute(key, value);
- }
- }
-
- public SlingScriptHelper getSling() {
- return sling;
- }
-
- public abstract QName getQName();
-
- public XplElement getParent() {
- return parent;
- }
-
- public void setParent(XplElement parent) {
- this.parent = parent;
- }
-
- public int getDepth() {
- return depth;
- }
-
- public void setDepth(int depth) {
- this.depth = depth;
- }
-
- @Override
- public String toString() {
- StringBuffer sbXplElement = new StringBuffer();
- addTabs(sbXplElement, getDepth());
- sbXplElement.append("<");
- sbXplElement.append("p:" + this.getQName().getLocalPart());
- if (getDepth() == 0) {
- sbXplElement.append(" xmlns:p=\"http://www.w3.org/ns/xproc\"");
- }
- for (String attribute : this.attributes.keySet()) {
- sbXplElement.append(" ");
- sbXplElement.append(attribute + "=" + "\"" + this.attributes.get(attribute) + "\"");
- }
- if (getChildren().size() == 0) {
- sbXplElement.append(" />");
- return sbXplElement.toString();
- }
- sbXplElement.append(">");
- for (XplElement child : this.getChildren()) {
- sbXplElement.append("\r\n");
- sbXplElement.append(child.toString());
- }
- sbXplElement.append("\r\n");
- addTabs(sbXplElement, getDepth());
- sbXplElement.append("</");
- sbXplElement.append("p:" + this.getQName().getLocalPart());
- sbXplElement.append(">");
-
- return sbXplElement.toString();
- }
-
- private void addTabs(StringBuffer sb, int num) {
- for (int i = 0; i < num; i++)
- sb.append("\t");
- }
-
- protected void processAttribute(String key, String value) {
- this.attributes.put(key, value);
- }
-
- private Field getChildField(XplElement child) {
- Class<?> currentClass = this.getClass();
-
- Field[] declaredFields = currentClass.getDeclaredFields();
- for (Field declaredField : declaredFields) {
- if (declaredField.getType().isAssignableFrom(child.getClass())) {
- return declaredField;
- }
- }
-
- return null;
- }
-
- private Map<String, Field> getAttributeFields() {
- Map<String, Field> attributeFields = new HashMap<String, Field>();
-
- Class<?> currentClass = this.getClass();
- while (currentClass != null) {
- Field[] declaredFields = currentClass.getDeclaredFields();
- for (Field declaredField : declaredFields) {
- String fieldName = this.convertCamelCase(declaredField.getName());
- attributeFields.put(fieldName, declaredField);
- }
-
- currentClass = currentClass.getSuperclass();
- }
-
- return attributeFields;
- }
-
- private String convertCamelCase(String name) {
- Pattern camelCasePattern = Pattern.compile("(.)([A-Z])");
- Matcher matcher = camelCasePattern.matcher(name);
-
- int lastMatch = 0;
- StringBuilder result = new StringBuilder();
- while (matcher.find()) {
- result.append(name.substring(lastMatch, matcher.start()));
- result.append(matcher.group(1));
- result.append("-");
- result.append(matcher.group(2).toLowerCase());
- lastMatch = matcher.end();
- }
-
- result.append(name.substring(lastMatch, name.length()));
-
- return result.toString();
- }
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.impl;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.xml.namespace.QName;
+
+import org.apache.sling.api.scripting.SlingScriptHelper;
+import org.apache.sling.scripting.xproc.xpl.api.XplElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractXplElementImpl implements XplElement {
+
+ protected final Logger log = LoggerFactory.getLogger(this.getClass());
+
+ private SlingScriptHelper sling;
+ private final Map<String, String> attributes = new HashMap<String, String>();
+ private XplElement parent;
+ private final LinkedList<XplElement> children = new LinkedList<XplElement>();
+ private int depth = 0;
+
+ public LinkedList<XplElement> getChildren() {
+ return children;
+ }
+
+ public void addChild(XplElement child) {
+
+ if (child == null) {
+ String msg = "Element of class " + this.getClass().getName() + " received null child.";
+ this.log.error(msg);
+ throw new IllegalArgumentException(msg);
+ }
+
+ Field childField = this.getChildField(child);
+ if (childField != null) {
+ childField.setAccessible(true);
+ try {
+ childField.set(this, child);
+ } catch (IllegalArgumentException e) {
+ this.log.error("Failed to set child field for child class '" + child.getClass().getName(), e);
+ } catch (IllegalAccessException e) {
+ this.log.error("Failed to set child field for child class '" + child.getClass().getName(), e);
+ }
+ }
+ child.setDepth(this.getDepth() + 1);
+ this.children.add(child);
+ child.setParent(this);
+
+ }
+
+ public void setAttributes(Map<String, String> attributes) {
+ if (attributes == null || attributes.isEmpty()) {
+ // nothing to do
+ return;
+ }
+
+ // check for special attribute fields
+ Map<String, Field> attributeFields = this.getAttributeFields();
+ for (Entry<String, String> entry : attributes.entrySet()) {
+ String key = entry.getKey();
+ String value = entry.getValue();
+
+ Field attributeField = attributeFields.get(key);
+ if (attributeField != null) {
+ attributeField.setAccessible(true);
+ try {
+ attributeField.set(this, value);
+ } catch (IllegalArgumentException e) {
+ String message = "Failed to set attribute field " + key;
+ this.log.error(message, e);
+ throw new RuntimeException(message, e);
+ } catch (IllegalAccessException e) {
+ String message = "Failed to set attribute field " + key;
+ this.log.error(message, e);
+ throw new RuntimeException(message, e);
+ }
+ }
+
+ // default attribute processing
+ this.processAttribute(key, value);
+ }
+ }
+
+ public SlingScriptHelper getSling() {
+ return sling;
+ }
+
+ public abstract QName getQName();
+
+ public XplElement getParent() {
+ return parent;
+ }
+
+ public void setParent(XplElement parent) {
+ this.parent = parent;
+ }
+
+ public int getDepth() {
+ return depth;
+ }
+
+ public void setDepth(int depth) {
+ this.depth = depth;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sbXplElement = new StringBuffer();
+ addTabs(sbXplElement, getDepth());
+ sbXplElement.append("<");
+ sbXplElement.append("p:" + this.getQName().getLocalPart());
+ if (getDepth() == 0) {
+ sbXplElement.append(" xmlns:p=\"http://www.w3.org/ns/xproc\"");
+ }
+ for (String attribute : this.attributes.keySet()) {
+ sbXplElement.append(" ");
+ sbXplElement.append(attribute + "=" + "\"" + this.attributes.get(attribute) + "\"");
+ }
+ if (getChildren().size() == 0) {
+ sbXplElement.append(" />");
+ return sbXplElement.toString();
+ }
+ sbXplElement.append(">");
+ for (XplElement child : this.getChildren()) {
+ sbXplElement.append("\r\n");
+ sbXplElement.append(child.toString());
+ }
+ sbXplElement.append("\r\n");
+ addTabs(sbXplElement, getDepth());
+ sbXplElement.append("</");
+ sbXplElement.append("p:" + this.getQName().getLocalPart());
+ sbXplElement.append(">");
+
+ return sbXplElement.toString();
+ }
+
+ private void addTabs(StringBuffer sb, int num) {
+ for (int i = 0; i < num; i++)
+ sb.append("\t");
+ }
+
+ protected void processAttribute(String key, String value) {
+ this.attributes.put(key, value);
+ }
+
+ private Field getChildField(XplElement child) {
+ Class<?> currentClass = this.getClass();
+
+ Field[] declaredFields = currentClass.getDeclaredFields();
+ for (Field declaredField : declaredFields) {
+ if (declaredField.getType().isAssignableFrom(child.getClass())) {
+ return declaredField;
+ }
+ }
+
+ return null;
+ }
+
+ private Map<String, Field> getAttributeFields() {
+ Map<String, Field> attributeFields = new HashMap<String, Field>();
+
+ Class<?> currentClass = this.getClass();
+ while (currentClass != null) {
+ Field[] declaredFields = currentClass.getDeclaredFields();
+ for (Field declaredField : declaredFields) {
+ String fieldName = this.convertCamelCase(declaredField.getName());
+ attributeFields.put(fieldName, declaredField);
+ }
+
+ currentClass = currentClass.getSuperclass();
+ }
+
+ return attributeFields;
+ }
+
+ private String convertCamelCase(String name) {
+ Pattern camelCasePattern = Pattern.compile("(.)([A-Z])");
+ Matcher matcher = camelCasePattern.matcher(name);
+
+ int lastMatch = 0;
+ StringBuilder result = new StringBuilder();
+ while (matcher.find()) {
+ result.append(name.substring(lastMatch, matcher.start()));
+ result.append(matcher.group(1));
+ result.append("-");
+ result.append(matcher.group(2).toLowerCase());
+ lastMatch = matcher.end();
+ }
+
+ result.append(name.substring(lastMatch, name.length()));
+
+ return result.toString();
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/DocumentImpl.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/DocumentImpl.java
index 50d297d..93a52f9 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/DocumentImpl.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/DocumentImpl.java
@@ -1,43 +1,43 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.impl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.sling.scripting.xproc.xpl.XplConstants;
-import org.apache.sling.scripting.xproc.xpl.api.Document;
-
-public class DocumentImpl extends AbstractXplElementImpl implements Document {
-
- private String href;
-
- public String getHref() {
- return href;
- }
-
- public void setHref(String href) {
- this.href = href;
- }
-
- @Override
- public QName getQName() {
- return XplConstants.QNAME_DOCUMENT;
- }
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.sling.scripting.xproc.xpl.XplConstants;
+import org.apache.sling.scripting.xproc.xpl.api.Document;
+
+public class DocumentImpl extends AbstractXplElementImpl implements Document {
+
+ private String href;
+
+ public String getHref() {
+ return href;
+ }
+
+ public void setHref(String href) {
+ this.href = href;
+ }
+
+ @Override
+ public QName getQName() {
+ return XplConstants.QNAME_DOCUMENT;
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/EnvironmentImpl.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/EnvironmentImpl.java
index f0850a8..48b8eb3 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/EnvironmentImpl.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/EnvironmentImpl.java
@@ -1,46 +1,46 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.impl;
-
-import org.apache.cocoon.pipeline.Pipeline;
-import org.apache.sling.api.scripting.SlingScriptHelper;
-import org.apache.sling.scripting.xproc.xpl.api.Environment;
-
-public class EnvironmentImpl implements Environment {
-
- private SlingScriptHelper sling;
- private Pipeline ccPipeline;
-
- public SlingScriptHelper getSling() {
- return sling;
- }
-
- public void setSling(SlingScriptHelper sling) {
- this.sling = sling;
- }
-
- public Pipeline getCcPipeline() {
- return ccPipeline;
- }
-
- public void setCcPipeline(Pipeline ccPipeline) {
- this.ccPipeline = ccPipeline;
- }
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.impl;
+
+import org.apache.cocoon.pipeline.Pipeline;
+import org.apache.sling.api.scripting.SlingScriptHelper;
+import org.apache.sling.scripting.xproc.xpl.api.Environment;
+
+public class EnvironmentImpl implements Environment {
+
+ private SlingScriptHelper sling;
+ private Pipeline ccPipeline;
+
+ public SlingScriptHelper getSling() {
+ return sling;
+ }
+
+ public void setSling(SlingScriptHelper sling) {
+ this.sling = sling;
+ }
+
+ public Pipeline getCcPipeline() {
+ return ccPipeline;
+ }
+
+ public void setCcPipeline(Pipeline ccPipeline) {
+ this.ccPipeline = ccPipeline;
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/InputImpl.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/InputImpl.java
index 4806f1a..6678625 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/InputImpl.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/InputImpl.java
@@ -1,53 +1,53 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.impl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.sling.scripting.xproc.xpl.XplConstants;
-import org.apache.sling.scripting.xproc.xpl.api.Document;
-import org.apache.sling.scripting.xproc.xpl.api.Input;
-
-public class InputImpl extends AbstractXplElementImpl implements Input {
-
- private String port;
- private Document document;
-
- public String getPort() {
- return port;
- }
-
- public void setPort(String port) {
- this.port = port;
- }
-
- public Document getDocument() {
- return document;
- }
-
- public void setDocument(Document document) {
- this.document = document;
- }
-
- @Override
- public QName getQName() {
- return XplConstants.QNAME_INPUT;
- }
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.sling.scripting.xproc.xpl.XplConstants;
+import org.apache.sling.scripting.xproc.xpl.api.Document;
+import org.apache.sling.scripting.xproc.xpl.api.Input;
+
+public class InputImpl extends AbstractXplElementImpl implements Input {
+
+ private String port;
+ private Document document;
+
+ public String getPort() {
+ return port;
+ }
+
+ public void setPort(String port) {
+ this.port = port;
+ }
+
+ public Document getDocument() {
+ return document;
+ }
+
+ public void setDocument(Document document) {
+ this.document = document;
+ }
+
+ @Override
+ public QName getQName() {
+ return XplConstants.QNAME_INPUT;
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/PipelineImpl.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/PipelineImpl.java
index cf4befa..9c32d33 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/PipelineImpl.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/PipelineImpl.java
@@ -1,78 +1,78 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.impl;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.xml.namespace.QName;
-
-import org.apache.cocoon.pipeline.NonCachingPipeline;
-import org.apache.cocoon.pipeline.component.sax.AbstractGenerator;
-import org.apache.cocoon.pipeline.component.sax.XMLSerializer;
-import org.apache.sling.scripting.xproc.cocoon.generator.SlingGenerator;
-import org.apache.sling.scripting.xproc.xpl.XplConstants;
-import org.apache.sling.scripting.xproc.xpl.api.Pipeline;
-import org.apache.sling.scripting.xproc.xpl.api.Step;
-
-public class PipelineImpl extends AbstractCompoundStepImpl implements Pipeline {
-
- @Override
- public void eval() throws Exception {
- try {
-
- this.getEnv().setCcPipeline(new NonCachingPipeline());
-
- // generator
- AbstractGenerator generator = new SlingGenerator(this.getEnv().getSling());
- this.getEnv().getCcPipeline().addComponent(generator);
-
- // subpipeline evaluated
- for (Step step : this.getSubpipeline()) {
- step.eval();
- }
-
- this.getEnv().getCcPipeline().addComponent(new XMLSerializer());
-
- // Don't retrieve OutputStream from response until actually writing
- // to response, so that error handlers can retrieve it without getting
- // an error
- final OutputStream out = new OutputStreamWrapper() {
- @Override
- protected OutputStream getWrappedStream() throws IOException {
- return getEnv().getSling().getResponse().getOutputStream();
- }
- };
-
- this.getEnv().getCcPipeline().setup(out);
- this.getEnv().getCcPipeline().execute();
-
- } catch (Exception e) {
- String absPath = this.getEnv().getSling().getRequest().getResource().getPath();
- throw new Exception("Error in pipeline for resource: " + absPath, e);
- }
-
- }
-
- @Override
- public QName getQName() {
- return XplConstants.QNAME_PIPELINE;
- }
-
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.impl;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cocoon.pipeline.NonCachingPipeline;
+import org.apache.cocoon.pipeline.component.sax.AbstractGenerator;
+import org.apache.cocoon.pipeline.component.sax.XMLSerializer;
+import org.apache.sling.scripting.xproc.cocoon.generator.SlingGenerator;
+import org.apache.sling.scripting.xproc.xpl.XplConstants;
+import org.apache.sling.scripting.xproc.xpl.api.Pipeline;
+import org.apache.sling.scripting.xproc.xpl.api.Step;
+
+public class PipelineImpl extends AbstractCompoundStepImpl implements Pipeline {
+
+ @Override
+ public void eval() throws Exception {
+ try {
+
+ this.getEnv().setCcPipeline(new NonCachingPipeline());
+
+ // generator
+ AbstractGenerator generator = new SlingGenerator(this.getEnv().getSling());
+ this.getEnv().getCcPipeline().addComponent(generator);
+
+ // subpipeline evaluated
+ for (Step step : this.getSubpipeline()) {
+ step.eval();
+ }
+
+ this.getEnv().getCcPipeline().addComponent(new XMLSerializer());
+
+ // Don't retrieve OutputStream from response until actually writing
+ // to response, so that error handlers can retrieve it without getting
+ // an error
+ final OutputStream out = new OutputStreamWrapper() {
+ @Override
+ protected OutputStream getWrappedStream() throws IOException {
+ return getEnv().getSling().getResponse().getOutputStream();
+ }
+ };
+
+ this.getEnv().getCcPipeline().setup(out);
+ this.getEnv().getCcPipeline().execute();
+
+ } catch (Exception e) {
+ String absPath = this.getEnv().getSling().getRequest().getResource().getPath();
+ throw new Exception("Error in pipeline for resource: " + absPath, e);
+ }
+
+ }
+
+ @Override
+ public QName getQName() {
+ return XplConstants.QNAME_PIPELINE;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/XplElementFactoryImpl.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/XplElementFactoryImpl.java
index 7ed22bd..92d0db4 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/XplElementFactoryImpl.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/XplElementFactoryImpl.java
@@ -1,52 +1,52 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.impl;
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.sling.scripting.xproc.xpl.XplConstants;
-import org.apache.sling.scripting.xproc.xpl.api.XplElement;
-import org.apache.sling.scripting.xproc.xpl.api.XplElementFactory;
-
-public class XplElementFactoryImpl implements XplElementFactory {
-
- public XplElement createXplElement(QName type, Map<String, String> attributes) {
-
- XplElement xplElement;
-
- if (XplConstants.QNAME_PIPELINE.equals(type)) {
- xplElement = new PipelineImpl();
- } else if (XplConstants.QNAME_XSLT.equals(type)) {
- xplElement = new XsltImpl();
- } else if (XplConstants.QNAME_INPUT.equals(type)) {
- xplElement = new InputImpl();
- } else if (XplConstants.QNAME_DOCUMENT.equals(type)) {
- xplElement = new DocumentImpl();
- } else {
- throw new IllegalArgumentException("An xpl element of type '" + type + "' could not be created.");
- }
-
- xplElement.setAttributes(attributes);
-
- return xplElement;
- }
-
-}
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.impl;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.sling.scripting.xproc.xpl.XplConstants;
+import org.apache.sling.scripting.xproc.xpl.api.XplElement;
+import org.apache.sling.scripting.xproc.xpl.api.XplElementFactory;
+
+public class XplElementFactoryImpl implements XplElementFactory {
+
+ public XplElement createXplElement(QName type, Map<String, String> attributes) {
+
+ XplElement xplElement;
+
+ if (XplConstants.QNAME_PIPELINE.equals(type)) {
+ xplElement = new PipelineImpl();
+ } else if (XplConstants.QNAME_XSLT.equals(type)) {
+ xplElement = new XsltImpl();
+ } else if (XplConstants.QNAME_INPUT.equals(type)) {
+ xplElement = new InputImpl();
+ } else if (XplConstants.QNAME_DOCUMENT.equals(type)) {
+ xplElement = new DocumentImpl();
+ } else {
+ throw new IllegalArgumentException("An xpl element of type '" + type + "' could not be created.");
+ }
+
+ xplElement.setAttributes(attributes);
+
+ return xplElement;
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/XsltImpl.java b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/XsltImpl.java
index a1a9b5b..140c578 100644
--- a/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/XsltImpl.java
+++ b/src/main/java/org/apache/sling/scripting/xproc/xpl/impl/XsltImpl.java
@@ -1,51 +1,51 @@
-/*
- * 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
- *
- * 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.sling.scripting.xproc.xpl.impl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.sling.scripting.xproc.cocoon.transform.SlingTransformer;
-import org.apache.sling.scripting.xproc.xpl.XplConstants;
-import org.apache.sling.scripting.xproc.xpl.api.Input;
-import org.apache.sling.scripting.xproc.xpl.api.Xslt;
-
-public class XsltImpl extends AbstractStepImpl implements Xslt {
-
- private Input stylesheet;
-
- @Override
- public void eval() {
- String href = this.getStylesheet().getDocument().getHref();
- this.getEnv().getCcPipeline().addComponent(new SlingTransformer(this.getEnv().getSling(), href));
- }
-
- public Input getStylesheet() {
- return stylesheet;
- }
-
- public void setStylesheet(Input stylesheet) {
- this.stylesheet = stylesheet;
- }
-
- @Override
- public QName getQName() {
- return XplConstants.QNAME_XSLT;
- }
-
+/*
+ * 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
+ *
+ * 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.sling.scripting.xproc.xpl.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.sling.scripting.xproc.cocoon.transform.SlingTransformer;
+import org.apache.sling.scripting.xproc.xpl.XplConstants;
+import org.apache.sling.scripting.xproc.xpl.api.Input;
+import org.apache.sling.scripting.xproc.xpl.api.Xslt;
+
+public class XsltImpl extends AbstractStepImpl implements Xslt {
+
+ private Input stylesheet;
+
+ @Override
+ public void eval() {
+ String href = this.getStylesheet().getDocument().getHref();
+ this.getEnv().getCcPipeline().addComponent(new SlingTransformer(this.getEnv().getSling(), href));
+ }
+
+ public Input getStylesheet() {
+ return stylesheet;
+ }
+
+ public void setStylesheet(Input stylesheet) {
+ this.stylesheet = stylesheet;
+ }
+
+ @Override
+ public QName getQName() {
+ return XplConstants.QNAME_XSLT;
+ }
+
}
\ No newline at end of file