Class Exporter

    • Constructor Detail

      • Exporter

        protected Exporter​(java.lang.String name,
                           java.lang.String extension,
                           HelpLocation help)
        Constructs a new exporter.
        Parameters:
        name - the display name of this exporter
        extension - the default extension for this exporter
        help - the help location for this exporter
    • Method Detail

      • getName

        public final java.lang.String getName()
        Returns the display name of this exporter.
        Returns:
        the display name of this exporter
      • getDefaultFileExtension

        public final java.lang.String getDefaultFileExtension()
        Returns the default extension for this exporter. For example, .html for .xml.
        Returns:
        the default extension for this exporter
      • getHelpLocation

        public final HelpLocation getHelpLocation()
        Returns the help location for this exporter. It should return null only if no help documentation exists.
        Returns:
        the help location for this exporter
      • getMessageLog

        public final MessageLog getMessageLog()
        Returns the message log the may have been created during an export. The message log is used to log warnings and other non-critical messages.
        Returns:
        the message log
      • setExporterServiceProvider

        public final void setExporterServiceProvider​(ServiceProvider provider)
        Sets the exporter service provider.
        Parameters:
        provider - the exporter service provider
      • canExportDomainObject

        public boolean canExportDomainObject​(java.lang.Class<? extends DomainObject> domainObjectClass)
        Returns true if this exporter knows how to export the given domain object. For example, some exporters know how to export programs, other exporters can export project data type archives.
        Parameters:
        domainObjectClass - the class of the domain object to test for exporting.
        Returns:
        true if this exporter knows how to export the given domain object.
      • supportsPartialExport

        public boolean supportsPartialExport()
        Returns true if this exporter can export less than the entire domain file.
        Returns:
        true if this exporter can export less than the entire domain file.
      • getOptions

        public abstract java.util.List<Option> getOptions​(DomainObjectService domainObjectService)
        Returns the available options for this exporter. The program is needed because some exporters may have options that vary depending on the specific program being exported.
        Parameters:
        domainObjectService - a service for retrieving the applicable domainObject.
        Returns:
        the available options for this exporter
      • setOptions

        public abstract void setOptions​(java.util.List<Option> options)
                                 throws OptionException
        Sets the options. This method is not for defining the options, but rather it is for setting the values of options. If invalid options are passed in, then OptionException should be thrown.
        Parameters:
        options - the option values for this exporter
        Throws:
        OptionException - if invalid options are passed in
      • export

        public abstract boolean export​(java.io.File file,
                                       DomainObject domainObj,
                                       AddressSetView addrSet,
                                       TaskMonitor monitor)
                                throws ExporterException,
                                       java.io.IOException
        Actually does the work of exporting the program.
        Parameters:
        file - the output file to write the exported info
        domainObj - the domain object to export
        addrSet - the address set if only a portion of the program should be exported
        monitor - the task monitor
        Returns:
        true if the program was successfully exported; otherwise, false. If the program was not successfully exported, the message log should be checked to find the source of the error.
        Throws:
        ExporterException
        java.io.IOException
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object