org.pf.tools.cda.plugin.export.spi
Class AModelExporter

java.lang.Object
  extended by org.pf.tools.cda.xpi.AModelObjectVisitor
      extended by org.pf.tools.cda.plugin.export.spi.AModelExporter
All Implemented Interfaces:
IPluginInfo

public abstract class AModelExporter
extends AModelObjectVisitor
implements IPluginInfo

The purpose of this abstract exporter class is to provide default implementations of methods that may be overridden by subclasses. This is more stable in comparison to an interface, since adding new methods won't break already existing subclasses.

Version:
1.0
Author:
M.Duchrow

Field Summary
static java.lang.String PARAM_OUTPUT_FILENAME
          Defines the parameter name of the configuration setting for the initialize() method that specifies the filename to which the output must be written.
 
Constructor Summary
AModelExporter()
           
 
Method Summary
 void abortExport()
          This method gets called if the export must be aborted due to user interrupt or any exception that occurred during export execution.
 boolean finishExport()
          This method gets called after all data has been passed to the exporter and so far no exception or cancellation occurred.
 java.lang.String getPluginId()
          Returns the exporte's id
abstract  boolean initialize(PluginConfiguration config)
          Initialize the exporter with external configuration data.
 boolean prepareExport()
          This method is called to initiate an export.
 void setId(java.lang.String id)
          Returns the exporte's id
 
Methods inherited from class org.pf.tools.cda.xpi.AModelObjectVisitor
finishContainer, finishContext, finishModelObject, finishNamespace, finishType, startContainer, startContext, startModelObject, startNamespace, startType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pf.tools.cda.xpi.IPluginInfo
getPluginProvider, getPluginVersion
 

Field Detail

PARAM_OUTPUT_FILENAME

public static final java.lang.String PARAM_OUTPUT_FILENAME
Defines the parameter name of the configuration setting for the initialize() method that specifies the filename to which the output must be written.

See Also:
Constant Field Values
Constructor Detail

AModelExporter

public AModelExporter()
Method Detail

initialize

public abstract boolean initialize(PluginConfiguration config)
Initialize the exporter with external configuration data. Since each subclass needs different kind of configuration data the type here is very generic and extensible.

The data provided with this config object can be a filename or a database URL with user id and password or whatever is necessary to enable the specific exporter to do its work.

Parameters:
config - The configuration to be used for initialization
Returns:
true to continue, false to stop the data export

prepareExport

public boolean prepareExport()
This method is called to initiate an export. It can be overridden to select/open a file or directory or establishing a connection to a database. If it returns null the export will be done, otherwise it gets cancelled. The default implementation does nothing and returns true.

Returns:
true to start exporting, false to not even start the data export

finishExport

public boolean finishExport()
This method gets called after all data has been passed to the exporter and so far no exception or cancellation occurred. It can be overriden in order to clean up and close open files or connections.

The default application returns true.

Returns:
Returns true if the export was sucessfully finished

abortExport

public void abortExport()
This method gets called if the export must be aborted due to user interrupt or any exception that occurred during export execution.

The default implemention here is doing nothing.


getPluginId

public java.lang.String getPluginId()
Returns the exporte's id

Specified by:
getPluginId in interface IPluginInfo

setId

public void setId(java.lang.String id)
Returns the exporte's id