You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2016/05/06 18:30:34 UTC
svn commit: r1742585 - in
/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer:
SerializerBase.java SerializerTrace.java SerializerTraceWriter.java
ToStream.java ToXMLStream.java
Author: veithen
Date: Fri May 6 18:30:33 2016
New Revision: 1742585
URL: http://svn.apache.org/viewvc?rev=1742585&view=rev
Log:
Remove the SerializerTrace support.
Removed:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerTrace.java
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerTraceWriter.java
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToXMLStream.java
Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java?rev=1742585&r1=1742584&r2=1742585&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java Fri May 6 18:30:33 2016
@@ -89,36 +89,6 @@ public abstract class SerializerBase
/**
- * To fire off the end element trace event
- * @param name Name of element
- */
- protected void fireEndElem(String name)
- throws org.xml.sax.SAXException
- {
- if (m_tracer != null)
- {
- flushMyWriter();
- m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENDELEMENT,name, (Attributes)null);
- }
- }
-
- /**
- * Report the characters trace event
- * @param chars content of characters
- * @param start starting index of characters to output
- * @param length number of characters to output
- */
- protected void fireCharEvent(char[] chars, int start, int length)
- throws org.xml.sax.SAXException
- {
- if (m_tracer != null)
- {
- flushMyWriter();
- m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_CHARACTERS, chars, start,length);
- }
- }
-
- /**
* true if we still need to call startDocumentInternal()
*/
protected boolean m_needToCallStartDocument = true;
@@ -206,12 +176,6 @@ public abstract class SerializerBase
*/
protected NamespaceMappings m_prefixMap;
- /**
- * Handle for firing generate events. This interface may be implemented
- * by the referenced transformer object.
- */
- protected SerializerTrace m_tracer;
-
protected SourceLocator m_sourceLocator;
@@ -527,9 +491,6 @@ public abstract class SerializerBase
if (name.equals("[dtd]"))
m_inExternalDTD = false;
m_inEntityRef = false;
-
- if (m_tracer != null)
- this.fireEndEntity(name);
}
/**
@@ -890,9 +851,6 @@ public abstract class SerializerBase
startEntity(name);
endEntity(name);
-
- if (m_tracer != null)
- fireEntityReference(name);
}
/**
@@ -903,16 +861,6 @@ public abstract class SerializerBase
public void setTransformer(Transformer t)
{
m_transformer = t;
-
- // If this transformer object implements the SerializerTrace interface
- // then assign m_tracer to the transformer object so it can be used
- // to fire trace events.
- if ((m_transformer instanceof SerializerTrace) &&
- (((SerializerTrace) m_transformer).hasTraceListeners())) {
- m_tracer = (SerializerTrace) m_transformer;
- } else {
- m_tracer = null;
- }
}
/**
* Gets the transformer associated with this serializer
@@ -971,20 +919,6 @@ public abstract class SerializerBase
}
/**
- * To fire off start entity trace event
- * @param name Name of entity
- */
- protected void fireStartEntity(String name)
- throws org.xml.sax.SAXException
- {
- if (m_tracer != null)
- {
- flushMyWriter();
- m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENTITYREF, name);
- }
- }
-
- /**
* Report the characters event
* @param chars content of characters
* @param start starting index of characters to output
@@ -1021,138 +955,6 @@ public abstract class SerializerBase
}
}
}
- /**
- * Report the CDATA trace event
- * @param chars content of CDATA
- * @param start starting index of characters to output
- * @param length number of characters to output
- */
- protected void fireCDATAEvent(char[] chars, int start, int length)
- throws org.xml.sax.SAXException
- {
- if (m_tracer != null)
- {
- flushMyWriter();
- m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_CDATA, chars, start,length);
- }
- }
-
- /**
- * Report the comment trace event
- * @param chars content of comment
- * @param start starting index of comment to output
- * @param length number of characters to output
- */
- protected void fireCommentEvent(char[] chars, int start, int length)
- throws org.xml.sax.SAXException
- {
- if (m_tracer != null)
- {
- flushMyWriter();
- m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_COMMENT, new String(chars, start, length));
- }
- }
-
-
- /**
- * To fire off end entity trace event
- * @param name Name of entity
- */
- public void fireEndEntity(String name)
- throws org.xml.sax.SAXException
- {
- if (m_tracer != null)
- flushMyWriter();
- // we do not need to handle this.
- }
-
- /**
- * To fire off start document trace event
- */
- protected void fireStartDoc()
- throws org.xml.sax.SAXException
- {
- if (m_tracer != null)
- {
- flushMyWriter();
- m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_STARTDOCUMENT);
- }
- }
-
-
- /**
- * To fire off end document trace event
- */
- protected void fireEndDoc()
- throws org.xml.sax.SAXException
- {
- if (m_tracer != null)
- {
- flushMyWriter();
- m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENDDOCUMENT);
- }
- }
-
- /**
- * Report the start element trace event. This trace method needs to be
- * called just before the attributes are cleared.
- *
- * @param elemName the qualified name of the element
- *
- */
- protected void fireStartElem(String elemName)
- throws org.xml.sax.SAXException
- {
- if (m_tracer != null)
- {
- flushMyWriter();
- m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_STARTELEMENT,
- elemName, m_attributes);
- }
- }
-
-
- /**
- * To fire off the end element event
- * @param name Name of element
- */
-// protected void fireEndElem(String name)
-// throws org.xml.sax.SAXException
-// {
-// if (m_tracer != null)
-// m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENDELEMENT,name, (Attributes)null);
-// }
-
-
- /**
- * To fire off the PI trace event
- * @param name Name of PI
- */
- protected void fireEscapingEvent(String name, String data)
- throws org.xml.sax.SAXException
- {
-
- if (m_tracer != null)
- {
- flushMyWriter();
- m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_PI,name, data);
- }
- }
-
-
- /**
- * To fire off the entity reference trace event
- * @param name Name of entity reference
- */
- protected void fireEntityReference(String name)
- throws org.xml.sax.SAXException
- {
- if (m_tracer != null)
- {
- flushMyWriter();
- m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENTITYREF,name, (Attributes)null);
- }
- }
/**
* Receive notification of the beginning of a document.
@@ -1195,8 +997,6 @@ public abstract class SerializerBase
*/
protected void startDocumentInternal() throws org.xml.sax.SAXException
{
- if (m_tracer != null)
- this.fireStartDoc();
}
/**
* This method is used to set the source locator, which might be used to
@@ -1258,7 +1058,6 @@ public abstract class SerializerBase
this.m_standalone = null;
this.m_standaloneWasSpecified = false;
this.m_StringOfCDATASections = null;
- this.m_tracer = null;
this.m_transformer = null;
this.m_version = null;
// don't set writer to null, so that it might be re-used
Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java?rev=1742585&r1=1742584&r2=1742585&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java Fri May 6 18:30:33 2016
@@ -40,8 +40,6 @@ import javax.xml.transform.TransformerEx
import org.apache.axiom.core.stream.serializer.utils.MsgKey;
import org.apache.axiom.core.stream.serializer.utils.Utils;
-import org.apache.axiom.core.stream.serializer.utils.WrappedRuntimeException;
-import org.w3c.dom.Node;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
@@ -633,21 +631,6 @@ abstract public class ToStream extends S
m_writer_set_by_user = setByUser;
m_writer = writer;
- // if we are tracing events we need to trace what
- // characters are written to the output writer.
- if (m_tracer != null) {
- boolean noTracerYet = true;
- Writer w2 = m_writer;
- while (w2 instanceof WriterChain) {
- if (w2 instanceof SerializerTraceWriter) {
- noTracerYet = false;
- break;
- }
- w2 = ((WriterChain)w2).getWriter();
- }
- if (noTracerYet)
- m_writer = new SerializerTraceWriter(m_writer, m_tracer);
- }
}
/**
@@ -1281,10 +1264,6 @@ abstract public class ToStream extends S
if (ch[start + length - 1] == ']')
closeCDATA();
}
-
- // time to fire off CDATA event
- if (m_tracer != null)
- super.fireCDATAEvent(ch, old_start, length);
}
catch (IOException ioe)
{
@@ -1407,11 +1386,6 @@ abstract public class ToStream extends S
if (m_disableOutputEscapingStates.peekOrFalse() || (!m_escaping))
{
charactersRaw(chars, start, length);
-
- // time to fire off characters generation event
- if (m_tracer != null)
- super.fireCharEvent(chars, start, length);
-
return;
}
@@ -1607,10 +1581,6 @@ abstract public class ToStream extends S
{
throw new SAXException(e);
}
-
- // time to fire off characters generation event
- if (m_tracer != null)
- super.fireCharEvent(chars, start, length);
}
private int processLineFeed(final char[] chars, int i, int lastProcessed, final Writer writer) throws IOException {
@@ -1931,9 +1901,6 @@ abstract public class ToStream extends S
m_elemContext = m_elemContext.push(namespaceURI,localName,name);
m_isprevtext = false;
-
- if (m_tracer != null)
- firePseudoAttributes();
}
/**
@@ -2192,8 +2159,6 @@ abstract public class ToStream extends S
final java.io.Writer writer = m_writer;
if (m_elemContext.m_startTagOpen)
{
- if (m_tracer != null)
- super.fireStartElem(m_elemContext.m_elementName);
int nAttrs = m_attributes.getLength();
if (nAttrs > 0)
{
@@ -2235,10 +2200,6 @@ abstract public class ToStream extends S
}
m_isprevtext = false;
-
- // fire off the end element event
- if (m_tracer != null)
- super.fireEndElem(name);
m_elemContext = m_elemContext.m_prev;
}
@@ -2434,9 +2395,6 @@ abstract public class ToStream extends S
* the indentation at the start of the next line.
*/
m_startNewLine = true;
- // time to generate comment event
- if (m_tracer != null)
- super.fireCommentEvent(ch, start_old,length);
}
/**
@@ -2591,8 +2549,6 @@ abstract public class ToStream extends S
try
{
- if (m_tracer != null)
- super.fireStartElem(m_elemContext.m_elementName);
int nAttrs = m_attributes.getLength();
if (nAttrs > 0)
{
@@ -3000,23 +2956,12 @@ abstract public class ToStream extends S
if (index >= 0)
{
- String old_value = null;
- if (m_tracer != null)
- {
- old_value = m_attributes.getValue(index);
- if (value.equals(old_value))
- old_value = null;
- }
-
/* We've seen the attribute before.
* We may have a null uri or localName, but all we really
* want to re-set is the value anyway.
*/
m_attributes.setValue(index, value);
was_added = false;
- if (old_value != null)
- firePseudoAttributes();
-
}
else
{
@@ -3099,65 +3044,11 @@ abstract public class ToStream extends S
}
m_attributes.addAttribute(uri, localName, rawName, type, value);
was_added = true;
- if (m_tracer != null)
- firePseudoAttributes();
}
return was_added;
}
/**
- * To fire off the pseudo characters of attributes, as they currently
- * exist. This method should be called everytime an attribute is added,
- * or when an attribute value is changed, or an element is created.
- */
-
- protected void firePseudoAttributes()
- {
- if (m_tracer != null)
- {
- try
- {
- // flush out the "<elemName" if not already flushed
- m_writer.flush();
-
- // make a StringBuffer to write the name="value" pairs to.
- StringBuffer sb = new StringBuffer();
- int nAttrs = m_attributes.getLength();
- if (nAttrs > 0)
- {
- // make a writer that internally appends to the same
- // StringBuffer
- java.io.Writer writer =
- new ToStream.WritertoStringBuffer(sb);
-
- processAttributes(writer, nAttrs);
- // Don't clear the attributes!
- // We only want to see what would be written out
- // at this point, we don't want to loose them.
- }
- sb.append('>'); // the potential > after the attributes.
- // convert the StringBuffer to a char array and
- // emit the trace event that these characters "might"
- // be written
- char ch[] = sb.toString().toCharArray();
- m_tracer.fireGenerateEvent(
- SerializerTrace.EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS,
- ch,
- 0,
- ch.length);
- }
- catch (IOException ioe)
- {
- // ignore ?
- }
- catch (SAXException se)
- {
- // ignore ?
- }
- }
- }
-
- /**
* This inner class is used only to collect attribute values
* written by the method writeAttrString() into a string buffer.
* In this manner trace events, and the real writing of attributes will use
@@ -3203,17 +3094,6 @@ abstract public class ToStream extends S
}
/**
- * @see SerializationHandler#setTransformer(Transformer)
- */
- public void setTransformer(Transformer transformer) {
- super.setTransformer(transformer);
- if (m_tracer != null
- && !(m_writer instanceof SerializerTraceWriter) )
- setWriterInternal(new SerializerTraceWriter(m_writer, m_tracer), false);
-
-
- }
- /**
* Try's to reset the super class and reset this class for
* re-use, so that you don't need to create a new serializer
* (mostly for performance reasons).
Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToXMLStream.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToXMLStream.java?rev=1742585&r1=1742584&r2=1742585&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToXMLStream.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToXMLStream.java Fri May 6 18:30:33 2016
@@ -197,9 +197,6 @@ public class ToXMLStream extends ToStrea
}
flushWriter();
-
- if (m_tracer != null)
- super.fireEndDoc();
}
/**
@@ -329,9 +326,6 @@ public class ToXMLStream extends ToStrea
throw new SAXException(e);
}
}
-
- if (m_tracer != null)
- super.fireEscapingEvent(target, data);
}
/**
@@ -363,9 +357,6 @@ public class ToXMLStream extends ToStrea
{
throw new SAXException(e);
}
-
- if (m_tracer != null)
- super.fireEntityReference(name);
}
/**