de.smartics.maven.issues.cache
Class XmlTaskWriter

Package class diagram package XmlTaskWriter
java.lang.Object
  extended by de.smartics.maven.issues.cache.XmlTaskWriter
All Implemented Interfaces:
TaskWriter, Closeable

public class XmlTaskWriter
     
     
extends Object
implements TaskWriter, Closeable

Writes a single task to a stream.

Author:
Robert Reiner

Field Summary
protected  javax.xml.stream.XMLStreamWriter xmlWriter
          The writer to write the single tasks to.
 
Constructor Summary
XmlTaskWriter(javax.xml.stream.XMLStreamWriter xmlWriter)
          Default constructor.
 
Method Summary
 void close()
          Closes this stream and releases any system resources associated with it.
 void writeAttribute(org.eclipse.mylyn.tasks.core.data.TaskAttribute attribute)
          Writes the attribute.
 void writeAttributes(Map<String,org.eclipse.mylyn.tasks.core.data.TaskAttribute> attributes)
          Writes the set of attributes.
 void writeAttributeValues(org.eclipse.mylyn.tasks.core.data.TaskAttribute attribute)
          Writes the attribute values.
 void writeMap(String gi, Map<String,String> map)
          Writes the key and values of the map.
 void writeSimpleElement(String gi, String content)
          Writes a simple element containing no attributes and only text content.
 void writeTask(org.eclipse.mylyn.tasks.core.data.TaskData task)
          Writes the given task to the stream referenced by this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xmlWriter

protected final javax.xml.stream.XMLStreamWriter xmlWriter
The writer to write the single tasks to.

Constructor Detail

XmlTaskWriter

public XmlTaskWriter(javax.xml.stream.XMLStreamWriter xmlWriter)
              throws NullPointerException
Default constructor.

Parameters:
xmlWriter - the writer to write the single tasks to.
Throws:
NullPointerException - if the xmlWriter is null.
Method Detail

writeTask

public void writeTask(org.eclipse.mylyn.tasks.core.data.TaskData task)
               throws javax.xml.stream.XMLStreamException
Writes the given task to the stream referenced by this instance.

Specified by:
writeTask in interface TaskWriter
Parameters:
task - the task to write.
See Also:
TaskWriter.writeTask(org.eclipse.mylyn.tasks.core.data.TaskData)
Throws:
javax.xml.stream.XMLStreamException

writeAttribute

public void writeAttribute(org.eclipse.mylyn.tasks.core.data.TaskAttribute attribute)
                    throws javax.xml.stream.XMLStreamException
Writes the attribute.

Specified by:
writeAttribute in interface TaskWriter
Parameters:
attribute - the attribute to write.
See Also:
TaskWriter.writeAttribute(org.eclipse.mylyn.tasks.core.data.TaskAttribute)
Throws:
javax.xml.stream.XMLStreamException

writeAttributes

public void writeAttributes(Map<String,org.eclipse.mylyn.tasks.core.data.TaskAttribute> attributes)
                     throws javax.xml.stream.XMLStreamException
Writes the set of attributes.

Specified by:
writeAttributes in interface TaskWriter
Parameters:
attributes - the attributes to write.
See Also:
TaskWriter.writeAttributes(java.util.Map)
Throws:
javax.xml.stream.XMLStreamException

writeAttributeValues

public void writeAttributeValues(org.eclipse.mylyn.tasks.core.data.TaskAttribute attribute)
                          throws javax.xml.stream.XMLStreamException
Writes the attribute values.

Specified by:
writeAttributeValues in interface TaskWriter
Parameters:
attribute - whose values are to be written.
See Also:
TaskWriter.writeAttributeValues(org.eclipse.mylyn.tasks.core.data.TaskAttribute)
Throws:
javax.xml.stream.XMLStreamException

writeMap

public void writeMap(String gi,
                     Map<String,String> map)
              throws javax.xml.stream.XMLStreamException
Writes the key and values of the map. The key is the generic identifier (GI), the value the content of the XML element.

Specified by:
writeMap in interface TaskWriter
Parameters:
gi - the generic identifier of the element within the key-value pairs are written.
map - the information to be written inside the element specified by gi.
See Also:
TaskWriter.writeMap(java.lang.String, java.util.Map)
Throws:
javax.xml.stream.XMLStreamException

writeSimpleElement

public void writeSimpleElement(String gi,
                               String content)
                        throws javax.xml.stream.XMLStreamException
Writes a simple element containing no attributes and only text content.

Specified by:
writeSimpleElement in interface TaskWriter
Parameters:
gi - the generic identifier of the XML element to be written.
content - the content of the XML element to be written.
See Also:
TaskWriter.writeSimpleElement(java.lang.String, java.lang.String)
Throws:
javax.xml.stream.XMLStreamException

close

public void close()
Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

The stream is closed quietly, logging any failure at error level.

Specified by:
close in interface Closeable
See Also:
Closeable.close()


Copyright © 2008-2010 Kronseder & Reiner GmbH - smartics. All Rights Reserved.