de.tuberlin.cs.flp.jspwiki.plugin.wikiarchive
Class ArchiveHandlerXML

java.lang.Object
  extended byde.tuberlin.cs.flp.jspwiki.plugin.wikiarchive.ArchiveHandlerAbstract
      extended byde.tuberlin.cs.flp.jspwiki.plugin.wikiarchive.ArchiveHandlerExternalFormatAbstract
          extended byde.tuberlin.cs.flp.jspwiki.plugin.wikiarchive.ArchiveHandlerXML
All Implemented Interfaces:
ArchiveHandler

public class ArchiveHandlerXML
extends ArchiveHandlerExternalFormatAbstract

Archive handler for an XML-represented set of entries.


Field Summary
protected static java.lang.String ATTRIBUTE_ID
           
static java.lang.String CONTENT_SUFFIX
           
static java.lang.String CONTENT_TYPE
           
protected static java.lang.String TAGNAME_ENTRY
           
 
Fields inherited from class de.tuberlin.cs.flp.jspwiki.plugin.wikiarchive.ArchiveHandlerAbstract
config, engine
 
Fields inherited from interface de.tuberlin.cs.flp.jspwiki.plugin.wikiarchive.ArchiveHandler
EXPORT, IMPORT
 
Constructor Summary
ArchiveHandlerXML()
           
 
Method Summary
 java.lang.Object createData()
          Creates an empty data source to be filled for export.
protected  void createEntry(java.lang.Object data, ArchiveEntry entry)
          Creates a new archive entry in the data source handled by this ArchiveIOHandler.
 java.lang.String dataToString(java.lang.Object data)
          Converts data source to string for export.
protected static org.w3c.dom.Element entry2xml(org.w3c.dom.Document doc, ArchiveEntry entry)
           
protected static org.w3c.dom.Element findEntryElement(org.w3c.dom.Document doc, java.lang.String tagname)
           
 java.lang.String getContentSuffix()
          Content type for export via HTTP.
 java.lang.String getContentType()
          Content type for export via HTTP.
protected static void moveChildren(org.w3c.dom.Element from, org.w3c.dom.Element to)
           
protected  java.util.Map parseAll(java.lang.Object data)
          Retrieves all archive entries from the data source.
protected static void removeChildren(org.w3c.dom.Element e)
           
protected  void replaceEntry(java.lang.Object data, ArchiveEntry newEntry, ArchiveEntry oldEntry)
          Replaces an archive entry in the data source handled by this ArchiveIOHandler.
 void stringToData(java.lang.String s, java.lang.Object data)
          Converts a string to a handled data source for import.
protected static ArchiveEntry xml2entry(org.w3c.dom.Element e)
           
 
Methods inherited from class de.tuberlin.cs.flp.jspwiki.plugin.wikiarchive.ArchiveHandlerExternalFormatAbstract
msgDone, msgNotDone, msgToDo
 
Methods inherited from class de.tuberlin.cs.flp.jspwiki.plugin.wikiarchive.ArchiveHandlerAbstract
equalEntries, getEngine, init, performIO, setEngine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_TYPE

public static final java.lang.String CONTENT_TYPE
See Also:
Constant Field Values

CONTENT_SUFFIX

public static final java.lang.String CONTENT_SUFFIX
See Also:
Constant Field Values

TAGNAME_ENTRY

protected static final java.lang.String TAGNAME_ENTRY
See Also:
Constant Field Values

ATTRIBUTE_ID

protected static final java.lang.String ATTRIBUTE_ID
See Also:
Constant Field Values
Constructor Detail

ArchiveHandlerXML

public ArchiveHandlerXML()
Method Detail

createData

public java.lang.Object createData()
                            throws java.io.IOException
Creates an empty data source to be filled for export.

Specified by:
createData in interface ArchiveHandler
Overrides:
createData in class ArchiveHandlerExternalFormatAbstract
Returns:
Throws:
java.io.IOException

dataToString

public java.lang.String dataToString(java.lang.Object data)
                              throws java.io.IOException
Converts data source to string for export.

Specified by:
dataToString in interface ArchiveHandler
Overrides:
dataToString in class ArchiveHandlerExternalFormatAbstract
Parameters:
data -
Returns:
Throws:
java.io.IOException

stringToData

public void stringToData(java.lang.String s,
                         java.lang.Object data)
                  throws java.io.IOException
Converts a string to a handled data source for import.

Specified by:
stringToData in interface ArchiveHandler
Overrides:
stringToData in class ArchiveHandlerExternalFormatAbstract
Parameters:
s -
data -
Throws:
java.io.IOException

getContentType

public java.lang.String getContentType()
Content type for export via HTTP.

Specified by:
getContentType in interface ArchiveHandler
Specified by:
getContentType in class ArchiveHandlerAbstract
Returns:

getContentSuffix

public java.lang.String getContentSuffix()
Content type for export via HTTP.

Specified by:
getContentSuffix in interface ArchiveHandler
Specified by:
getContentSuffix in class ArchiveHandlerAbstract
Returns:

createEntry

protected void createEntry(java.lang.Object data,
                           ArchiveEntry entry)
Creates a new archive entry in the data source handled by this ArchiveIOHandler.

Specified by:
createEntry in class ArchiveHandlerAbstract
Parameters:
data - The data source handled by this ArchiveHandler, which is of type Document here.
entry - The entry.

replaceEntry

protected void replaceEntry(java.lang.Object data,
                            ArchiveEntry newEntry,
                            ArchiveEntry oldEntry)
                     throws java.io.IOException
Replaces an archive entry in the data source handled by this ArchiveIOHandler.

Specified by:
replaceEntry in class ArchiveHandlerAbstract
Parameters:
data - The data source handled by this ArchiveHandler, which is of type Document here.
newEntry - The new entry.
oldEntry - The old entry.
Throws:
java.io.IOException - if an i/o error occurs

parseAll

protected java.util.Map parseAll(java.lang.Object data)
                          throws java.io.IOException
Retrieves all archive entries from the data source.

Specified by:
parseAll in class ArchiveHandlerAbstract
Parameters:
data - The data source handled by this ArchiveHandler, which is of type StringBuffer here.
Returns:
Throws:
java.io.IOException - if an i/o error occurs

entry2xml

protected static org.w3c.dom.Element entry2xml(org.w3c.dom.Document doc,
                                               ArchiveEntry entry)
Parameters:
doc -
entry -
Returns:

xml2entry

protected static ArchiveEntry xml2entry(org.w3c.dom.Element e)
Parameters:
e -
Returns:

findEntryElement

protected static org.w3c.dom.Element findEntryElement(org.w3c.dom.Document doc,
                                                      java.lang.String tagname)
Parameters:
doc -
tagname -
Returns:

removeChildren

protected static void removeChildren(org.w3c.dom.Element e)
Parameters:
e -

moveChildren

protected static void moveChildren(org.w3c.dom.Element from,
                                   org.w3c.dom.Element to)
Parameters:
from -
to -