|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.api.ads.dfp.axis.utils.v201203.ReportDownloader
public class ReportDownloader
Retrieves reports using a ReportServiceInterface.
There are two main functions of this class:
OutputStream
ReportUtils also provides the method
whenReportReady(ReportCallback) to wait for a scheduled report to
finish processing before taking an action on the report through the supplied
ReportCallback.
| Field Summary | |
|---|---|
static int |
SLEEP_TIMER
The time to sleep before each request to the service. |
| Constructor Summary | |
|---|---|
ReportDownloader(ReportServiceInterface reportService,
long reportJobId)
Constructs a ReportDownloader object for a
ReportServiceInterface and a report job id that the the class works
on. |
|
| Method Summary | |
|---|---|
void |
downloadReport(ExportFormat exportFormat,
OutputStream outputStream)
Downloads a Gzip or plain-text format report XML to output stream indicated by outputStream. |
void |
downloadReport(ExportFormat exportFormat,
String fileName)
Downloads a Gzip report to file located at fileName. |
String |
getReport(ExportFormat exportFormat)
Gets the plain-text format report as a String. |
boolean |
waitForReportReady()
Blocks and waits for a report to be ready. |
Thread |
whenReportReady(ReportCallback callback)
Waits for the report to be ready and then calls: ReportCallback.onSuccess() for a successful scheduling
ReportCallback.onFailure() for a failed scheduling due to a
ReportJobStatus.FAILED
ReportCallback.onInterruption() if the wait thread is
interrupted
ReportCallback.onException(Exception) if there was an exception
while waiting for the report to finish
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SLEEP_TIMER
| Constructor Detail |
|---|
public ReportDownloader(ReportServiceInterface reportService,
long reportJobId)
ReportDownloader object for a
ReportServiceInterface and a report job id that the the class works
on.
reportService - the ReportService stub to make calls toreportJobId - the report job ID| Method Detail |
|---|
public Thread whenReportReady(ReportCallback callback)
ReportCallback.onSuccess() for a successful schedulingReportCallback.onFailure() for a failed scheduling due to a
ReportJobStatus.FAILEDReportCallback.onInterruption() if the wait thread is
interruptedReportCallback.onException(Exception) if there was an exception
while waiting for the report to finish
callback - the ReportCallback to call when the job has
finished, successfully or otherwise
Thread.interrupt() can be called on the returned thread to
interrupt it.
IllegalArgumentException - if callback == null
public boolean waitForReportReady()
throws RemoteException,
InterruptedException
ReportJobStatus
is received that is not ReportJobStatus#Pending or ReportJobStatus#InProgress, the report is considered finished, and the
method is returned with a true if the report was successful, or an
false if not.
true if the report was successful, false otherwise
RemoteException - if there was an error performing one of the SOAP
calls
InterruptedException - if the thread was interrupted
public void downloadReport(ExportFormat exportFormat,
String fileName)
throws IOException
fileName.
exportFormat - the export format of the reportfileName - the file location to download the report to
IOException - if there was an error performing any I/O action,
including any SOAP calls
IllegalStateException - if the report is not ready to be downloaded
public void downloadReport(ExportFormat exportFormat,
OutputStream outputStream)
throws IOException
outputStream.
exportFormat - the export format of the reportoutputStream - the output stream to download the report to
IOException - if there was an error performing any I/O action,
including any SOAP calls
IllegalStateException - if the report is not ready to be downloaded
public String getReport(ExportFormat exportFormat)
throws IOException
String.
exportFormat - the export format of the report
String
IOException - if there was an error performing any I/O action,
including any SOAP calls
IllegalStateException - if the report is not ready to be downloaded
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||