Package com.adobe.pdfservices.operation
Class PDFServices
- java.lang.Object
-
- com.adobe.pdfservices.operation.PDFServices
-
public class PDFServices extends Object
This class is the entry point for all the PDF Service utilities. These utilities can be used to perform various functions such as submittingPDFServicesJob, getting status of aPDFServicesJob, getting result of aPDFServicesJob, uploadingAsset, getting content of anAsset, deleting anAssetand refreshing anAsset.Methods provided by the utility are:
- Upload
Asset(s) - Submit
PDFServicesJob - Get status of a
PDFServicesJob - Get result of a
PDFServicesJob - Get content of
Asset - Delete
Asset - Refresh
Asset
- Upload
-
-
Constructor Summary
Constructors Constructor Description PDFServices(Credentials credentials)Constructs aPDFServicesinstance with the givenCredentials.PDFServices(Credentials credentials, ClientConfig clientConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteAsset(Asset asset)Deletes asset from PDF Services storage.StreamAssetgetContent(Asset asset)Returns the content of the asset.<T> PDFServicesResponse<T>getJobResult(String pollingURL, Class<T> resultClass)ReturnsPDFServicesResponsefor the submittedPDFServicesJobresult.PDFServicesJobStatusResponsegetJobStatus(String pollingURL)ReturnsPDFServicesJobStatusResponsefor the submittedPDFServicesJob.AssetrefreshDownloadURI(Asset asset)Returns a newAssetwith a new valid download URI.Stringsubmit(PDFServicesJob pdfServicesJob)Creates thePDFServicesJoband returns the polling URL.Stringsubmit(PDFServicesJob pdfServicesJob, List<NotifierConfig> notifyConfigList)Creates thePDFServicesJobwith the givenNotifierConfigand returns the polling URL.Assetupload(InputStream inputStream, String mimeType)Upload content from input stream and returns anAssetto be used in PDF Services SDK.List<Asset>uploadAssets(List<StreamAsset> uploadAssetList)Upload content from list ofStreamAssetand returns a list ofAssetto be used in PDF Services SDK.
-
-
-
Constructor Detail
-
PDFServices
public PDFServices(Credentials credentials)
Constructs aPDFServicesinstance with the givenCredentials.- Parameters:
credentials- Credentials to be used for authentication; can not be null.
-
PDFServices
public PDFServices(Credentials credentials, ClientConfig clientConfig)
- Parameters:
credentials- Credentials to be used for authentication; can not be null.clientConfig- Client configuration forPDFServices; can not be null.
-
-
Method Detail
-
submit
public String submit(PDFServicesJob pdfServicesJob) throws ServiceApiException
Creates thePDFServicesJoband returns the polling URL.- Parameters:
pdfServicesJob-PDFServicesJobto be submitted; can not be null.- Returns:
- Polling URL that can be used to get the status and result of the job
- Throws:
ServiceApiException- If an error is encountered while submitting the job.SDKException- is thrown for client-side or network errors.ServiceUsageException- if service usage limits have been reached or credentials quota has been exhausted.
-
submit
public String submit(PDFServicesJob pdfServicesJob, List<NotifierConfig> notifyConfigList) throws ServiceApiException
Creates thePDFServicesJobwith the givenNotifierConfigand returns the polling URL.- Parameters:
pdfServicesJob-PDFServicesJobto be submitted; can not be null.notifyConfigList- List ofNotifierConfigto be used for notification; can not be null.- Returns:
- Polling URL that can be used to get the status and result of the job
- Throws:
ServiceApiException- If an error is encountered while submitting the job.SDKException- is thrown for client-side or network errors.ServiceUsageException- if service usage limits have been reached or credentials quota has been exhausted.
-
getJobResult
public <T> PDFServicesResponse<T> getJobResult(String pollingURL, Class<T> resultClass) throws ServiceApiException
ReturnsPDFServicesResponsefor the submittedPDFServicesJobresult.- Parameters:
pollingURL- URL to be polled to get the job result; can not be null or empty.resultClass- result class forPDFServicesJob, it will be an implements ofPDFServicesJobResult; can not be null.- Returns:
PDFServicesResponsewith the job result- Throws:
ServiceApiException- If an error is encountered while getting the job result.SDKException- is thrown for client-side or network errors.
-
getJobStatus
public PDFServicesJobStatusResponse getJobStatus(String pollingURL) throws ServiceApiException
ReturnsPDFServicesJobStatusResponsefor the submittedPDFServicesJob.- Parameters:
pollingURL- URL to be polled to get the job status; can not be null or empty.- Returns:
PDFServicesJobStatusResponseencapsulating the job status and retry interval- Throws:
ServiceApiException- If an error is encountered while getting the job status.
-
upload
public Asset upload(InputStream inputStream, String mimeType) throws ServiceApiException
Upload content from input stream and returns anAssetto be used in PDF Services SDK.Method will not close the input stream, responsibility of closing the input stream lies with the client.
- Parameters:
inputStream- input stream that is to be uploaded; can not be null.mimeType- mime type of the input stream; can not be null or empty.- Returns:
Assetasset containing the uploaded content- Throws:
ServiceApiException- If an error is encountered while uploading the asset.SDKException- is thrown for client-side or network errors.ServiceUsageException- if service usage limits have been reached or credentials quota has been exhausted.
-
uploadAssets
public List<Asset> uploadAssets(List<StreamAsset> uploadAssetList) throws ServiceApiException
Upload content from list ofStreamAssetand returns a list ofAssetto be used in PDF Services SDK.Method will not close the input stream of the Stream Asset, responsibility of closing the input stream lies with the client.
- Parameters:
uploadAssetList-StreamAssetlist that is to be uploaded; can not be null.- Returns:
Assetlist containing the assets with uploaded content- Throws:
ServiceApiException- If an error is encountered while uploading the assets.SDKException- is thrown for client-side or network errors.ServiceUsageException- if service usage limits have been reached or credentials quota has been exhausted.
-
getContent
public StreamAsset getContent(Asset asset) throws ServiceApiException
Returns the content of the asset.- Parameters:
asset-Assetasset to the content; can not be null.- Returns:
StreamAssetstream asset containing the stream content along with the media type- Throws:
ServiceApiException- If an error is encountered while getting the content.SDKException- is thrown for client-side or network errors.
-
deleteAsset
public void deleteAsset(Asset asset) throws ServiceApiException
Deletes asset from PDF Services storage.- Parameters:
asset-Assetasset to be deleted; can not be null.- Throws:
ServiceApiException- If an error is encountered while deleting the asset.SDKException- is thrown for client-side or network errors.
-
refreshDownloadURI
public Asset refreshDownloadURI(Asset asset) throws ServiceApiException
Returns a newAssetwith a new valid download URI.- Parameters:
asset-Assetasset to be refreshed; can not be null.- Returns:
Assetasset with a new valid download URI- Throws:
ServiceApiException- If an error is encountered while refreshing the asset.SDKException- is thrown for client-side or network errors.
-
-