de.tuberlin.cs.flp.jspwiki.plugin.wikiarchive
Interface ArchiveHandler

All Known Implementing Classes:
ArchiveHandlerAbstract

public interface ArchiveHandler

Interface ArchiveIOHandler. Each i/o-handler takes care about import and export between the Archive model interface and one type of data source/sink. Importing and exporting from/to external data sources is implicitly implemented by WikiArchive, which uses the Archive model interface as intermediate data container between the Wiki's internal i/o-handler and any other i/o-handler. Using this architecture, only bidirectional conversions between the Archive model interface and each data source (including the Wiki itself) need to be implemented. Direct conversions between different types are never needed, as the Archive model interface acts as intermediate data container. Each WikiArchive needs at least one ArchiveIOHandler registered for type "wiki", Allows the implementation of pluggable i/o-handlers for internal Wiki i/o and any external import/export data source.

See Also:
de.tuberlin.cs.flp.jspwiki.plugin.WikiArchive#initIOHandlers(Object[][])

Field Summary
static boolean EXPORT
           
static boolean IMPORT
           
 
Method Summary
 java.lang.Object createData()
          Creates an empty data source to be filled for export.
 java.lang.String dataToString(java.lang.Object data)
          Converts the handled data source to string for export.
 java.lang.String getContentSuffix()
          Content suffix for export via HTTP.
 java.lang.String getContentType()
          Content type for export via HTTP.
 void init(WikiEngine engine, java.util.Map config)
          Initializes this ArchiveHandler.
 java.lang.String performIO(boolean io, Archive archive, java.lang.Object data, int mode, java.util.Collection exceptions)
          Perform either input from the Archive model interface into 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.
 

Field Detail

IMPORT

public static final boolean IMPORT
See Also:
Constant Field Values

EXPORT

public static final boolean EXPORT
See Also:
Constant Field Values
Method Detail

init

public void init(WikiEngine engine,
                 java.util.Map config)
Initializes this ArchiveHandler.

Parameters:
engine -
config -

performIO

public java.lang.String performIO(boolean io,
                                  Archive archive,
                                  java.lang.Object data,
                                  int mode,
                                  java.util.Collection exceptions)
                           throws java.io.IOException
Perform either input from the Archive model interface into the data source handled by this ArchiveIOHandler.

Parameters:
io - Switch between input or output mode, true for input into data source, false for output into Archive model interface.
archive - The Archive model interface.
data - The data source handled by this ArchiveIOHandler.
mode - The processing mode. This is a bit mask with:
bit #0 set: update exisiting entries with new values, if new data is different
bit #1 set: insert new entries
bit #2 set: ask individually for each entry (generate HTML checkbox-form first)
exceptions - Collection of entry names that should be treated as exceptions to the behaviour specified by mode. (Not used.)
Returns:
Throws:
java.io.IOException - if an i/o error occurs

createData

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

Returns:
Throws:
java.io.IOException

dataToString

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

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.

Parameters:
s -
data -
Throws:
java.io.IOException

getContentType

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

Returns:

getContentSuffix

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

Returns: