You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/04/26 18:07:05 UTC
svn commit: r164808 [2/3] - in /cocoon/branches/BRANCH_2_1_X/src:
blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/context/
blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation/
blocks/chaperon/java/org/apache/cocoon/transformation/
blocks/forms/java/org/apache/cocoon/forms/datatype/
blocks/mail/java/org/apache/cocoon/generation/
blocks/mail/java/org/apache/cocoon/mail/
blocks/ojb/java/org/apache/cocoon/ojb/components/
blocks/portal-fw/java/org/apache/cocoon/webapps/portal/components/
blocks/portal/java/org/apache/cocoon/portal/tools/generation/
blocks/profiler/java/org/apache/cocoon/generation/
blocks/proxy/java/org/apache/cocoon/generation/
blocks/qdox/java/org/apache/cocoon/components/source/impl/
blocks/repository/java/org/apache/cocoon/components/source/helpers/
blocks/repository/java/org/apache/cocoon/generation/
blocks/slop/java/org/apache/cocoon/slop/parsing/
blocks/web3/java/org/apache/cocoon/components/web3/impl/
blocks/webdav/java/org/apache/cocoon/components/source/impl/
blocks/webdav/java/org/apache/cocoon/transformation/
blocks/woody/java/org/apache/cocoon/woody/
blocks/xsp/java/org/apache/cocoon/components/language/markup/
blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/
deprecated/java/org/apache/cocoon/transformation/
java/org/apache/cocoon/components/notification/
java/org/apache/cocoon/generation/ java/org/apache/cocoon/serialization/
java/org/apache/cocoon/sitemap/ java/org/apache/cocoon/transformation/
java/org/apache/cocoon/xml/dom/
samples/org/apache/cocoon/samples/errorhandling/
samples/org/apache/cocoon/samples/parentcm/
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/proxy/java/org/apache/cocoon/generation/HttpProxyGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/proxy/java/org/apache/cocoon/generation/HttpProxyGenerator.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/proxy/java/org/apache/cocoon/generation/HttpProxyGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/proxy/java/org/apache/cocoon/generation/HttpProxyGenerator.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -51,11 +51,11 @@
* The <code>HttpProxyGenerator</code> is a Cocoon generator using the
* <b>Jakarta Commons HTTPClient Library</b> to access an XML stream
* over HTTP.
- *
+ *
* @author <a href="mailto:ivelin@apache.org">Ivelin Ivanov</a>, June 2002
* @author <a href="mailto:tony@apache.org">Tony Collen</a>, December 2002
* @author <a href="mailto:pier@apache.org">Pier Fumagalli</a>, February 2003
- * @version CVS $Id: HttpProxyGenerator.java,v 1.7 2004/03/05 13:02:20 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class HttpProxyGenerator extends ServiceableGenerator implements Configurable {
@@ -293,19 +293,19 @@
if (this.method instanceof PostMethod) {
String body = ((PostMethod) this.method).getRequestBodyAsString();
- attributes = new AttributesImpl();
+ attributes.clear();
attributes.addAttribute("", "name", "name", "CDATA", "Content-Type");
attributes.addAttribute("", "value", "value", "CDATA", "application/x-www-form-urlencoded");
super.xmlConsumer.startElement("", "header", "header", attributes);
super.xmlConsumer.endElement("", "header", "header");
- attributes = new AttributesImpl();
+ attributes.clear();
attributes.addAttribute("", "name", "name", "CDATA", "Content-Length");
attributes.addAttribute("", "value", "value", "CDATA", Integer.toString(body.length()));
super.xmlConsumer.startElement("", "header", "header", attributes);
super.xmlConsumer.endElement("", "header", "header");
- attributes = new AttributesImpl();
+ attributes.clear();
super.xmlConsumer.startElement("", "body", "body", attributes);
super.xmlConsumer.characters(body.toCharArray(), 0, body.length());
super.xmlConsumer.endElement("", "body", "body");
@@ -348,7 +348,7 @@
if (value != null) list.add(new NameValuePair(name, value));
}
}
-
+
return (list);
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/qdox/java/org/apache/cocoon/components/source/impl/QDoxSource.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/qdox/java/org/apache/cocoon/components/source/impl/QDoxSource.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/qdox/java/org/apache/cocoon/components/source/impl/QDoxSource.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/qdox/java/org/apache/cocoon/components/source/impl/QDoxSource.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2002,2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2002,2004-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,6 +42,8 @@
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.cocoon.serialization.XMLSerializer;
+import org.apache.cocoon.xml.XMLUtils;
+
import org.apache.commons.lang.StringUtils;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceException;
@@ -51,7 +53,6 @@
import org.apache.excalibur.xml.sax.XMLizable;
import org.apache.regexp.RE;
import org.apache.regexp.RESyntaxException;
-import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
@@ -60,11 +61,10 @@
* Source implementation for XML Javadoc.
*
* @author <a href="mailto:b.guijt1@chello.nl">Bart Guijt</a>
- * @version CVS $Id$ $Date: 2004/04/30 22:50:39 $
+ * @version $Id$ $Date: 2004/04/30 22:50:39 $
*/
-public final class QDoxSource
- extends AbstractSource
- implements XMLizable, Recyclable {
+public final class QDoxSource extends AbstractSource
+ implements XMLizable, Recyclable {
protected final static String ROOT_CLASSNAME = "java.lang.Object";
@@ -72,7 +72,6 @@
protected final static String NS_URI = "http://apache.org/cocoon/javadoc/1.0";
protected final static String NS_PREFIX = "jd";
protected final static String ATTR_TYPE = "NMTOKEN";
- protected final static Attributes EMPTY_ATTRS = new AttributesImpl();
protected final static String CLASS_ELEMENT = "class";
protected final static String CLASSNAME_ATTRIBUTE = "name";
@@ -1168,7 +1167,7 @@
* @param localName
*/
private void saxStartElement(ContentHandler handler, String localName) throws SAXException {
- handler.startElement(NS_URI, localName, NS_PREFIX + ':' + localName, EMPTY_ATTRS);
+ handler.startElement(NS_URI, localName, NS_PREFIX + ':' + localName, XMLUtils.EMPTY_ATTRIBUTES);
}
/**
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/helpers/SourceProperty.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/helpers/SourceProperty.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/helpers/SourceProperty.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/helpers/SourceProperty.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,8 +15,10 @@
*/
package org.apache.cocoon.components.source.helpers;
+import org.apache.cocoon.xml.XMLUtils;
import org.apache.cocoon.xml.dom.DOMBuilder;
import org.apache.cocoon.xml.dom.DOMStreamer;
+
import org.apache.excalibur.xml.sax.XMLizable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -31,18 +33,18 @@
*
* @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
* @author <a href="mailto:holz@fiz-chemie.de">Martin Holz</a>
- * @version CVS $Id: SourceProperty.java,v 1.3 2004/03/27 21:49:09 unico Exp $
+ * @version $Id$
*/
public class SourceProperty implements XMLizable {
private static final String URI = "http://www.w3.org/2000/xmlns/";
private static final String NS_PREFIX = "property";
private static final String D_PREFIX = NS_PREFIX+":";
-
+
private String namespace;
private String name;
private Element value;
-
+
/**
* Creates a new property for a source
*
@@ -166,9 +168,9 @@
StringBuffer buffer = new StringBuffer();
for (int i = 0; i<nodeslist.getLength(); i++) {
if ((nodeslist.item(i).getNodeType()==Node.TEXT_NODE) ||
- (nodeslist.item(i).getNodeType()==Node.CDATA_SECTION_NODE))
+ (nodeslist.item(i).getNodeType()==Node.CDATA_SECTION_NODE))
{
-
+
buffer.append(nodeslist.item(i).getNodeValue());
}
}
@@ -185,7 +187,7 @@
try {
DOMBuilder builder = new DOMBuilder();
builder.startDocument();
- builder.startElement(namespace, name, name, new AttributesImpl());
+ builder.startElement(namespace, name, name, XMLUtils.EMPTY_ATTRIBUTES);
DOMStreamer stream = new DOMStreamer(builder);
for (int i = 0; i<values.getLength(); i++) {
stream.stream(values.item(i));
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/generation/TraversableSourceDescriptionGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/generation/TraversableSourceDescriptionGenerator.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/generation/TraversableSourceDescriptionGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/generation/TraversableSourceDescriptionGenerator.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.xml.XMLUtils;
import org.apache.cocoon.components.source.InspectableSource;
import org.apache.cocoon.components.source.LockableSource;
import org.apache.cocoon.components.source.RestrictableSource;
@@ -36,7 +37,6 @@
import org.xml.sax.helpers.AttributesImpl;
/**
- *
* This Generator augments the output of the TraversableGenerator.
* <p>
* It adds:
@@ -50,27 +50,28 @@
* <p>
* Sitemap parameters that can be specified to control processing are:
* <ul>
- * <li><code>version</code> (<code>true</code>)
+ * <li><code>version</code> (<code>true</code>)
* whether to generate versioning information.</li>
- * <li><code>locking</code> (<code>true</code>)
+ * <li><code>locking</code> (<code>true</code>)
* whether to generate locking information.</li>
- * <li><code>permission</code> (<code>true</code>)
+ * <li><code>permission</code> (<code>true</code>)
* whether to generate permission information.</li>
- * <li><code>properties</code> (<code>true</code>)
+ * <li><code>properties</code> (<code>true</code>)
* whether to generate source property information.</li>
* </ul>
* </p>
- *
+ *
* @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
* @author <a href="mailto:unico@hippo.nl">Unico Hommes</a>
+ * @version $Id$
*/
public class TraversableSourceDescriptionGenerator extends TraversableGenerator {
-
+
protected static final String MIME_TYPE_ATTR_NAME = "mimeType";
-
+
private static final String REVISION_ATTR_NAME = "revision";
private static final String REVISIONBRANCH_ATTR_NAME = "branch";
-
+
private static final String PROPERTIES_NODE_NAME = "properties";
private static final String PROPERTIES_NODE_QNAME = PREFIX + ":" + PROPERTIES_NODE_NAME;
@@ -83,7 +84,7 @@
private static final String LOCKS_NODE_QNAME = PREFIX + ":" + LOCKS_NODE_NAME;
private static final String LOCK_NODE_NAME = "lock";
private static final String LOCK_NODE_QNAME = PREFIX + ":" + LOCK_NODE_NAME;
-
+
private static final String PRINCIPAL_ATTR_NAME = "principal";
private static final String GROUP_ATTR_NAME = "group";
private static final String PRIVILEGE_ATTR_NAME = "privilege";
@@ -93,8 +94,8 @@
private static final String TYPE_ATTR_NAME = "type";
private static final String EXPIRATION_ATTR_NAME = "expiration";
private static final String EXCLUSIVE_ATTR_NAME = "exclusive";
-
-
+
+
/** Include properties into the description */
private boolean properties = true;
@@ -106,8 +107,8 @@
/** Include version into the description */
private boolean version = true;
-
-
+
+
/**
* Set the <code>SourceResolver</code>, objectModel <code>Map</code>,
* the source and sitemap <code>Parameters</code> used to process the request.
@@ -119,23 +120,23 @@
*/
public void setup(SourceResolver resolver, Map objectModel,
String location,
- Parameters parameters)
+ Parameters parameters)
throws ProcessingException, SAXException, IOException {
-
+
super.setup(resolver, objectModel, location, parameters);
this.properties = parameters.getParameterAsBoolean("properties", true);
super.cacheKeyParList.add(String.valueOf(this.permissions));
-
+
this.permissions = parameters.getParameterAsBoolean("permissions", true);
super.cacheKeyParList.add(String.valueOf(this.permissions));
this.locks = parameters.getParameterAsBoolean("locks", true);
super.cacheKeyParList.add(String.valueOf(this.locks));
-
+
this.version = parameters.getParameterAsBoolean("version", true);
super.cacheKeyParList.add(String.valueOf(this.version));
-
+
if (getLogger().isDebugEnabled()) {
getLogger().debug("properties: " + this.properties);
getLogger().debug("permissions: " + this.permissions);
@@ -143,15 +144,15 @@
getLogger().debug("version: " + this.version);
}
}
-
+
/**
* Augments source nodes with additional information.
- *
+ *
* @param source the Source to describe.
*/
protected final void addContent(TraversableSource source)
throws SAXException, ProcessingException {
-
+
super.addContent(source);
try {
if (this.properties && (source instanceof InspectableSource)) {
@@ -168,14 +169,14 @@
}
}
-
+
/**
* Augments source node elements with additional attributes describing the Source.
- * The additional attributes are a <code>mimeType</code> attribute,
- * and iff the Source is an instance of VersionableSource and the generator
- * is configured to output versioning information two attributes:
+ * The additional attributes are a <code>mimeType</code> attribute,
+ * and iff the Source is an instance of VersionableSource and the generator
+ * is configured to output versioning information two attributes:
* <code>revision</code> and <code>branch</code>.
- *
+ *
* @param source the Source to describe.
*/
protected void setNodeAttributes(TraversableSource source) throws SAXException, ProcessingException {
@@ -198,7 +199,7 @@
REVISION_ATTR_NAME, "CDATA",
versionablesource.getSourceRevision());
}
-
+
if ((versionablesource.getSourceRevisionBranch()!=null) &&
(versionablesource.getSourceRevisionBranch().length()>
0)) {
@@ -214,7 +215,7 @@
}
}
}
-
+
/**
* Push a XML description about all properties, which
* the source owns.
@@ -222,16 +223,14 @@
* @param source the Source to describe.
*/
private void pushSourceProperties(InspectableSource source)
- throws SAXException, SourceException {
-
+ throws SAXException, SourceException {
+
SourceProperty[] properties = source.getSourceProperties();
if (properties != null && properties.length > 0) {
- SourceProperty property;
- AttributesImpl attributes = new AttributesImpl();
this.contentHandler.startElement(URI, PROPERTIES_NODE_NAME,
- PROPERTIES_NODE_QNAME, attributes);
+ PROPERTIES_NODE_QNAME, XMLUtils.EMPTY_ATTRIBUTES);
for (int i = 0; i < properties.length; i++) {
- property = properties[i];
+ SourceProperty property = properties[i];
property.toSAX(this.contentHandler);
}
this.contentHandler.endElement(URI, PROPERTIES_NODE_NAME,
@@ -253,7 +252,7 @@
this.contentHandler.startElement(URI,
PERMISSIONS_NODE_NAME,
PERMISSIONS_NODE_QNAME,
- new AttributesImpl());
+ XMLUtils.EMPTY_ATTRIBUTES);
for (int i = 0; i < permissions.length; i++) {
AttributesImpl attributes = new AttributesImpl();
@@ -304,14 +303,12 @@
if (locks != null && locks.length > 0) {
this.contentHandler.startElement(URI, LOCKS_NODE_NAME,
LOCKS_NODE_QNAME,
- new AttributesImpl());
+ XMLUtils.EMPTY_ATTRIBUTES);
for (int i = 0; locks.length > 0; i++) {
SourceLock lock = locks[i];
AttributesImpl attributes = new AttributesImpl();
-
- attributes = new AttributesImpl();
attributes.addAttribute("", PRINCIPAL_ATTR_NAME,
PRINCIPAL_ATTR_NAME, "CDATA",
lock.getSubject());
@@ -331,12 +328,11 @@
LOCK_NODE_QNAME, attributes);
this.contentHandler.endElement(URI, LOCK_NODE_NAME,
LOCK_NODE_QNAME);
-
}
this.contentHandler.endElement(URI, LOCKS_NODE_NAME,
LOCKS_NODE_QNAME);
}
}
-
+
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/slop/java/org/apache/cocoon/slop/parsing/SimpleSlopParser.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/slop/java/org/apache/cocoon/slop/parsing/SimpleSlopParser.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/slop/java/org/apache/cocoon/slop/parsing/SimpleSlopParser.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/slop/java/org/apache/cocoon/slop/parsing/SimpleSlopParser.java Tue Apr 26 09:07:03 2005
@@ -1,45 +1,46 @@
/*
- * Copyright 1999-2002,2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2002,2004-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.cocoon.slop.parsing;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.xml.XMLUtils;
import org.apache.cocoon.slop.interfaces.SlopParser;
import org.apache.cocoon.slop.interfaces.SlopConstants;
-/** Simplistic SLOP parser, recognizes the following constructs:
+/**
+ * Simplistic SLOP parser, recognizes the following constructs:
*
* Field: a line starting with letters and : is considered a field
*
* Empty lines are detected.
* Other lines are output as line elements
*
- * This is sufficient for basic parsing of RFC 822 headers,
- * but a configurable rfc822 mode would be good to differentiate
- * between the header and body of the email message and parse them
- * with different rules.
+ * This is sufficient for basic parsing of RFC 822 headers,
+ * but a configurable rfc822 mode would be good to differentiate
+ * between the header and body of the email message and parse them
+ * with different rules.
*
* @author <a href="mailto:bdelacretaz@apache.org">Bertrand Delacretaz</a>
- * @version CVS $Id: SimpleSlopParser.java,v 1.3 2004/03/05 13:02:24 bdelacretaz Exp $
+ * @version $Id$
*/
-
public class SimpleSlopParser implements SlopParser,SlopConstants {
+
private ContentHandler contentHandler;
/** chars that can be part of a field name (other than letters) */
@@ -97,17 +98,16 @@
/** must be called before any call to processLine() */
public void startDocument(ContentHandler destination)
- throws SAXException, ProcessingException {
+ throws SAXException, ProcessingException {
contentHandler = destination;
contentHandler.startDocument();
contentHandler.startPrefixMapping("", SLOP_NAMESPACE_URI);
- final AttributesImpl atts = new AttributesImpl();
- contentHandler.startElement(SLOP_NAMESPACE_URI, SLOP_ROOT_ELEMENT, SLOP_ROOT_ELEMENT, atts);
+ contentHandler.startElement(SLOP_NAMESPACE_URI, SLOP_ROOT_ELEMENT, SLOP_ROOT_ELEMENT, XMLUtils.EMPTY_ATTRIBUTES);
}
/** must be called once all calls to processLine() are done */
public void endDocument()
- throws SAXException, ProcessingException {
+ throws SAXException, ProcessingException {
contentHandler.endElement(SLOP_NAMESPACE_URI, SLOP_ROOT_ELEMENT, SLOP_ROOT_ELEMENT);
contentHandler.endPrefixMapping("");
contentHandler.endDocument();
@@ -122,7 +122,7 @@
/** call this to process input lines, does the actual parsing */
public void processLine(String line)
- throws SAXException, ProcessingException {
+ throws SAXException, ProcessingException {
if(contentHandler == null) {
throw new ProcessingException("SimpleSlopParser content handler is null (startDocument not called?)");
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/web3/java/org/apache/cocoon/components/web3/impl/DefaultWeb3StreamerImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/web3/java/org/apache/cocoon/components/web3/impl/DefaultWeb3StreamerImpl.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/web3/java/org/apache/cocoon/components/web3/impl/DefaultWeb3StreamerImpl.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/web3/java/org/apache/cocoon/components/web3/impl/DefaultWeb3StreamerImpl.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,40 +32,40 @@
*
* @author <a href="mailto:michael.gerzabek@at.efp.cc">Michael Gerzabek</a>
* @since 2.1
- * @version CVS $Id: DefaultWeb3StreamerImpl.java,v 1.7 2004/03/05 13:02:25 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class DefaultWeb3StreamerImpl implements Web3Streamer, Poolable {
- public void stream(JCO.Function function,
- ContentHandler contentHandler) throws SAXException {
+ public void stream(JCO.Function function,
+ ContentHandler contentHandler)
+ throws SAXException {
- AttributesImpl attributes = new AttributesImpl();
- attributes.clear();
- attributes.addAttribute( Web3.URI, Web3.INCLUDE_NAME_ATTR,
+ AttributesImpl attributes = new AttributesImpl();
+ attributes.addAttribute( Web3.URI, Web3.INCLUDE_NAME_ATTR,
Web3.INCLUDE_NAME_ATTR, "CDATA", function.getName().toUpperCase() );
- contentHandler.startElement( Web3.URI, Web3.INCLUDE_ELEM,
+ contentHandler.startElement( Web3.URI, Web3.INCLUDE_ELEM,
Web3.INCLUDE_ELEM, attributes );
attributes.clear();
- contentHandler.startElement( Web3.URI, Web3.IMPORT_ELEM,
+ contentHandler.startElement( Web3.URI, Web3.IMPORT_ELEM,
Web3.IMPORT_ELEM, attributes );
streamParameterList( function.getImportParameterList(), contentHandler );
contentHandler.endElement( Web3.URI, Web3.IMPORT_ELEM, Web3.IMPORT_ELEM );
attributes.clear();
- contentHandler.startElement( Web3.URI, Web3.EXPORT_ELEM,
+ contentHandler.startElement( Web3.URI, Web3.EXPORT_ELEM,
Web3.EXPORT_ELEM, attributes );
streamParameterList( function.getExportParameterList(), contentHandler );
contentHandler.endElement( Web3.URI, Web3.EXPORT_ELEM, Web3.EXPORT_ELEM );
-
+
JCO.ParameterList tablesParameterList = function.getTableParameterList();
attributes.clear();
- contentHandler.startElement( Web3.URI, Web3.TABLES_ELEM,
+ contentHandler.startElement( Web3.URI, Web3.TABLES_ELEM,
Web3.TABLES_ELEM, attributes );
if (null != tablesParameterList) {
for (int i = 0; i < tablesParameterList.getFieldCount(); i++) {
attributes.clear();
- attributes.addAttribute( Web3.URI, Web3.TABLE_NAME_ATTR,
- Web3.TABLE_NAME_ATTR, "CDATA",
+ attributes.addAttribute( Web3.URI, Web3.TABLE_NAME_ATTR,
+ Web3.TABLE_NAME_ATTR, "CDATA",
tablesParameterList.getName(i).toUpperCase() );
contentHandler.startElement( Web3.URI, Web3.TABLE_ELEM,
Web3.TABLE_ELEM, attributes );
@@ -74,87 +74,86 @@
for (int j = 0; j < sapTable.getNumRows(); j++) {
sapTable.setRow(j);
attributes.clear();
- attributes.addAttribute(Web3.URI, Web3.ROW_ID_ATTR,
+ attributes.addAttribute(Web3.URI, Web3.ROW_ID_ATTR,
Web3.ROW_ID_ATTR, "CDATA", "" + (j + 1));
- contentHandler.startElement(Web3.URI, Web3.ROW_ELEM,
+ contentHandler.startElement(Web3.URI, Web3.ROW_ELEM,
Web3.ROW_ELEM, attributes);
for (int k = 0; k < sapTable.getFieldCount(); k++) {
attributes.clear();
- attributes.addAttribute(Web3.URI,
- Web3.FIELD_NAME_ATTR, Web3.FIELD_NAME_ATTR,
+ attributes.addAttribute(Web3.URI,
+ Web3.FIELD_NAME_ATTR, Web3.FIELD_NAME_ATTR,
"CDATA", sapTable.getName(k).toUpperCase());
- contentHandler.startElement(Web3.URI,
+ contentHandler.startElement(Web3.URI,
Web3.FIELD_ELEM, Web3.FIELD_ELEM, attributes);
- String theValue = ( sapTable.getString(k) == null)
+ String theValue = ( sapTable.getString(k) == null)
? "" : sapTable.getString(k).trim();
- contentHandler.characters(theValue.toCharArray(), 0,
+ contentHandler.characters(theValue.toCharArray(), 0,
theValue.length());
- contentHandler.endElement(Web3.URI, Web3.FIELD_ELEM,
+ contentHandler.endElement(Web3.URI, Web3.FIELD_ELEM,
Web3.FIELD_ELEM);
}
- contentHandler.endElement(Web3.URI, Web3.ROW_ELEM,
+ contentHandler.endElement(Web3.URI, Web3.ROW_ELEM,
Web3.ROW_ELEM);
}
- contentHandler.endElement(Web3.URI, Web3.TABLE_ELEM,
+ contentHandler.endElement(Web3.URI, Web3.TABLE_ELEM,
Web3.TABLE_ELEM);
}
- }
+ }
}
contentHandler.endElement(Web3.URI, Web3.TABLES_ELEM, Web3.TABLES_ELEM);
- contentHandler.endElement( Web3.URI, Web3.INCLUDE_ELEM,
+ contentHandler.endElement( Web3.URI, Web3.INCLUDE_ELEM,
Web3.INCLUDE_ELEM );
}
-
+
protected void streamParameterList(JCO.ParameterList pList,
- ContentHandler contentHandler) throws SAXException {
-
+ ContentHandler contentHandler)
+ throws SAXException {
+
AttributesImpl attributes = new AttributesImpl();
- attributes.clear();
if (pList != null) {
for (int i = 0; i < pList.getFieldCount(); i++) {
+ attributes.clear();
+
JCO.Field theField = pList.getField(i);
if (theField.isStructure()) {
- JCO.Structure sapStructure =
+ JCO.Structure sapStructure =
pList.getStructure(pList.getName(i));
- attributes.clear();
- attributes.addAttribute(Web3.URI, Web3.STRUCTURE_NAME_ATTR,
- Web3.STRUCTURE_NAME_ATTR, "CDATA",
+ attributes.addAttribute(Web3.URI, Web3.STRUCTURE_NAME_ATTR,
+ Web3.STRUCTURE_NAME_ATTR, "CDATA",
pList.getName(i).toUpperCase());
- contentHandler.startElement(Web3.URI, Web3.STRUCTURE_ELEM,
- Web3.STRUCTURE_ELEM, attributes);
+ contentHandler.startElement(Web3.URI, Web3.STRUCTURE_ELEM,
+ Web3.STRUCTURE_ELEM, attributes);
for (int j = 0; j < sapStructure.getFieldCount(); j++) {
attributes.clear();
- attributes.addAttribute(Web3.URI, Web3.FIELD_NAME_ATTR,
- Web3.FIELD_NAME_ATTR, "CDATA",
+ attributes.addAttribute(Web3.URI, Web3.FIELD_NAME_ATTR,
+ Web3.FIELD_NAME_ATTR, "CDATA",
sapStructure.getName(j).toUpperCase());
- contentHandler.startElement(Web3.URI, Web3.FIELD_ELEM,
+ contentHandler.startElement(Web3.URI, Web3.FIELD_ELEM,
Web3.FIELD_ELEM, attributes);
- String theValue = (sapStructure.getString(j) == null)
+ String theValue = (sapStructure.getString(j) == null)
? "" : sapStructure.getString(j).trim();
- contentHandler.characters(theValue.toCharArray(), 0,
+ contentHandler.characters(theValue.toCharArray(), 0,
theValue.length());
- contentHandler.endElement(Web3.URI, Web3.FIELD_ELEM,
+ contentHandler.endElement(Web3.URI, Web3.FIELD_ELEM,
Web3.FIELD_ELEM);
}
- contentHandler.endElement(Web3.URI, Web3.STRUCTURE_ELEM,
+ contentHandler.endElement(Web3.URI, Web3.STRUCTURE_ELEM,
Web3.STRUCTURE_ELEM);
- }
- else {
- attributes.clear();
- attributes.addAttribute(Web3.URI, Web3.FIELD_NAME_ATTR,
- Web3.FIELD_NAME_ATTR, "CDATA",
+ } else {
+ attributes.addAttribute(Web3.URI, Web3.FIELD_NAME_ATTR,
+ Web3.FIELD_NAME_ATTR, "CDATA",
pList.getName(i).toUpperCase());
- contentHandler.startElement(Web3.URI, Web3.FIELD_ELEM,
+ contentHandler.startElement(Web3.URI, Web3.FIELD_ELEM,
Web3.FIELD_ELEM, attributes);
String theValue = (pList.getString(i) == null)
? "" : pList.getString(i).trim();
- contentHandler.characters(theValue.toCharArray(), 0,
+ contentHandler.characters(theValue.toCharArray(), 0,
theValue.length());
- contentHandler.endElement(Web3.URI, Web3.FIELD_ELEM,
+ contentHandler.endElement(Web3.URI, Web3.FIELD_ELEM,
Web3.FIELD_ELEM);
}
}
- }
+ }
}
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSource.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSource.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSource.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSource.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -69,7 +69,7 @@
/**
* A source implementation to get access to WebDAV repositories.
- *
+ *
* <h2>Protocol syntax</h2>
* <p><code>webdav://[usr[:password]@]host[:port][/path][?cocoon:webdav-depth][&cocoon:webdav-action]</code></p>
* <p>
@@ -84,31 +84,32 @@
* </li>
* </ul>
* <p>
- *
+ *
* @version $Id$
*/
-public class WebDAVSource extends AbstractLogEnabled
-implements Source, TraversableSource, ModifiableSource, ModifiableTraversableSource, InspectableSource, MoveableSource {
+public class WebDAVSource extends AbstractLogEnabled
+ implements Source, TraversableSource, ModifiableSource,
+ ModifiableTraversableSource, InspectableSource, MoveableSource {
private static final String NAMESPACE = "http://apache.org/cocoon/webdav/1.0";
private static final String PREFIX = "webdav";
private static final String RESOURCE_NAME = "resource";
private static final String COLLECTION_NAME = "collection";
-
+
// the http url
private final HttpURL url;
-
+
// the scheme name
private final String protocol;
-
+
// cached uri and secureUri values
private String uri;
private String secureUri;
-
+
// the SWCL resource
private WebdavResource resource = null;
-
+
// current resource initialization values
private int depth = -1;
private int action = -1;
@@ -119,15 +120,15 @@
private WebDAVSource(HttpURL url, String protocol) throws URIException {
this.protocol = protocol;
this.url = url;
-
+
String qs = url.getQuery();
if (qs != null) {
final SourceParameters sp = new SourceParameters(qs);
-
+
// parse optional start depth and start action qs parameters
this.depth = sp.getParameterAsInteger("cocoon:webdav-depth", DepthSupport.DEPTH_1);
this.action = sp.getParameterAsInteger("cocoon:webdav-action", WebdavResource.NOACTION);
-
+
// [UH] FIXME: Why this alternative way of passing in credentials?
String principal = url.getUser();
String password = url.getPassword();
@@ -144,7 +145,7 @@
sp.removeParameter("cocoon:webdav-action");
sp.removeParameter("cocoon:webdav-principal");
sp.removeParameter("cocoon:webdav-password");
-
+
// set the qs without WebdavSource specific parameters
url.setQuery(sp.getQueryString());
}
@@ -153,23 +154,23 @@
/**
* Constructor used by getChildren() method.
*/
- private WebDAVSource (WebdavResource resource, HttpURL url, String protocol)
+ private WebDAVSource (WebdavResource resource, HttpURL url, String protocol)
throws URIException {
this(url, protocol);
this.resource = resource;
}
-
+
/**
* Initialize the SWCL WebdavResource.
* <p>
- * The action argument specifies a set of properties to load during initialization.
+ * The action argument specifies a set of properties to load during initialization.
* Its value is one of WebdavResource.NOACTION, WebdavResource.NAME,
* WebdavResource.BASIC, WebdavResource.DEFAULT, WebdavResource.ALL.
- * Similarly the depth argument specifies the depth header of the PROPFIND
+ * Similarly the depth argument specifies the depth header of the PROPFIND
* method that is executed upon initialization.
* </p>
* <p>
- * The different methods of this Source implementation call this method to
+ * The different methods of this Source implementation call this method to
* initialize the resource using their minimal action and depth requirements.
* For instance the WebDAVSource.getMimeType() method requires WebdavResource.BASIC
* properties and a search depth of 0 is sufficient.
@@ -180,11 +181,11 @@
* It would be more efficient if previous initialization had been done using depth 1 instead.
* In order give the user more control over this the WebDAVSource can be passed a minimal
* action and depth using cocoon:webdav-depth and cocoon:webdav-action query string parameters.
- * By default the mimimum action is WebdavResource.BASIC (which loads all the following basic
+ * By default the mimimum action is WebdavResource.BASIC (which loads all the following basic
* webdav properties: DAV:displayname, DAV:getcontentlength, DAV:getcontenttype DAV:resourcetype,
* DAV:getlastmodified and DAV:lockdiscovery). The default minimum depth is 1.
* </p>
- *
+ *
* @param action the set of propterties the WebdavResource should load.
* @param depth the webdav depth.
* @throws SourceException
@@ -224,7 +225,7 @@
if (e.getReasonCode() == HttpStatus.SC_NOT_FOUND) {
throw new SourceNotFoundException("Not found: " + getSecureURI(), e);
}
- final String msg = "Could not initialize webdav resource. Server responded "
+ final String msg = "Could not initialize webdav resource. Server responded "
+ e.getReasonCode() + " (" + e.getReason() + ") - " + e.getMessage();
throw new SourceException(msg, e);
} catch (IOException e) {
@@ -237,28 +238,28 @@
*/
public static WebDAVSource newWebDAVSource(HttpURL url,
String protocol,
- Logger logger)
+ Logger logger)
throws URIException {
final WebDAVSource source = new WebDAVSource(url, protocol);
source.enableLogging(logger);
return source;
}
-
+
/**
* Static factory method to obtain a Source.
*/
private static WebDAVSource newWebDAVSource(WebdavResource resource,
HttpURL url,
String protocol,
- Logger logger)
+ Logger logger)
throws URIException {
final WebDAVSource source = new WebDAVSource(resource, url, protocol);
source.enableLogging(logger);
return source;
}
-
+
// ---------------------------------------------------- Source implementation
-
+
/**
* Get the scheme for this Source.
*/
@@ -286,7 +287,7 @@
}
return this.uri;
}
-
+
/**
* Return the URI securely, without username and password
*/
@@ -302,7 +303,7 @@
}
return this.secureUri;
}
-
+
/**
* Get the Validity object. This can either wrap the last modification
* date or the expires information or...
@@ -416,22 +417,20 @@
}
private InputStream resourcesToXml(WebdavResource[] resources)
- throws Exception {
+ throws Exception {
TransformerFactory tf = TransformerFactory.newInstance();
- TransformerHandler th =
- ((SAXTransformerFactory) tf).newTransformerHandler();
+ TransformerHandler th = ((SAXTransformerFactory) tf).newTransformerHandler();
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
StreamResult result = new StreamResult(bOut);
th.setResult(result);
th.startDocument();
th.startPrefixMapping(PREFIX, NAMESPACE);
- th.startElement(NAMESPACE, COLLECTION_NAME,
- PREFIX + ":" + COLLECTION_NAME, new AttributesImpl());
- this.resourcesToSax(resources, th);
- th.endElement(NAMESPACE, COLLECTION_NAME,
- PREFIX + ":" + COLLECTION_NAME);
+ th.startElement(NAMESPACE, COLLECTION_NAME, PREFIX + ":" + COLLECTION_NAME, XMLUtils.EMPTY_ATTRIBUTES);
+ resourcesToSax(resources, th);
+ th.endElement(NAMESPACE, COLLECTION_NAME, PREFIX + ":" + COLLECTION_NAME);
th.endPrefixMapping(PREFIX);
th.endDocument();
+
return new ByteArrayInputStream(bOut.toByteArray());
}
@@ -470,28 +469,28 @@
if (getLogger().isDebugEnabled()) {
final String message =
"Unable to get WebDAV children. Server responded " +
- e.getReasonCode() + " (" + e.getReason() + ") - "
+ e.getReasonCode() + " (" + e.getReason() + ") - "
+ e.getMessage();
getLogger().debug(message);
}
} catch (SAXException e) {
if (getLogger().isDebugEnabled()) {
final String message =
- "Unable to get WebDAV children: "
+ "Unable to get WebDAV children: "
+ e.getMessage();
getLogger().debug(message,e);
}
} catch (IOException e) {
if (getLogger().isDebugEnabled()) {
final String message =
- "Unable to get WebDAV children: "
+ "Unable to get WebDAV children: "
+ e.getMessage();
getLogger().debug(message,e);
}
} catch (Exception e) {
if (getLogger().isDebugEnabled()) {
final String message =
- "Unable to get WebDAV children: "
+ "Unable to get WebDAV children: "
+ e.getMessage();
getLogger().debug(message,e);
}
@@ -518,7 +517,7 @@
}
// ---------------------------------------------------- TraversableSource implementation
-
+
/**
* Get a collection child.
*
@@ -538,7 +537,7 @@
return WebDAVSource.newWebDAVSource(childURL, this.protocol, getLogger());
} catch (URIException e) {
throw new SourceException("Failed to create child", e);
- }
+ }
}
/**
@@ -569,7 +568,7 @@
if (getLogger().isDebugEnabled()) {
final String message =
"Unable to get WebDAV children. Server responded " +
- e.getReasonCode() + " (" + e.getReason() + ") - "
+ e.getReasonCode() + " (" + e.getReason() + ") - "
+ e.getMessage();
getLogger().debug(message);
}
@@ -598,7 +597,7 @@
/**
* Get the parent.
- *
+ *
* @see org.apache.excalibur.source.TraversableSource#getParent()
*/
public Source getParent() throws SourceException {
@@ -635,9 +634,9 @@
}
return this.resource.isCollection();
}
-
+
// ---------------------------------------------------- ModifiableSource implementation
-
+
/**
* Get an <code>OutputStream</code> where raw bytes can be written to.
* The signification of these bytes is implementation-dependent and
@@ -686,7 +685,7 @@
throw new IllegalArgumentException("The stream is not associated to this source");
}
- /**
+ /**
* Delete this source (unimplemented).
* @see org.apache.excalibur.source.ModifiableSource#delete()
*/
@@ -719,7 +718,7 @@
} catch (HttpException he) {
final String message =
"Unable to close output stream. Server responded " +
- he.getReasonCode() + " (" + he.getReason() + ") - "
+ he.getReasonCode() + " (" + he.getReason() + ") - "
+ he.getMessage();
this.source.getLogger().debug(message);
throw new IOException(he.getMessage());
@@ -729,11 +728,11 @@
}
}
}
-
+
private boolean canCancel() {
return !isClosed;
}
-
+
private void cancel() {
if (isClosed) {
throw new IllegalStateException("Cannot cancel: outputstream is already closed");
@@ -741,9 +740,9 @@
this.isClosed = true;
}
}
-
+
// ---------------------------------------------------- ModifiableTraversableSource implementation
-
+
/**
* Create the collection, if it doesn't exist.
* @see org.apache.excalibur.source.ModifiableTraversableSource#makeCollection()
@@ -767,7 +766,7 @@
}
// Ignore status 405 - Not allowed: collection already exists
else if (status != 405) {
- final String msg =
+ final String msg =
"Unable to create collection " + getSecureURI()
+ ". Server responded " + this.resource.getStatusCode()
+ " (" + this.resource.getStatusMessage() + ")";
@@ -779,12 +778,12 @@
} catch (SourceException e) {
throw e;
} catch (IOException e) {
- throw new SourceException("Unable to create collection(s)" + getSecureURI(), e);
+ throw new SourceException("Unable to create collection(s)" + getSecureURI(), e);
}
}
-
+
// ---------------------------------------------------- InspectableSource implementation
-
+
/**
* Returns a enumeration of the properties
*
@@ -793,13 +792,13 @@
* @throws SourceException If an exception occurs.
*/
public SourceProperty[] getSourceProperties() throws SourceException {
-
+
initResource(WebdavResource.NOACTION, DepthSupport.DEPTH_0);
-
+
Vector sourceproperties = new Vector();
Enumeration props= null;
org.apache.webdav.lib.Property prop = null;
-
+
try {
Enumeration responses = this.resource.propfindMethod(0);
while (responses.hasMoreElements()) {
@@ -834,9 +833,9 @@
* @throws SourceException If an exception occurs.
*/
public SourceProperty getSourceProperty (String namespace, String name) throws SourceException {
-
+
initResource(WebdavResource.NOACTION, DepthSupport.DEPTH_0);
-
+
Vector propNames = new Vector(1);
propNames.add(new PropertyName(namespace,name));
Enumeration props= null;
@@ -867,9 +866,9 @@
*/
public void removeSourceProperty(String namespace, String name)
throws SourceException {
-
+
initResource(WebdavResource.NOACTION, DepthSupport.DEPTH_0);
-
+
try {
this.resource.proppatchMethod(new PropertyName(namespace, name), "", false);
} catch (Exception e) {
@@ -885,16 +884,16 @@
* @throws SourceException If an exception occurs during this operation
*/
public void setSourceProperty(SourceProperty sourceproperty) throws SourceException {
-
+
initResource(WebdavResource.NOACTION, DepthSupport.DEPTH_0);
-
+
try {
Node node = null;
NodeList list = sourceproperty.getValue().getChildNodes();
for (int i=0; i<list.getLength(); i++) {
if ((list.item(i) instanceof Text && !"".equals(list.item(i).getNodeValue()))
|| list.item(i) instanceof Element) {
-
+
node = list.item(i);
break;
}
@@ -904,7 +903,7 @@
format.put(OutputKeys.METHOD, "xml");
format.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
String prop = XMLUtils.serializeNode(node, format);
-
+
this.resource.proppatchMethod(
new PropertyName(sourceproperty.getNamespace(),sourceproperty.getName()),
prop, true);
@@ -912,7 +911,7 @@
} catch(HttpException e) {
final String message =
"Unable to set property. Server responded " +
- e.getReasonCode() + " (" + e.getReason() + ") - "
+ e.getReasonCode() + " (" + e.getReason() + ") - "
+ e.getMessage();
getLogger().debug(message);
throw new SourceException("Could not set property ", e);
@@ -920,8 +919,8 @@
throw new SourceException("Could not set property ", e);
}
}
-
- /**
+
+ /**
* Get the current credential for the source
*/
// public SourceCredential getSourceCredential() throws SourceException {
@@ -931,7 +930,7 @@
// return null;
// }
- /**
+ /**
* Set the credential for the source
*/
// public void setSourceCredential(SourceCredential sourcecredential)
@@ -944,7 +943,7 @@
// }
// ---------------------------------------------------- MoveableSource
-
+
/**
* Move the current source to a specified destination.
*
@@ -957,7 +956,7 @@
initResource(WebdavResource.NOACTION, DepthSupport.DEPTH_0);
WebDAVSource destination = (WebDAVSource)source;
destination.initResource(WebdavResource.BASIC, DepthSupport.DEPTH_0);
- try {
+ try {
this.resource.moveMethod(destination.resource.getHttpURL().getPath());
} catch (HttpException e) {
throw new SourceException("Cannot move source '"+getSecureURI()+"'", e);
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/transformation/DASLTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/transformation/DASLTransformer.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/transformation/DASLTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/transformation/DASLTransformer.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,15 +40,15 @@
import org.xml.sax.helpers.AttributesImpl;
/**
- * This transformer performs DASL queries on DASL-enabled WebDAV servers.
+ * This transformer performs DASL queries on DASL-enabled WebDAV servers.
* It expects a "query" element in the "http://cocoon.apache.org/webdav/dasl/1.0"
* namespace containing the DASL query to execute, with a "target" attribute specifiyng
* the webdav:// or http:// URL for the target WebDAV server. It will then replace
- * it with a "query-result" element containing the WebDAV results.
- *
- * Each result will be contained in a "result" element with a "path" attribute pointing at it
- * and all WebDAV properties presented as (namespaced) children elements.
- *
+ * it with a "query-result" element containing the WebDAV results.
+ *
+ * Each result will be contained in a "result" element with a "path" attribute pointing at it
+ * and all WebDAV properties presented as (namespaced) children elements.
+ *
* Sample invocation:
* lt;dasl:query xmlns:dasl="http://cocoon.apache.org/webdav/dasl/1.0"
* target="webdav://localhost/repos/"gt;
@@ -86,10 +86,10 @@
* lt;/D:basicsearchgt;
* lt;/D:searchrequestgt;
* lt;/dasl:querygt;
- *
+ *
* Features
* - Substitution of a value: with this feature it's possible to pass value from sitemap
- * that are substituted into a query.
+ * that are substituted into a query.
* sitemap example:
* lt;map:transformer type="dasl"gt;
* lt;parameter name="repos" value="/repos/"gt;
@@ -99,7 +99,7 @@
* lt;D:hrefgt;lt;substitute-value name="repos"/gt;lt;/D:hrefgt;
* ....
* This feature is like substitute-value of SQLTransformer
- *
+ *
* TODO: the SWCL Search method doesn't preserve the result order, which makes
* order-by clauses useless.
*
@@ -107,6 +107,7 @@
*
* @author <a href="mailto: gianugo@apache.org">Gianugo Rabellino</a>
* @author <a href="mailto:d.madama@pro-netics.com>Daniele Madama</a>
+ * @version $Id$
*/
public class DASLTransformer extends AbstractSAXTransformer {
@@ -124,7 +125,7 @@
/** The tag name of root_tag for result */
static final String RESULT_ROOT_TAG = "query-result";
/** The tag name for substitution of query parameter */
- static final String SUBSTITUTE_TAG = "substitute-value";
+ static final String SUBSTITUTE_TAG = "substitute-value";
/** The tag name for substitution of query parameter */
static final String SUBSTITUTE_TAG_NAME_ATTRIBUTE = "name";
@@ -136,7 +137,7 @@
/**
* Intercept the <dasl:query> start tag.
- *
+ *
* @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
*/
public void startElement(
@@ -173,9 +174,9 @@
}
/**
- * Intercept the <dasl:query> end tag, convert buffered input to a String, build and execute the
+ * Intercept the <dasl:query> end tag, convert buffered input to a String, build and execute the
* DASL query.
- *
+ *
* @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
*/
public void endElement(String uri, String name, String raw)
@@ -208,7 +209,7 @@
HttpState state = new HttpState();
state.setCredentials(null, new UsernamePasswordCredentials(
url.getUser(),
- url.getPassword()));
+ url.getPassword()));
HttpConnection conn = new HttpConnection(url.getHost(), url.getPort());
WebdavResource resource = new WebdavResource(new HttpURL(this.targetUrl));
if(!resource.exists()) {
@@ -219,12 +220,12 @@
throw new SAXException("The server don't support the SEARCH method");
}
searchMethod.execute(state, conn);
+
Enumeration enumeration = searchMethod.getAllResponseURLs();
- this.contentHandler.startElement(
- DASL_QUERY_NS,
- RESULT_ROOT_TAG,
- PREFIX + ":" + RESULT_ROOT_TAG,
- new AttributesImpl());
+ this.contentHandler.startElement(DASL_QUERY_NS,
+ RESULT_ROOT_TAG,
+ PREFIX + ":" + RESULT_ROOT_TAG,
+ XMLUtils.EMPTY_ATTRIBUTES);
while (enumeration.hasMoreElements()) {
String path = (String) enumeration.nextElement();
Enumeration properties = searchMethod.getResponseProperties(path);
@@ -240,15 +241,14 @@
Element propertyElement = metadata.getElement();
propertyStreamer.stream(propertyElement);
}
-
+
this.contentHandler.endElement(DASL_QUERY_NS,
RESOURCE_NODE_NAME,
PREFIX + ":" + RESOURCE_NODE_NAME);
}
- this.contentHandler.endElement(
- DASL_QUERY_NS,
- RESULT_ROOT_TAG,
- PREFIX + ":" + RESULT_ROOT_TAG);
+ this.contentHandler.endElement(DASL_QUERY_NS,
+ RESULT_ROOT_TAG,
+ PREFIX + ":" + RESULT_ROOT_TAG);
} catch (SAXException e) {
throw new SAXException("Unable to fetch the query data:", e);
} catch (HttpException e1) {
@@ -260,8 +260,7 @@
throw new SAXException("Unable to fetch the query data:", e);
} catch (Exception e) {
throw new SAXException("Generic Error:", e);
- }
+ }
}
}
-
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/Constants.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/Constants.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/Constants.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/Constants.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,13 +15,15 @@
*/
package org.apache.cocoon.woody;
+import org.apache.cocoon.xml.XMLUtils;
+
import org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl;
/**
* Various constants used in the Woody form framework.
- *
- * @version $Id: Constants.java,v 1.8 2004/03/09 13:54:25 reinhard Exp $
+ *
+ * @version $Id$
*/
public final class Constants {
// TODO : see this later
@@ -34,7 +36,7 @@
// return "Invalid value";
// }
// };
-
+
/** Namespace for Woody Template elements */
public static final String WT_NS = "http://apache.org/cocoon/woody/template/1.0";
public static final String WT_PREFIX = "wt";
@@ -53,5 +55,5 @@
/** I18n catalogue containing the built-in Woody messages. */
public static final String I18N_CATALOGUE = "woody";
- public static final Attributes EMPTY_ATTRS = new AttributesImpl();
+ public static final Attributes EMPTY_ATTRS = XMLUtils.EMPTY_ATTRIBUTES;
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/CocoonMarkupLanguage.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/CocoonMarkupLanguage.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/CocoonMarkupLanguage.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/CocoonMarkupLanguage.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,13 +19,14 @@
import org.apache.avalon.framework.logger.Logger;
import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.components.language.programming.ProgrammingLanguage;
import org.apache.cocoon.xml.AbstractXMLPipe;
import org.apache.cocoon.xml.XMLConsumer;
-import org.apache.cocoon.components.language.programming.ProgrammingLanguage;
+import org.apache.cocoon.xml.XMLUtils;
import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.helpers.AttributesImpl;
@@ -47,7 +48,7 @@
* @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
* @author <a href="mailto:ovidiu@cup.hp.com">Ovidiu Predescu</a>
* @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
- * @version CVS $Id: CocoonMarkupLanguage.java,v 1.3 2004/05/01 00:05:44 joerg Exp $
+ * @version CVS $Id$
*/
public abstract class CocoonMarkupLanguage extends AbstractMarkupLanguage
{
@@ -432,7 +433,7 @@
Iterator iter = CocoonMarkupLanguage.this.dependencies.iterator();
while(iter.hasNext()) {
super.startElement(
- (String)rootElement[0], "dependency", localPrefix + ":dependency", new AttributesImpl()
+ (String) rootElement[0], "dependency", localPrefix + ":dependency", XMLUtils.EMPTY_ATTRIBUTES
);
locationChars = ((String) iter.next()).toCharArray();
super.characters(locationChars, 0 , locationChars.length);
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/XSPMarkupLanguage.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/XSPMarkupLanguage.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/XSPMarkupLanguage.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/XSPMarkupLanguage.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,10 +18,10 @@
import org.apache.cocoon.components.language.markup.CocoonMarkupLanguage;
import org.apache.cocoon.components.language.programming.ProgrammingLanguage;
import org.apache.cocoon.xml.AbstractXMLPipe;
+import org.apache.cocoon.xml.XMLUtils;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
import java.util.Stack;
@@ -32,7 +32,7 @@
* @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
* @author <a href="mailto:ssahuc@apache.org">Sebastien Sahuc</a>
* @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
- * @version CVS $Id: XSPMarkupLanguage.java,v 1.1 2004/03/10 12:58:05 stephan Exp $
+ * @version $Id$
*/
public class XSPMarkupLanguage extends CocoonMarkupLanguage {
@@ -117,7 +117,7 @@
String value = String.valueOf(ch, start, length);
// Create a new element <xsp:text> that wrap the quoted PCDATA
super.startElement(XSPMarkupLanguage.this.getURI(), "text",
- localPrefix + ":text", new AttributesImpl());
+ localPrefix + ":text", XMLUtils.EMPTY_ATTRIBUTES);
super.characters(value.toCharArray(), 0, value.length());
super.endElement(XSPMarkupLanguage.this.getURI(), "text",
localPrefix + ":text");
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/XSPObjectHelper.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/XSPObjectHelper.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/XSPObjectHelper.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/XSPObjectHelper.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,6 +19,8 @@
import java.util.Iterator;
import org.apache.cocoon.xml.dom.DOMStreamer;
+import org.apache.cocoon.xml.XMLUtils;
+
import org.apache.excalibur.xml.sax.XMLizable;
import org.w3c.dom.Node;
import org.xml.sax.ContentHandler;
@@ -31,13 +33,9 @@
* @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
* @author <a href="mailto:sylvain.wallez@anyware-tech.com">Sylvain Wallez</a>
* (Cocoon1 <code>xspExpr()</code> methods port)
- * @version CVS $Id: XSPObjectHelper.java,v 1.1 2004/03/10 12:58:05 stephan Exp $
+ * @version $Id$
*/
public class XSPObjectHelper {
- /**
- * Empty attributes used for contentHandler.startElement()
- */
- protected static final AttributesImpl emptyAttr = new AttributesImpl();
/**
* Output an element containing text only and no attributes
@@ -46,13 +44,12 @@
* @param name The element name
* @param data The data contained by the element
*/
- protected static void elementData(
- String uri,
- String prefix,
- ContentHandler contentHandler,
- String name,
- String data)
- throws SAXException {
+ protected static void elementData(String uri,
+ String prefix,
+ ContentHandler contentHandler,
+ String name,
+ String data)
+ throws SAXException {
start(uri, prefix, contentHandler, name);
data(contentHandler, data);
end(uri, prefix, contentHandler, name);
@@ -66,14 +63,13 @@
* @param data The data contained by the element
* @param attr The element attributes
*/
- protected static void elementData(
- String uri,
- String prefix,
- ContentHandler contentHandler,
- String name,
- String data,
- AttributesImpl attr)
- throws SAXException {
+ protected static void elementData(String uri,
+ String prefix,
+ ContentHandler contentHandler,
+ String name,
+ String data,
+ AttributesImpl attr)
+ throws SAXException {
start(uri, prefix, contentHandler, name, attr);
data(contentHandler, data);
end(uri, prefix, contentHandler, name);
@@ -86,17 +82,12 @@
* @param contentHandler The SAX content handler
* @param name The element name
*/
- protected static void start(
- String uri,
- String prefix,
- ContentHandler contentHandler,
- String name)
- throws SAXException {
- contentHandler.startElement(
- uri,
- name,
- new StringBuffer(prefix).append(":").append(name).toString(),
- emptyAttr);
+ protected static void start(String uri,
+ String prefix,
+ ContentHandler contentHandler,
+ String name)
+ throws SAXException {
+ contentHandler.startElement(uri, name, prefix + ":" + name, XMLUtils.EMPTY_ATTRIBUTES);
}
/**
@@ -107,18 +98,13 @@
* @param name The element name
* @param attr The element attributes
*/
- protected static void start(
- String uri,
- String prefix,
- ContentHandler contentHandler,
- String name,
- AttributesImpl attr)
- throws SAXException {
- contentHandler.startElement(
- uri,
- name,
- new StringBuffer(prefix).append(":").append(name).toString(),
- attr);
+ protected static void start(String uri,
+ String prefix,
+ ContentHandler contentHandler,
+ String name,
+ AttributesImpl attr)
+ throws SAXException {
+ contentHandler.startElement(uri, name, prefix + ":" + name, attr);
}
/**
@@ -127,16 +113,12 @@
* @param contentHandler The SAX content handler
* @param name The element name
*/
- protected static void end(
- String uri,
- String prefix,
- ContentHandler contentHandler,
- String name)
- throws SAXException {
- contentHandler.endElement(
- uri,
- name,
- new StringBuffer(prefix).append(":").append(name).toString());
+ protected static void end(String uri,
+ String prefix,
+ ContentHandler contentHandler,
+ String name)
+ throws SAXException {
+ contentHandler.endElement(uri, name, prefix + ":" + name);
}
/**
@@ -146,11 +128,10 @@
* @param name The attribute name
* @param value The attribute value
*/
- protected static void addAttribute(
- AttributesImpl attr,
- String name,
- String value)
- throws SAXException {
+ protected static void addAttribute(AttributesImpl attr,
+ String name,
+ String value)
+ throws SAXException {
attr.addAttribute("", name, name, "CDATA", value);
}
@@ -161,7 +142,7 @@
* @param data The string data
*/
protected static void data(ContentHandler contentHandler, String data)
- throws SAXException {
+ throws SAXException {
contentHandler.characters(data.toCharArray(), 0, data.length());
}
@@ -175,7 +156,7 @@
* @param v the value
*/
public static void xspExpr(ContentHandler contentHandler, char v)
- throws SAXException {
+ throws SAXException {
data(contentHandler, String.valueOf(v));
}
@@ -187,7 +168,7 @@
* @param v the value
*/
public static void xspExpr(ContentHandler contentHandler, byte v)
- throws SAXException {
+ throws SAXException {
data(contentHandler, String.valueOf(v));
}
@@ -199,7 +180,7 @@
* @param v the value
*/
public static void xspExpr(ContentHandler contentHandler, boolean v)
- throws SAXException {
+ throws SAXException {
data(contentHandler, String.valueOf(v));
}
@@ -211,7 +192,7 @@
* @param v the value
*/
public static void xspExpr(ContentHandler contentHandler, int v)
- throws SAXException {
+ throws SAXException {
data(contentHandler, String.valueOf(v));
}
@@ -223,7 +204,7 @@
* @param v the value
*/
public static void xspExpr(ContentHandler contentHandler, long v)
- throws SAXException {
+ throws SAXException {
data(contentHandler, String.valueOf(v));
}
@@ -235,7 +216,7 @@
* @param v the value
*/
public static void xspExpr(ContentHandler contentHandler, float v)
- throws SAXException {
+ throws SAXException {
data(contentHandler, String.valueOf(v));
}
@@ -247,7 +228,7 @@
* @param v the value
*/
public static void xspExpr(ContentHandler contentHandler, double v)
- throws SAXException {
+ throws SAXException {
data(contentHandler, String.valueOf(v));
}
@@ -259,7 +240,7 @@
* @param text the value
*/
public static void xspExpr(ContentHandler contentHandler, String text)
- throws SAXException {
+ throws SAXException {
if (text != null) {
data(contentHandler, text);
}
@@ -289,7 +270,7 @@
* @param v the XML fragment
*/
public static void xspExpr(ContentHandler contentHandler, XMLizable v)
- throws SAXException {
+ throws SAXException {
if (v != null) {
v.toSAX(contentHandler);
}
@@ -303,7 +284,7 @@
* @param v the value
*/
public static void xspExpr(ContentHandler contentHandler, Node v)
- throws SAXException {
+ throws SAXException {
if (v != null) {
DOMStreamer streamer = new DOMStreamer(contentHandler);
streamer.stream(v);
@@ -319,7 +300,7 @@
* @param v the XML fragment
*/
public static void xspExpr(ContentHandler contentHandler, Collection v)
- throws SAXException {
+ throws SAXException {
if (v != null) {
Iterator iterator = v.iterator();
while (iterator.hasNext()) {
@@ -340,7 +321,7 @@
* @param v the value
*/
public static void xspExpr(ContentHandler contentHandler, Object v)
- throws SAXException {
+ throws SAXException {
if (v == null) {
return;
}
Modified: cocoon/branches/BRANCH_2_1_X/src/deprecated/java/org/apache/cocoon/transformation/CachingCIncludeTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/deprecated/java/org/apache/cocoon/transformation/CachingCIncludeTransformer.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/deprecated/java/org/apache/cocoon/transformation/CachingCIncludeTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/deprecated/java/org/apache/cocoon/transformation/CachingCIncludeTransformer.java Tue Apr 26 09:07:03 2005
@@ -19,7 +19,6 @@
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.excalibur.source.Source;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.caching.CacheValidity;
@@ -28,10 +27,11 @@
import org.apache.cocoon.components.source.SourceUtil;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.xml.IncludeXMLConsumer;
+import org.apache.cocoon.xml.XMLUtils;
+import org.apache.excalibur.source.Source;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
import java.io.IOException;
import java.util.Map;
@@ -54,13 +54,13 @@
* of new validity will be the same as of old one. Only timestamps have to be
* recalculated and compared.</p>
*
- * @see IncludeTransformer
+ * @see IncludeTransformer (scratchpad)
* @author <a href="mailto:maciejka@tiger.com.pl">Maciek Kaminski</a>
* @deprecated This transformer violates the avalon/cocoon design principles. Use IncludeTransformer.
- * @version CVS $Id$
+ * @version $Id$
*/
public class CachingCIncludeTransformer extends AbstractTransformer
-implements Composable, Cacheable {
+ implements Composable, Cacheable {
public static final String CINCLUDE_NAMESPACE_URI = "http://apache.org/cocoon/include/1.0";
public static final String CINCLUDE_INCLUDE_ELEMENT = "include";
@@ -170,14 +170,13 @@
}
if (!"".equals(element)) {
- AttributesImpl attrs = new AttributesImpl();
if (!ns.equals("")) {
super.startPrefixMapping(prefix, ns);
}
super.startElement(ns,
element,
(!ns.equals("") && !prefix.equals("") ? prefix+":"+element : element),
- attrs);
+ XMLUtils.EMPTY_ATTRIBUTES);
}
Source source = null;
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/notification/Notifier.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/notification/Notifier.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/notification/Notifier.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/notification/Notifier.java Tue Apr 26 09:07:03 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
package org.apache.cocoon.components.notification;
import org.apache.cocoon.Constants;
+import org.apache.cocoon.xml.XMLUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.xml.sax.ContentHandler;
@@ -32,7 +33,7 @@
*
* @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Id$
+ * @version $Id$
*/
public class Notifier {
@@ -132,15 +133,14 @@
}
ch.endElement(URI, "message", PREFIX + ":message");
- ch.startElement(URI, "description", PREFIX + ":description",
- new AttributesImpl());
+ ch.startElement(URI, "description", PREFIX + ":description", XMLUtils.EMPTY_ATTRIBUTES);
ch.characters(n.getDescription().toCharArray(), 0, n.getDescription().length());
ch.endElement(URI, "description", PREFIX + ":description");
Map extraDescriptions = n.getExtraDescriptions();
for (Iterator i = extraDescriptions.entrySet().iterator(); i.hasNext(); ) {
- Map.Entry me = (Map.Entry)i.next();
- String key = (String)me.getKey();
+ final Map.Entry me = (Map.Entry) i.next();
+ String key = (String) me.getKey();
String value = String.valueOf(me.getValue());
atts = new AttributesImpl();
atts.addAttribute(URI, "description", PREFIX + ":description", "CDATA", key);
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/LinkStatusGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/LinkStatusGenerator.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/LinkStatusGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/LinkStatusGenerator.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,9 +55,11 @@
* @author Michael Homeijer
* @author Nicola Ken Barozzi (nicolaken@apache.org)
* @author Bernhard Huber (huber@apache.org)
- * @version CVS $Id$
+ * @version $Id$
*/
-public class LinkStatusGenerator extends ServiceableGenerator implements Recyclable, Configurable {
+public class LinkStatusGenerator extends ServiceableGenerator
+ implements Recyclable, Configurable {
+
/** The URI of the namespace of this generator. */
protected static final String URI =
"http://apache.org/cocoon/linkstatus/2.0";
@@ -75,7 +77,7 @@
protected static final String STATUS_ATTR_NAME = "status";
protected static final String MESSAGE_ATTR_NAME = "message";
- protected AttributesImpl attributes = new AttributesImpl();
+ protected AttributesImpl attributes;
/**
* Config element name specifying expected link content-typ.
@@ -312,7 +314,7 @@
}
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
- throws ProcessingException, SAXException, IOException {
+ throws ProcessingException, SAXException, IOException {
super.setup(resolver, objectModel, src, par);
@@ -333,7 +335,7 @@
* if the requsted URI wasn't found
*/
public void generate()
- throws SAXException, ProcessingException {
+ throws SAXException, ProcessingException {
try {
crawled = new HashSet();
@@ -656,6 +658,5 @@
super.recycle();
this.attributes = null;
- //this.excludeCrawlingURL = null;
}
}