de.init.its.okapi.ext
Class ODFFilter

java.lang.Object
  extended by de.init.its.okapi.ext.ODFFilter
All Implemented Interfaces:
IFilter

public class ODFFilter
extends java.lang.Object
implements IFilter

This class implements IFilter for XML documents in Open-Document format (ODF). The expected input is the XML document itself. It can be used on ODF documents that are not in Open-Office.org files (i.e. directly on the content.xml of the .odt). For processing ODT, ODS, etc. documents, use the OpenOfficeFilter class, which calls this filter as needed.


Field Summary
protected static java.lang.String NSURI_TEXT
           
protected static java.lang.String NSURI_XLINK
           
protected static java.lang.String OFFICE_ANNOTATION
           
protected static java.lang.String TEXT_BOOKMARK_REF
           
 
Fields inherited from interface de.init.its.okapi.ext.IFilter
SUB_FILTER
 
Constructor Summary
ODFFilter()
           
 
Method Summary
 void cancel()
          Cancels the current process.
 void close()
          Closes the input document.
 net.sf.okapi.common.filterwriter.IFilterWriter createFilterWriter()
          Creates a new IFilterWriter object from the most appropriate class to use with this filter.
 net.sf.okapi.common.skeleton.ISkeletonWriter createSkeletonWriter()
          Creates a new ISkeletonWriter object that corresponds to the type of skeleton this filter uses.
 java.util.List<net.sf.okapi.common.filters.FilterConfiguration> getConfigurations()
          Gets the list of all predefined configurations for this filter.
 java.lang.String getDisplayName()
          Gets the localizable display name of this filter.
 net.sf.okapi.common.encoder.EncoderManager getEncoderManager()
          Gets the EncoderManager object for this filter.
 java.lang.String getMimeType()
          Gets the MIME type of the format supported by this filter.
 java.lang.String getName()
          Gets the name/identifier of this filter.
 net.sf.okapi.common.IParameters getParameters()
          Gets the current parameters for this filter.
 boolean hasNext()
          Indicates if there is an event to process.
 net.sf.okapi.common.Event next()
          Gets the next event available.
 void open(net.sf.okapi.common.resource.RawDocument input)
          Opens the input document described in a give RawDocument object.
 void open(net.sf.okapi.common.resource.RawDocument input, boolean generateSkeleton)
          Opens the input document described in a give RawDocument object, and optionally creates skeleton information.
 void setContainerMimeType(java.lang.String mimeType)
          Sets the MIME type of the file containing this document.
 void setFilterConfigurationMapper(net.sf.okapi.common.filters.IFilterConfigurationMapper fcMapper)
          Sets the filter configuration mapper for this filter.
 void setParameters(net.sf.okapi.common.IParameters newParams)
          Sets new parameters for this filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NSURI_TEXT

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

NSURI_XLINK

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

TEXT_BOOKMARK_REF

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

OFFICE_ANNOTATION

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

ODFFilter

public ODFFilter()
Method Detail

close

public void close()
Description copied from interface: IFilter
Closes the input document. Developers should call this method from within their code before sending the last event: This can allow writer objects to overwrite the input file when they receive the last event. This method must also be safe to call even if the input document is not opened.

Specified by:
close in interface IFilter

cancel

public void cancel()
Description copied from interface: IFilter
Cancels the current process.

Specified by:
cancel in interface IFilter

hasNext

public boolean hasNext()
Description copied from interface: IFilter
Indicates if there is an event to process.

Implementer Note: The caller must be able to call this method several times without changing state.

Specified by:
hasNext in interface IFilter
Returns:
True if there is at least one event to process, false if not.

open

public void open(net.sf.okapi.common.resource.RawDocument input)
Description copied from interface: IFilter
Opens the input document described in a give RawDocument object. Skeleton information is always created when you use this method.

Specified by:
open in interface IFilter
Parameters:
input - The RawDocument object to use to open the document.

open

public void open(net.sf.okapi.common.resource.RawDocument input,
                 boolean generateSkeleton)
Description copied from interface: IFilter
Opens the input document described in a give RawDocument object, and optionally creates skeleton information.

Specified by:
open in interface IFilter
Parameters:
input - The RawDocument object to use to open the document.

setContainerMimeType

public void setContainerMimeType(java.lang.String mimeType)
Sets the MIME type of the file containing this document. This is the MIME type found in the mimetype file of the zip file.

Parameters:
mimeType - the MIME type to set.

getName

public java.lang.String getName()
Description copied from interface: IFilter
Gets the name/identifier of this filter.

Specified by:
getName in interface IFilter
Returns:
The name/identifier of the filter.

getDisplayName

public java.lang.String getDisplayName()
Description copied from interface: IFilter
Gets the localizable display name of this filter.

Specified by:
getDisplayName in interface IFilter
Returns:
the localizable display name of this filter.

getMimeType

public java.lang.String getMimeType()
Description copied from interface: IFilter
Gets the MIME type of the format supported by this filter.

Specified by:
getMimeType in interface IFilter
Returns:
The MIME type of the format supported by this filter.

getConfigurations

public java.util.List<net.sf.okapi.common.filters.FilterConfiguration> getConfigurations()
Description copied from interface: IFilter
Gets the list of all predefined configurations for this filter.

Specified by:
getConfigurations in interface IFilter
Returns:
a list of the all predefined configurations for this filter.

getEncoderManager

public net.sf.okapi.common.encoder.EncoderManager getEncoderManager()
Description copied from interface: IFilter
Gets the EncoderManager object for this filter. This encoder manager should provided the mappings to the different MIME types used by the filter.

Specified by:
getEncoderManager in interface IFilter
Returns:
the EncoderManager for this filter.

getParameters

public net.sf.okapi.common.IParameters getParameters()
Description copied from interface: IFilter
Gets the current parameters for this filter.

Specified by:
getParameters in interface IFilter
Returns:
The current parameters for this filter, or null if this filter has no parameters.

next

public net.sf.okapi.common.Event next()
Description copied from interface: IFilter
Gets the next event available. Calling this method can be done only once on each event.

Specified by:
next in interface IFilter
Returns:
The next event available or null if there are no events.

setFilterConfigurationMapper

public void setFilterConfigurationMapper(net.sf.okapi.common.filters.IFilterConfigurationMapper fcMapper)
Description copied from interface: IFilter
Sets the filter configuration mapper for this filter. This object is used by this filter if it needs to instantiate sub-filters. The implementations of IFilter that do not use sub-filters can use an empty stub for this method.

Specified by:
setFilterConfigurationMapper in interface IFilter
Parameters:
fcMapper - the mapper to set.

setParameters

public void setParameters(net.sf.okapi.common.IParameters newParams)
Description copied from interface: IFilter
Sets new parameters for this filter.

Specified by:
setParameters in interface IFilter
Parameters:
newParams - The new parameters to use.

createSkeletonWriter

public net.sf.okapi.common.skeleton.ISkeletonWriter createSkeletonWriter()
Description copied from interface: IFilter
Creates a new ISkeletonWriter object that corresponds to the type of skeleton this filter uses.

Specified by:
createSkeletonWriter in interface IFilter
Returns:
A new instance of ISkeletonWriter for the type of skeleton this filter uses.

createFilterWriter

public net.sf.okapi.common.filterwriter.IFilterWriter createFilterWriter()
Description copied from interface: IFilter
Creates a new IFilterWriter object from the most appropriate class to use with this filter.

Specified by:
createFilterWriter in interface IFilter
Returns:
A new instance of IFilterWriter for the preferred implementation for this filter.