Milyn-Smooks Version 0.4

org.milyn.delivery.serialize
Class DefaultSerializationUnit

java.lang.Object
  extended byorg.milyn.delivery.serialize.AbstractSerializationUnit
      extended byorg.milyn.delivery.serialize.DefaultSerializationUnit
All Implemented Interfaces:
ContentDeliveryUnit, SerializationUnit

public class DefaultSerializationUnit
extends AbstractSerializationUnit

Default SerializationUnit implementation.

Default SerialisationUnit where none defined.

Also, takes a CDRDef parameter:

Author:
tfennelly

Constructor Summary
DefaultSerializationUnit(CDRDef unitDef)
          Public constructor.
 
Method Summary
 java.lang.String getDetailDescription()
          Get a detail (more verbose) description of the Content Delivery Unit and what it does.
 java.lang.String getShortDescription()
          Get a short description of the Content Delivery Unit and what it does.
protected  void writeAttributes(org.w3c.dom.NamedNodeMap attributes, java.io.Writer writer)
          Write the element attributes.
 boolean writeChildElements()
          Write the child elements of the element this SerializationUnit is being applied to.
 void writeElementCDATA(org.w3c.dom.CDATASection cdata, java.io.Writer writer, ContainerRequest containerRequest)
          Write element CDATA section.
 void writeElementComment(org.w3c.dom.Comment comment, java.io.Writer writer, ContainerRequest containerRequest)
          Write element comment.
 void writeElementEnd(org.w3c.dom.Element element, java.io.Writer writer, ContainerRequest containerRequest)
          Write the element end portion; close the element.
 void writeElementEntityRef(org.w3c.dom.EntityReference entityRef, java.io.Writer writer, ContainerRequest containerRequest)
          Write element entity reference object.
 void writeElementNode(org.w3c.dom.Node node, java.io.Writer writer, ContainerRequest containerRequest)
          Write element Node object.
 void writeElementStart(org.w3c.dom.Element element, java.io.Writer writer, ContainerRequest containerRequest)
          Write the element start portion; the element name and it's attributes.
 void writeElementText(org.w3c.dom.Text text, java.io.Writer writer, ContainerRequest containerRequest)
          Write element text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSerializationUnit

public DefaultSerializationUnit(CDRDef unitDef)
Public constructor.

Parameters:
unitDef -
Method Detail

writeElementStart

public void writeElementStart(org.w3c.dom.Element element,
                              java.io.Writer writer,
                              ContainerRequest containerRequest)
                       throws java.io.IOException
Description copied from interface: SerializationUnit
Write the element start portion; the element name and it's attributes.

EG: <a href="http://www.x.com">

Parameters:
element - The element start to write.
writer - The writer to be written to.
containerRequest - ContainerRequest instance for the delivery context.
Throws:
java.io.IOException - Exception writing output.

writeAttributes

protected void writeAttributes(org.w3c.dom.NamedNodeMap attributes,
                               java.io.Writer writer)
                        throws java.io.IOException
Write the element attributes.

Parameters:
attributes - The element attibutes.
writer - The writer to be written to.
Throws:
java.io.IOException - Exception writing output.

writeElementEnd

public void writeElementEnd(org.w3c.dom.Element element,
                            java.io.Writer writer,
                            ContainerRequest containerRequest)
                     throws java.io.IOException
Description copied from interface: SerializationUnit
Write the element end portion; close the element.

EG: </a>

Parameters:
element - The element end to write.
writer - The writer to be written to.
containerRequest - ContainerRequest instance for the delivery context.
Throws:
java.io.IOException - Exception writing output.

writeElementText

public void writeElementText(org.w3c.dom.Text text,
                             java.io.Writer writer,
                             ContainerRequest containerRequest)
                      throws java.io.IOException
Description copied from interface: SerializationUnit
Write element text.

Parameters:
text - The Text object to write.
writer - The writer to be written to.
containerRequest - ContainerRequest instance for the delivery context.
Throws:
java.io.IOException - Exception writing output.

writeElementComment

public void writeElementComment(org.w3c.dom.Comment comment,
                                java.io.Writer writer,
                                ContainerRequest containerRequest)
                         throws java.io.IOException
Description copied from interface: SerializationUnit
Write element comment.

Parameters:
comment - The comment o write.
writer - The writer to be written to.
containerRequest - ContainerRequest instance for the delivery context.
Throws:
java.io.IOException - Exception writing output.

writeElementEntityRef

public void writeElementEntityRef(org.w3c.dom.EntityReference entityRef,
                                  java.io.Writer writer,
                                  ContainerRequest containerRequest)
                           throws java.io.IOException
Description copied from interface: SerializationUnit
Write element entity reference object.

Parameters:
entityRef - The entity reference to write.
writer - The writer to be written to.
containerRequest - ContainerRequest instance for the delivery context.
Throws:
java.io.IOException - Exception writing output.

writeElementCDATA

public void writeElementCDATA(org.w3c.dom.CDATASection cdata,
                              java.io.Writer writer,
                              ContainerRequest containerRequest)
                       throws java.io.IOException
Description copied from interface: SerializationUnit
Write element CDATA section.

Parameters:
cdata - The CDATA section to write.
writer - The writer to be written to.
containerRequest - ContainerRequest instance for the delivery context.
Throws:
java.io.IOException - Exception writing output.

writeElementNode

public void writeElementNode(org.w3c.dom.Node node,
                             java.io.Writer writer,
                             ContainerRequest containerRequest)
                      throws java.io.IOException
Description copied from interface: SerializationUnit
Write element Node object.

Called to write DOM types not covered by the other methods on this interface.

Parameters:
node - The node to write.
writer - The writer to be written to.
containerRequest - ContainerRequest instance for the delivery context.
Throws:
java.io.IOException - Exception writing output.

getShortDescription

public java.lang.String getShortDescription()
Description copied from interface: ContentDeliveryUnit
Get a short description of the Content Delivery Unit and what it does.

This description will be used as the short description text in UI tools.
Example: "Unclose EMPTY Element"

Note: Implementations of this method should declare this string statically.

Returns:
Short description String.
See Also:
ContentDeliveryUnit.getDetailDescription()

getDetailDescription

public java.lang.String getDetailDescription()
Description copied from interface: ContentDeliveryUnit
Get a detail (more verbose) description of the Content Delivery Unit and what it does.

This description will be used as the detail description text in UI tools.
Example: "Replace element with an unclosed (badly formed!) equivalent if the element contains no content i.e. is empty. This is required by some older useragents."

Note: Implementations of this method should declare this string statically.

Returns:
Detail description String.
See Also:
ContentDeliveryUnit.getShortDescription()

writeChildElements

public boolean writeChildElements()
Description copied from interface: SerializationUnit
Write the child elements of the element this SerializationUnit is being applied to.

Returns:
True if the child elements are to be writen, otherwise false.

Milyn-Smooks Version 0.4