Package com.redwood.scheduler.api.model
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.
-
-
Field Summary
Fields Modifier and Type Field Description static String
COPYRIGHT_MESSAGE
static String
ID
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.void
exportObject(BusinessKeyObject object)
Mark an object for export.void
exportObjects(Iterator<? extends SchedulerEntity> objects)
Mark a series of objects for export.void
exportSelectedObjects(String sql)
Mark for export all objects that match a query.void
exportSelectedObjects(String sql, Object[] variables)
Mark for export all objects that match a query.RWIterable<SchedulerEntity>
getMarkedObjects()
Query the list of objects that are marked for export.String
getObjectXML(Readable readable)
Get the XML for an object.void
reset()
Clear the list of objects that are marked for export.void
setComment(String comment)
Set the comment on the car file.void
writeToFile(String filename)
Export marked objects to a local file with the given name.JobFile
writeToNewJobFile(Job job)
Export marked objects to a local job file that will be attached to the supplied job.
-
-
-
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 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 ofBusinessKeyObject
.
-
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, 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.LicenseException
- This is thrown if export functionality is not licensed.
-
writeToNewJobFile
JobFile writeToNewJobFile(Job job) throws ExportException, IOException, 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.LicenseException
- This is thrown if export functionality is not licensed.
-
getMarkedObjects
RWIterable<SchedulerEntity> getMarkedObjects()
Query the list of objects that are marked for export.- Specified by:
getMarkedObjects
in interfaceExporterComp
- 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 LicenseException, ExportException, IOException
Get the XML for an object.- Parameters:
readable
- the object to get the XML for.- Returns:
- the XML
- Throws:
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.
-
-