Interface Exporter

  • All Superinterfaces:
    ExporterComp

    public interface Exporter
    extends ExporterComp
    Interface for exporting objects to a (job) file. This interface allows several objects to be specified for export via the methods: Once objects have been marked for export via this mechanism, they can be exported using the methods: These methods may be called multiple times to export the same set of objects.

    This interface is not expected to be synchronized; the results of multiple threads calling methods simultaneously are undefined.

    • Method Detail

      • exportObject

        void exportObject​(BusinessKeyObject object)
        Mark an object for export. Only objects that declare a business key can be exported. Note that not all objects that declare a business key can be exported.
        Parameters:
        object - The object to export.
      • exportObjects

        void exportObjects​(Iterator<? extends com.redwood.scheduler.api.model.SchedulerEntity> objects)
        Mark a series of objects for export.
        Parameters:
        objects - Iterator over the objects to mark for export. All objects must be an instance of BusinessKeyObject.
      • exportSelectedObjects

        void exportSelectedObjects​(String sql)
        Mark for export all objects that match a query.
        Parameters:
        sql - an object SQL query that returns the objects to export.
      • addExportRuleSetXML

        void addExportRuleSetXML​(String newExportRuleSetXML)
        Call this method to add an XML representation of an ExportRuleSet, which will be added to the CAR file that is exported.
        Parameters:
        newExportRuleSetXML - The XML definition of the ExportRuleSet to add to the CAR file
      • exportSelectedObjects

        void exportSelectedObjects​(String sql,
                                   Object[] variables)
        Mark for export all objects that match a query.
        Parameters:
        sql - an object sql query that returns the objects to export.
        variables - variables to substitute where a ? occurs in the sql.
      • writeToFile

        void writeToFile​(String filename)
                  throws ExportException,
                         IOException,
                         com.redwood.scheduler.api.exception.LicenseException
        Export marked objects to a local file with the given name. If the file already exists, it will be overwritten.
        Parameters:
        filename - the name of the file to write to.
        Throws:
        ExportException - This is thrown if a problem occurs with the export of the marked objects.
        IOException - This is thrown if a problem occurs writing the export data to the supplied file.
        com.redwood.scheduler.api.exception.LicenseException - This is thrown if export functionality is not licensed.
      • writeToNewJobFile

        com.redwood.scheduler.api.model.JobFile writeToNewJobFile​(com.redwood.scheduler.api.model.Job job)
                                                           throws ExportException,
                                                                  IOException,
                                                                  com.redwood.scheduler.api.exception.LicenseException
        Export marked objects to a local job file that will be attached to the supplied job. The exporter has an implied local session; the supplied job need not be from within this local session, but the jobfile will be there.

        Note that because the jobfile is a new object, the local session must be persisted for the jobfile to be available.

        Parameters:
        job - the job to which the jobfile will be attached.
        Returns:
        the jobfile to which the export was written.
        Throws:
        ExportException - This is thrown if a problem occurs with the export of the marked objects.
        IOException - This is thrown if a problem occurs writing the export data to the supplied file.
        com.redwood.scheduler.api.exception.LicenseException - This is thrown if export functionality is not licensed.
      • getMarkedObjects

        RWIterable<com.redwood.scheduler.api.model.SchedulerEntity> getMarkedObjects()
        Query the list of objects that are marked for export.
        Specified by:
        getMarkedObjects in interface ExporterComp
        Returns:
        an unmodifiable iterator over the set of objects that are marked for export.
      • reset

        void reset()
        Clear the list of objects that are marked for export.
      • getObjectXML

        String getObjectXML​(Readable readable)
                     throws com.redwood.scheduler.api.exception.LicenseException,
                            ExportException,
                            IOException
        Get the XML for an object.
        Parameters:
        readable - the object to get the XML for.
        Returns:
        the XML
        Throws:
        com.redwood.scheduler.api.exception.LicenseException - if Export is not licensed.
        ExportException - if export fails.
        IOException - if an I/O operation fails.
      • setComment

        void setComment​(String comment)
        Set the comment on the car file. This is written in the export-info.
        Parameters:
        comment - the comment to set.