×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: Anil Sharma
Added: Aug 28, 2017 6:31 PM
Views: 1
Tags: tara infocom
  1. /*******************************************************************************
  2.  *  Copyright 2009 Amazon Services.
  3.  *  Licensed under the Apache License, Version 2.0 (the "License");
  4.  *  
  5.  *  You may not use this file except in compliance with the License.
  6.  *  You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
  7.  *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  8.  *  CONDITIONS OF ANY KIND, either express or implied. See the License for the
  9.  *  specific language governing permissions and limitations under the License.
  10.  * *****************************************************************************
  11.  *
  12.  *  Marketplace Web Service Java Library
  13.  *  API Version: 2009-01-01
  14.  *  Generated: Wed Feb 18 13:28:48 PST 2009
  15.  *
  16.  */
  17.  
  18.  
  19.  
  20. package com.amazonaws.mws.mock;
  21.  
  22. import com.amazonaws.mws.model.*;
  23. import com.amazonaws.mws.*;
  24.  
  25. import java.util.concurrent.Callable;
  26. import java.util.concurrent.ExecutorService;
  27. import java.util.concurrent.Executors;
  28. import javax.xml.bind.JAXBContext;
  29. import javax.xml.bind.JAXBException;
  30. import javax.xml.bind.Unmarshaller;
  31. import org.apache.commons.logging.Log;
  32. import org.apache.commons.logging.LogFactory;
  33. import org.xml.sax.InputSource;
  34. import java.util.concurrent.Future;
  35. import java.util.concurrent.ThreadFactory;
  36. import java.util.concurrent.atomic.AtomicInteger;
  37.  
  38. /**
  39.  *
  40.  * MarketplaceWebServiceMock is the implementation of MarketplaceWebService based
  41.  * on the pre-populated set of XML files that serve local data. It simulates
  42.  * responses from Marketplace Web Service service.
  43.  *
  44.  * Use this to test your application without making a call to Marketplace Web Service
  45.  *
  46.  * Note, current Mock Service implementation does not valiadate requests
  47.  *
  48.  */
  49. public  class MarketplaceWebServiceMock implements MarketplaceWebService {
  50.    
  51.     private final Log log = LogFactory.getLog(MarketplaceWebServiceMock.class);
  52.     private static JAXBContext  jaxbContext;
  53.     private static ThreadLocal<Unmarshaller> unmarshaller;
  54.     private ExecutorService asyncExecutor = Executors.newCachedThreadPool(
  55.             new ThreadFactory() {
  56.                 private final AtomicInteger threadNumber = new AtomicInteger(1);
  57.                 public Thread newThread(Runnable task) {
  58.                     Thread thread = new Thread(task, "MarketplaceWebServiceMock-Thread-" + threadNumber.getAndIncrement());
  59.                     thread.setDaemon(Boolean.TRUE);
  60.                     if (thread.getPriority() != Thread.NORM_PRIORITY) {
  61.                         thread.setPriority(Thread.NORM_PRIORITY);
  62.                     }
  63.                     return thread;
  64.                 }
  65.                 });
  66.  
  67.    
  68.     /** Initialize JAXBContext and  Unmarshaller **/
  69.     static {
  70.         try {
  71.             jaxbContext = JAXBContext.newInstance("com.amazonaws.mws.model", MarketplaceWebService.class.getClassLoader());
  72.         } catch (JAXBException ex) {
  73.             throw new ExceptionInInitializerError(ex);
  74.         }
  75.         unmarshaller = new ThreadLocal<Unmarshaller>() {
  76.             protected synchronized Unmarshaller initialValue() {
  77.                 try {
  78.                     return jaxbContext.createUnmarshaller();
  79.                 } catch(JAXBException e) {
  80.                     throw new ExceptionInInitializerError(e);
  81.                 }
  82.             }
  83.         };
  84.     }
  85.  
  86.     // Public API ------------------------------------------------------------//
  87.    
  88.        
  89.     /**
  90.      * Get Report
  91.      *
  92.      * The GetReport operation returns the contents of a report. Reports can potentially be
  93.      * very large (>100MB) which is why we only return one report at a time, and in a
  94.      * streaming fashion.
  95.      *  
  96.      * @param request
  97.      *          GetReport Action
  98.      * @return
  99.      *          GetReport Response from the service
  100.      *
  101.      * @throws MarketplaceWebServiceException
  102.      */
  103.     public GetReportResponse getReport(GetReportRequest request)
  104.         throws MarketplaceWebServiceException {
  105.         GetReportResponse response;
  106.         try {
  107.             response = (GetReportResponse)getUnmarshaller().unmarshal
  108.                     (new InputSource(this.getClass().getResourceAsStream("GetReportResponse.xml")));
  109.  
  110.             log.debug("Response from Mock Service: " + response.toXML());
  111.            
  112.         } catch (JAXBException jbe) {
  113.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  114.         }
  115.         return response;
  116.     }
  117.  
  118.     public Future<GetReportResponse> getReportAsync(final
  119. GetReportRequest request) {
  120.         Future<GetReportResponse> response = asyncExecutor.submit(new Callable<GetReportResponse>() {
  121.  
  122.             public GetReportResponse call() throws MarketplaceWebServiceException {
  123.                 return getReport(request);
  124.             }
  125.             });
  126.         return response;
  127.     }
  128.        
  129.     /**
  130.      * Get Report Schedule Count
  131.      *
  132.      * returns the number of report schedules
  133.      *  
  134.      * @param request
  135.      *          GetReportScheduleCount Action
  136.      * @return
  137.      *          GetReportScheduleCount Response from the service
  138.      *
  139.      * @throws MarketplaceWebServiceException
  140.      */
  141.     public GetReportScheduleCountResponse getReportScheduleCount(GetReportScheduleCountRequest request)
  142.         throws MarketplaceWebServiceException {
  143.         GetReportScheduleCountResponse response;
  144.         try {
  145.             response = (GetReportScheduleCountResponse)getUnmarshaller().unmarshal
  146.                     (new InputSource(this.getClass().getResourceAsStream("GetReportScheduleCountResponse.xml")));
  147.  
  148.             log.debug("Response from Mock Service: " + response.toXML());
  149.            
  150.         } catch (JAXBException jbe) {
  151.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  152.         }
  153.         return response;
  154.     }
  155.  
  156.     public Future<GetReportScheduleCountResponse> getReportScheduleCountAsync(final
  157. GetReportScheduleCountRequest request) {
  158.         Future<GetReportScheduleCountResponse> response = asyncExecutor.submit(new Callable<GetReportScheduleCountResponse>() {
  159.  
  160.             public GetReportScheduleCountResponse call() throws MarketplaceWebServiceException {
  161.                 return getReportScheduleCount(request);
  162.             }
  163.             });
  164.         return response;
  165.     }
  166.        
  167.     /**
  168.      * Get Report Request List By Next Token
  169.      *
  170.      * retrieve the next batch of list items and if there are more items to retrieve
  171.      *  
  172.      * @param request
  173.      *          GetReportRequestListByNextToken Action
  174.      * @return
  175.      *          GetReportRequestListByNextToken Response from the service
  176.      *
  177.      * @throws MarketplaceWebServiceException
  178.      */
  179.     public GetReportRequestListByNextTokenResponse getReportRequestListByNextToken(GetReportRequestListByNextTokenRequest request)
  180.         throws MarketplaceWebServiceException {
  181.         GetReportRequestListByNextTokenResponse response;
  182.         try {
  183.             response = (GetReportRequestListByNextTokenResponse)getUnmarshaller().unmarshal
  184.                     (new InputSource(this.getClass().getResourceAsStream("GetReportRequestListByNextTokenResponse.xml")));
  185.  
  186.             log.debug("Response from Mock Service: " + response.toXML());
  187.            
  188.         } catch (JAXBException jbe) {
  189.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  190.         }
  191.         return response;
  192.     }
  193.  
  194.     public Future<GetReportRequestListByNextTokenResponse> getReportRequestListByNextTokenAsync(final
  195. GetReportRequestListByNextTokenRequest request) {
  196.         Future<GetReportRequestListByNextTokenResponse> response = asyncExecutor.submit(new Callable<GetReportRequestListByNextTokenResponse>() {
  197.  
  198.             public GetReportRequestListByNextTokenResponse call() throws MarketplaceWebServiceException {
  199.                 return getReportRequestListByNextToken(request);
  200.             }
  201.             });
  202.         return response;
  203.     }
  204.        
  205.     /**
  206.      * Update Report Acknowledgements
  207.      *
  208.      * The UpdateReportAcknowledgements operation updates the acknowledged status of one or more reports.
  209.      *  
  210.      * @param request
  211.      *          UpdateReportAcknowledgements Action
  212.      * @return
  213.      *          UpdateReportAcknowledgements Response from the service
  214.      *
  215.      * @throws MarketplaceWebServiceException
  216.      */
  217.     public UpdateReportAcknowledgementsResponse updateReportAcknowledgements(UpdateReportAcknowledgementsRequest request)
  218.         throws MarketplaceWebServiceException {
  219.         UpdateReportAcknowledgementsResponse response;
  220.         try {
  221.             response = (UpdateReportAcknowledgementsResponse)getUnmarshaller().unmarshal
  222.                     (new InputSource(this.getClass().getResourceAsStream("UpdateReportAcknowledgementsResponse.xml")));
  223.  
  224.             log.debug("Response from Mock Service: " + response.toXML());
  225.            
  226.         } catch (JAXBException jbe) {
  227.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  228.         }
  229.         return response;
  230.     }
  231.  
  232.     public Future<UpdateReportAcknowledgementsResponse> updateReportAcknowledgementsAsync(final
  233. UpdateReportAcknowledgementsRequest request) {
  234.         Future<UpdateReportAcknowledgementsResponse> response = asyncExecutor.submit(new Callable<UpdateReportAcknowledgementsResponse>() {
  235.  
  236.             public UpdateReportAcknowledgementsResponse call() throws MarketplaceWebServiceException {
  237.                 return updateReportAcknowledgements(request);
  238.             }
  239.             });
  240.         return response;
  241.     }
  242.        
  243.     /**
  244.      * Submit Feed
  245.      *
  246.      * Uploads a file for processing together with the necessary
  247.      * metadata to process the file, such as which type of feed it is.
  248.      * PurgeAndReplace if true means that your existing e.g. inventory is
  249.      * wiped out and replace with the contents of this feed - use with
  250.      * caution (the default is false).
  251.      *  
  252.      * @param request
  253.      *          SubmitFeed Action
  254.      * @return
  255.      *          SubmitFeed Response from the service
  256.      *
  257.      * @throws MarketplaceWebServiceException
  258.      */
  259.     public SubmitFeedResponse submitFeed(SubmitFeedRequest request)
  260.         throws MarketplaceWebServiceException {
  261.         SubmitFeedResponse response;
  262.         try {
  263.             response = (SubmitFeedResponse)getUnmarshaller().unmarshal
  264.                     (new InputSource(this.getClass().getResourceAsStream("SubmitFeedResponse.xml")));
  265.  
  266.             log.debug("Response from Mock Service: " + response.toXML());
  267.            
  268.         } catch (JAXBException jbe) {
  269.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  270.         }
  271.         return response;
  272.     }
  273.  
  274.     public Future<SubmitFeedResponse> submitFeedAsync(final
  275. SubmitFeedRequest request) {
  276.         Future<SubmitFeedResponse> response = asyncExecutor.submit(new Callable<SubmitFeedResponse>() {
  277.  
  278.             public SubmitFeedResponse call() throws MarketplaceWebServiceException {
  279.                 return submitFeed(request);
  280.             }
  281.             });
  282.         return response;
  283.     }
  284.    
  285.     /**
  286.      * Submit Feed From File
  287.      *
  288.      * Uploads a file from disk for processing together with the necessary
  289.      * metadata to process the file, such as which type of feed it is.
  290.      * PurgeAndReplace if true means that your existing e.g. inventory is
  291.      * wiped out and replace with the contents of this feed - use with
  292.      * caution (the default is false).
  293.      *
  294.      * This function assumes the Content MD5 value is unset in the request, and will
  295.      * set it before making the Submit Feed request. The Feed Content must be stored
  296.      * on disk, as the assumption is that the content is accessed through
  297.      * a FileInputStream.
  298.      *
  299.      * @param request
  300.      *          SubmitFeedRequest request without the contentMd5 field set.
  301.      * @return
  302.      *          SubmitFeed Response from the service
  303.      *
  304.      * @throws MarketplaceWebServiceException
  305.      */
  306.     public SubmitFeedResponse submitFeedFromFile(SubmitFeedRequest request)
  307.         throws MarketplaceWebServiceException {
  308.         SubmitFeedResponse response;
  309.         try {
  310.             response = (SubmitFeedResponse)getUnmarshaller().unmarshal
  311.                     (new InputSource(this.getClass().getResourceAsStream("SubmitFeedResponse.xml")));
  312.  
  313.             log.debug("Response from Mock Service: " + response.toXML());
  314.            
  315.         } catch (JAXBException jbe) {
  316.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  317.         }
  318.         return response;
  319.     }
  320.  
  321.     public Future<SubmitFeedResponse> submitFeedFromFileAsync(final
  322. SubmitFeedRequest request) {
  323.         Future<SubmitFeedResponse> response = asyncExecutor.submit(new Callable<SubmitFeedResponse>() {
  324.  
  325.             public SubmitFeedResponse call() throws MarketplaceWebServiceException {
  326.                 return submitFeed(request);
  327.             }
  328.             });
  329.         return response;
  330.     }
  331.        
  332.     /**
  333.      * Get Report Count
  334.      *
  335.      * returns a count of reports matching your criteria;
  336.      * by default, the number of reports generated in the last 90 days,
  337.      * regardless of acknowledgement status
  338.      *  
  339.      * @param request
  340.      *          GetReportCount Action
  341.      * @return
  342.      *          GetReportCount Response from the service
  343.      *
  344.      * @throws MarketplaceWebServiceException
  345.      */
  346.     public GetReportCountResponse getReportCount(GetReportCountRequest request)
  347.         throws MarketplaceWebServiceException {
  348.         GetReportCountResponse response;
  349.         try {
  350.             response = (GetReportCountResponse)getUnmarshaller().unmarshal
  351.                     (new InputSource(this.getClass().getResourceAsStream("GetReportCountResponse.xml")));
  352.  
  353.             log.debug("Response from Mock Service: " + response.toXML());
  354.            
  355.         } catch (JAXBException jbe) {
  356.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  357.         }
  358.         return response;
  359.     }
  360.  
  361.     public Future<GetReportCountResponse> getReportCountAsync(final
  362. GetReportCountRequest request) {
  363.         Future<GetReportCountResponse> response = asyncExecutor.submit(new Callable<GetReportCountResponse>() {
  364.  
  365.             public GetReportCountResponse call() throws MarketplaceWebServiceException {
  366.                 return getReportCount(request);
  367.             }
  368.             });
  369.         return response;
  370.     }
  371.        
  372.     /**
  373.      * Get Feed Submission List By Next Token
  374.      *
  375.      * retrieve the next batch of list items and if there are more items to retrieve
  376.      *  
  377.      * @param request
  378.      *          GetFeedSubmissionListByNextToken Action
  379.      * @return
  380.      *          GetFeedSubmissionListByNextToken Response from the service
  381.      *
  382.      * @throws MarketplaceWebServiceException
  383.      */
  384.     public GetFeedSubmissionListByNextTokenResponse getFeedSubmissionListByNextToken(GetFeedSubmissionListByNextTokenRequest request)
  385.         throws MarketplaceWebServiceException {
  386.         GetFeedSubmissionListByNextTokenResponse response;
  387.         try {
  388.             response = (GetFeedSubmissionListByNextTokenResponse)getUnmarshaller().unmarshal
  389.                     (new InputSource(this.getClass().getResourceAsStream("GetFeedSubmissionListByNextTokenResponse.xml")));
  390.  
  391.             log.debug("Response from Mock Service: " + response.toXML());
  392.            
  393.         } catch (JAXBException jbe) {
  394.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  395.         }
  396.         return response;
  397.     }
  398.  
  399.     public Future<GetFeedSubmissionListByNextTokenResponse> getFeedSubmissionListByNextTokenAsync(final
  400. GetFeedSubmissionListByNextTokenRequest request) {
  401.         Future<GetFeedSubmissionListByNextTokenResponse> response = asyncExecutor.submit(new Callable<GetFeedSubmissionListByNextTokenResponse>() {
  402.  
  403.             public GetFeedSubmissionListByNextTokenResponse call() throws MarketplaceWebServiceException {
  404.                 return getFeedSubmissionListByNextToken(request);
  405.             }
  406.             });
  407.         return response;
  408.     }
  409.        
  410.     /**
  411.      * Cancel Feed Submissions
  412.      *
  413.      * cancels feed submissions - by default all of the submissions of the
  414.      * last 30 days that have not started processing
  415.      *  
  416.      * @param request
  417.      *          CancelFeedSubmissions Action
  418.      * @return
  419.      *          CancelFeedSubmissions Response from the service
  420.      *
  421.      * @throws MarketplaceWebServiceException
  422.      */
  423.     public CancelFeedSubmissionsResponse cancelFeedSubmissions(CancelFeedSubmissionsRequest request)
  424.         throws MarketplaceWebServiceException {
  425.         CancelFeedSubmissionsResponse response;
  426.         try {
  427.             response = (CancelFeedSubmissionsResponse)getUnmarshaller().unmarshal
  428.                     (new InputSource(this.getClass().getResourceAsStream("CancelFeedSubmissionsResponse.xml")));
  429.  
  430.             log.debug("Response from Mock Service: " + response.toXML());
  431.            
  432.         } catch (JAXBException jbe) {
  433.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  434.         }
  435.         return response;
  436.     }
  437.  
  438.     public Future<CancelFeedSubmissionsResponse> cancelFeedSubmissionsAsync(final
  439. CancelFeedSubmissionsRequest request) {
  440.         Future<CancelFeedSubmissionsResponse> response = asyncExecutor.submit(new Callable<CancelFeedSubmissionsResponse>() {
  441.  
  442.             public CancelFeedSubmissionsResponse call() throws MarketplaceWebServiceException {
  443.                 return cancelFeedSubmissions(request);
  444.             }
  445.             });
  446.         return response;
  447.     }
  448.        
  449.     /**
  450.      * Request Report
  451.      *
  452.      * requests the generation of a report
  453.      *  
  454.      * @param request
  455.      *          RequestReport Action
  456.      * @return
  457.      *          RequestReport Response from the service
  458.      *
  459.      * @throws MarketplaceWebServiceException
  460.      */
  461.     public RequestReportResponse requestReport(RequestReportRequest request)
  462.         throws MarketplaceWebServiceException {
  463.         RequestReportResponse response;
  464.         try {
  465.             response = (RequestReportResponse)getUnmarshaller().unmarshal
  466.                     (new InputSource(this.getClass().getResourceAsStream("RequestReportResponse.xml")));
  467.  
  468.             log.debug("Response from Mock Service: " + response.toXML());
  469.            
  470.         } catch (JAXBException jbe) {
  471.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  472.         }
  473.         return response;
  474.     }
  475.  
  476.     public Future<RequestReportResponse> requestReportAsync(final
  477. RequestReportRequest request) {
  478.         Future<RequestReportResponse> response = asyncExecutor.submit(new Callable<RequestReportResponse>() {
  479.  
  480.             public RequestReportResponse call() throws MarketplaceWebServiceException {
  481.                 return requestReport(request);
  482.             }
  483.             });
  484.         return response;
  485.     }
  486.        
  487.     /**
  488.      * Get Feed Submission Count
  489.      *
  490.      * returns the number of feeds matching all of the specified criteria
  491.      *  
  492.      * @param request
  493.      *          GetFeedSubmissionCount Action
  494.      * @return
  495.      *          GetFeedSubmissionCount Response from the service
  496.      *
  497.      * @throws MarketplaceWebServiceException
  498.      */
  499.     public GetFeedSubmissionCountResponse getFeedSubmissionCount(GetFeedSubmissionCountRequest request)
  500.         throws MarketplaceWebServiceException {
  501.         GetFeedSubmissionCountResponse response;
  502.         try {
  503.             response = (GetFeedSubmissionCountResponse)getUnmarshaller().unmarshal
  504.                     (new InputSource(this.getClass().getResourceAsStream("GetFeedSubmissionCountResponse.xml")));
  505.  
  506.             log.debug("Response from Mock Service: " + response.toXML());
  507.            
  508.         } catch (JAXBException jbe) {
  509.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  510.         }
  511.         return response;
  512.     }
  513.  
  514.     public Future<GetFeedSubmissionCountResponse> getFeedSubmissionCountAsync(final
  515. GetFeedSubmissionCountRequest request) {
  516.         Future<GetFeedSubmissionCountResponse> response = asyncExecutor.submit(new Callable<GetFeedSubmissionCountResponse>() {
  517.  
  518.             public GetFeedSubmissionCountResponse call() throws MarketplaceWebServiceException {
  519.                 return getFeedSubmissionCount(request);
  520.             }
  521.             });
  522.         return response;
  523.     }
  524.        
  525.     /**
  526.      * Cancel Report Requests
  527.      *
  528.      * cancels report requests that have not yet started processing,
  529.      * by default all those within the last 90 days
  530.      *  
  531.      * @param request
  532.      *          CancelReportRequests Action
  533.      * @return
  534.      *          CancelReportRequests Response from the service
  535.      *
  536.      * @throws MarketplaceWebServiceException
  537.      */
  538.     public CancelReportRequestsResponse cancelReportRequests(CancelReportRequestsRequest request)
  539.         throws MarketplaceWebServiceException {
  540.         CancelReportRequestsResponse response;
  541.         try {
  542.             response = (CancelReportRequestsResponse)getUnmarshaller().unmarshal
  543.                     (new InputSource(this.getClass().getResourceAsStream("CancelReportRequestsResponse.xml")));
  544.  
  545.             log.debug("Response from Mock Service: " + response.toXML());
  546.            
  547.         } catch (JAXBException jbe) {
  548.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  549.         }
  550.         return response;
  551.     }
  552.  
  553.     public Future<CancelReportRequestsResponse> cancelReportRequestsAsync(final
  554. CancelReportRequestsRequest request) {
  555.         Future<CancelReportRequestsResponse> response = asyncExecutor.submit(new Callable<CancelReportRequestsResponse>() {
  556.  
  557.             public CancelReportRequestsResponse call() throws MarketplaceWebServiceException {
  558.                 return cancelReportRequests(request);
  559.             }
  560.             });
  561.         return response;
  562.     }
  563.        
  564.     /**
  565.      * Get Report List
  566.      *
  567.      * returns a list of reports; by default the most recent ten reports,
  568.      * regardless of their acknowledgement status
  569.      *  
  570.      * @param request
  571.      *          GetReportList Action
  572.      * @return
  573.      *          GetReportList Response from the service
  574.      *
  575.      * @throws MarketplaceWebServiceException
  576.      */
  577.     public GetReportListResponse getReportList(GetReportListRequest request)
  578.         throws MarketplaceWebServiceException {
  579.         GetReportListResponse response;
  580.         try {
  581.             response = (GetReportListResponse)getUnmarshaller().unmarshal
  582.                     (new InputSource(this.getClass().getResourceAsStream("GetReportListResponse.xml")));
  583.  
  584.             log.debug("Response from Mock Service: " + response.toXML());
  585.            
  586.         } catch (JAXBException jbe) {
  587.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  588.         }
  589.         return response;
  590.     }
  591.  
  592.     public Future<GetReportListResponse> getReportListAsync(final
  593. GetReportListRequest request) {
  594.         Future<GetReportListResponse> response = asyncExecutor.submit(new Callable<GetReportListResponse>() {
  595.  
  596.             public GetReportListResponse call() throws MarketplaceWebServiceException {
  597.                 return getReportList(request);
  598.             }
  599.             });
  600.         return response;
  601.     }
  602.        
  603.     /**
  604.      * Get Feed Submission Result
  605.      *
  606.      * retrieves the feed processing report
  607.      *  
  608.      * @param request
  609.      *          GetFeedSubmissionResult Action
  610.      * @return
  611.      *          GetFeedSubmissionResult Response from the service
  612.      *
  613.      * @throws MarketplaceWebServiceException
  614.      */
  615.     public GetFeedSubmissionResultResponse getFeedSubmissionResult(GetFeedSubmissionResultRequest request)
  616.         throws MarketplaceWebServiceException {
  617.         GetFeedSubmissionResultResponse response;
  618.         try {
  619.             response = (GetFeedSubmissionResultResponse)getUnmarshaller().unmarshal
  620.                     (new InputSource(this.getClass().getResourceAsStream("GetFeedSubmissionResultResponse.xml")));
  621.  
  622.             log.debug("Response from Mock Service: " + response.toXML());
  623.            
  624.         } catch (JAXBException jbe) {
  625.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  626.         }
  627.         return response;
  628.     }
  629.  
  630.     public Future<GetFeedSubmissionResultResponse> getFeedSubmissionResultAsync(final
  631. GetFeedSubmissionResultRequest request) {
  632.         Future<GetFeedSubmissionResultResponse> response = asyncExecutor.submit(new Callable<GetFeedSubmissionResultResponse>() {
  633.  
  634.             public GetFeedSubmissionResultResponse call() throws MarketplaceWebServiceException {
  635.                 return getFeedSubmissionResult(request);
  636.             }
  637.             });
  638.         return response;
  639.     }
  640.        
  641.     /**
  642.      * Get Feed Submission List
  643.      *
  644.      * returns a list of feed submission identifiers and their associated metadata
  645.      *  
  646.      * @param request
  647.      *          GetFeedSubmissionList Action
  648.      * @return
  649.      *          GetFeedSubmissionList Response from the service
  650.      *
  651.      * @throws MarketplaceWebServiceException
  652.      */
  653.     public GetFeedSubmissionListResponse getFeedSubmissionList(GetFeedSubmissionListRequest request)
  654.         throws MarketplaceWebServiceException {
  655.         GetFeedSubmissionListResponse response;
  656.         try {
  657.             response = (GetFeedSubmissionListResponse)getUnmarshaller().unmarshal
  658.                     (new InputSource(this.getClass().getResourceAsStream("GetFeedSubmissionListResponse.xml")));
  659.  
  660.             log.debug("Response from Mock Service: " + response.toXML());
  661.            
  662.         } catch (JAXBException jbe) {
  663.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  664.         }
  665.         return response;
  666.     }
  667.  
  668.     public Future<GetFeedSubmissionListResponse> getFeedSubmissionListAsync(final
  669. GetFeedSubmissionListRequest request) {
  670.         Future<GetFeedSubmissionListResponse> response = asyncExecutor.submit(new Callable<GetFeedSubmissionListResponse>() {
  671.  
  672.             public GetFeedSubmissionListResponse call() throws MarketplaceWebServiceException {
  673.                 return getFeedSubmissionList(request);
  674.             }
  675.             });
  676.         return response;
  677.     }
  678.        
  679.     /**
  680.      * Get Report Request List
  681.      *
  682.      * returns a list of report requests ids and their associated metadata
  683.      *  
  684.      * @param request
  685.      *          GetReportRequestList Action
  686.      * @return
  687.      *          GetReportRequestList Response from the service
  688.      *
  689.      * @throws MarketplaceWebServiceException
  690.      */
  691.     public GetReportRequestListResponse getReportRequestList(GetReportRequestListRequest request)
  692.         throws MarketplaceWebServiceException {
  693.         GetReportRequestListResponse response;
  694.         try {
  695.             response = (GetReportRequestListResponse)getUnmarshaller().unmarshal
  696.                     (new InputSource(this.getClass().getResourceAsStream("GetReportRequestListResponse.xml")));
  697.  
  698.             log.debug("Response from Mock Service: " + response.toXML());
  699.            
  700.         } catch (JAXBException jbe) {
  701.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  702.         }
  703.         return response;
  704.     }
  705.  
  706.     public Future<GetReportRequestListResponse> getReportRequestListAsync(final
  707. GetReportRequestListRequest request) {
  708.         Future<GetReportRequestListResponse> response = asyncExecutor.submit(new Callable<GetReportRequestListResponse>() {
  709.  
  710.             public GetReportRequestListResponse call() throws MarketplaceWebServiceException {
  711.                 return getReportRequestList(request);
  712.             }
  713.             });
  714.         return response;
  715.     }
  716.        
  717.     /**
  718.      * Get Report Schedule List By Next Token
  719.      *
  720.      * retrieve the next batch of list items and if there are more items to retrieve
  721.      *  
  722.      * @param request
  723.      *          GetReportScheduleListByNextToken Action
  724.      * @return
  725.      *          GetReportScheduleListByNextToken Response from the service
  726.      *
  727.      * @throws MarketplaceWebServiceException
  728.      */
  729.     public GetReportScheduleListByNextTokenResponse getReportScheduleListByNextToken(GetReportScheduleListByNextTokenRequest request)
  730.         throws MarketplaceWebServiceException {
  731.         GetReportScheduleListByNextTokenResponse response;
  732.         try {
  733.             response = (GetReportScheduleListByNextTokenResponse)getUnmarshaller().unmarshal
  734.                     (new InputSource(this.getClass().getResourceAsStream("GetReportScheduleListByNextTokenResponse.xml")));
  735.  
  736.             log.debug("Response from Mock Service: " + response.toXML());
  737.            
  738.         } catch (JAXBException jbe) {
  739.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  740.         }
  741.         return response;
  742.     }
  743.  
  744.     public Future<GetReportScheduleListByNextTokenResponse> getReportScheduleListByNextTokenAsync(final
  745. GetReportScheduleListByNextTokenRequest request) {
  746.         Future<GetReportScheduleListByNextTokenResponse> response = asyncExecutor.submit(new Callable<GetReportScheduleListByNextTokenResponse>() {
  747.  
  748.             public GetReportScheduleListByNextTokenResponse call() throws MarketplaceWebServiceException {
  749.                 return getReportScheduleListByNextToken(request);
  750.             }
  751.             });
  752.         return response;
  753.     }
  754.        
  755.     /**
  756.      * Get Report List By Next Token
  757.      *
  758.      * retrieve the next batch of list items and if there are more items to retrieve
  759.      *  
  760.      * @param request
  761.      *          GetReportListByNextToken Action
  762.      * @return
  763.      *          GetReportListByNextToken Response from the service
  764.      *
  765.      * @throws MarketplaceWebServiceException
  766.      */
  767.     public GetReportListByNextTokenResponse getReportListByNextToken(GetReportListByNextTokenRequest request)
  768.         throws MarketplaceWebServiceException {
  769.         GetReportListByNextTokenResponse response;
  770.         try {
  771.             response = (GetReportListByNextTokenResponse)getUnmarshaller().unmarshal
  772.                     (new InputSource(this.getClass().getResourceAsStream("GetReportListByNextTokenResponse.xml")));
  773.  
  774.             log.debug("Response from Mock Service: " + response.toXML());
  775.            
  776.         } catch (JAXBException jbe) {
  777.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  778.         }
  779.         return response;
  780.     }
  781.  
  782.     public Future<GetReportListByNextTokenResponse> getReportListByNextTokenAsync(final
  783. GetReportListByNextTokenRequest request) {
  784.         Future<GetReportListByNextTokenResponse> response = asyncExecutor.submit(new Callable<GetReportListByNextTokenResponse>() {
  785.  
  786.             public GetReportListByNextTokenResponse call() throws MarketplaceWebServiceException {
  787.                 return getReportListByNextToken(request);
  788.             }
  789.             });
  790.         return response;
  791.     }
  792.        
  793.     /**
  794.      * Manage Report Schedule
  795.      *
  796.      * Creates, updates, or deletes a report schedule
  797.      * for a given report type, such as order reports in particular.
  798.      *  
  799.      * @param request
  800.      *          ManageReportSchedule Action
  801.      * @return
  802.      *          ManageReportSchedule Response from the service
  803.      *
  804.      * @throws MarketplaceWebServiceException
  805.      */
  806.     public ManageReportScheduleResponse manageReportSchedule(ManageReportScheduleRequest request)
  807.         throws MarketplaceWebServiceException {
  808.         ManageReportScheduleResponse response;
  809.         try {
  810.             response = (ManageReportScheduleResponse)getUnmarshaller().unmarshal
  811.                     (new InputSource(this.getClass().getResourceAsStream("ManageReportScheduleResponse.xml")));
  812.  
  813.             log.debug("Response from Mock Service: " + response.toXML());
  814.            
  815.         } catch (JAXBException jbe) {
  816.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  817.         }
  818.         return response;
  819.     }
  820.  
  821.     public Future<ManageReportScheduleResponse> manageReportScheduleAsync(final
  822. ManageReportScheduleRequest request) {
  823.         Future<ManageReportScheduleResponse> response = asyncExecutor.submit(new Callable<ManageReportScheduleResponse>() {
  824.  
  825.             public ManageReportScheduleResponse call() throws MarketplaceWebServiceException {
  826.                 return manageReportSchedule(request);
  827.             }
  828.             });
  829.         return response;
  830.     }
  831.        
  832.     /**
  833.      * Get Report Request Count
  834.      *
  835.      * returns a count of report requests; by default all the report
  836.      * requests in the last 90 days
  837.      *  
  838.      * @param request
  839.      *          GetReportRequestCount Action
  840.      * @return
  841.      *          GetReportRequestCount Response from the service
  842.      *
  843.      * @throws MarketplaceWebServiceException
  844.      */
  845.     public GetReportRequestCountResponse getReportRequestCount(GetReportRequestCountRequest request)
  846.         throws MarketplaceWebServiceException {
  847.         GetReportRequestCountResponse response;
  848.         try {
  849.             response = (GetReportRequestCountResponse)getUnmarshaller().unmarshal
  850.                     (new InputSource(this.getClass().getResourceAsStream("GetReportRequestCountResponse.xml")));
  851.  
  852.             log.debug("Response from Mock Service: " + response.toXML());
  853.            
  854.         } catch (JAXBException jbe) {
  855.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  856.         }
  857.         return response;
  858.     }
  859.  
  860.     public Future<GetReportRequestCountResponse> getReportRequestCountAsync(final
  861. GetReportRequestCountRequest request) {
  862.         Future<GetReportRequestCountResponse> response = asyncExecutor.submit(new Callable<GetReportRequestCountResponse>() {
  863.  
  864.             public GetReportRequestCountResponse call() throws MarketplaceWebServiceException {
  865.                 return getReportRequestCount(request);
  866.             }
  867.             });
  868.         return response;
  869.     }
  870.        
  871.     /**
  872.      * Get Report Schedule List
  873.      *
  874.      * returns the list of report schedules
  875.      *  
  876.      * @param request
  877.      *          GetReportScheduleList Action
  878.      * @return
  879.      *          GetReportScheduleList Response from the service
  880.      *
  881.      * @throws MarketplaceWebServiceException
  882.      */
  883.     public GetReportScheduleListResponse getReportScheduleList(GetReportScheduleListRequest request)
  884.         throws MarketplaceWebServiceException {
  885.         GetReportScheduleListResponse response;
  886.         try {
  887.             response = (GetReportScheduleListResponse)getUnmarshaller().unmarshal
  888.                     (new InputSource(this.getClass().getResourceAsStream("GetReportScheduleListResponse.xml")));
  889.  
  890.             log.debug("Response from Mock Service: " + response.toXML());
  891.            
  892.         } catch (JAXBException jbe) {
  893.             throw new MarketplaceWebServiceException("Unable to process mock response", jbe);
  894.         }
  895.         return response;
  896.     }
  897.  
  898.     public Future<GetReportScheduleListResponse> getReportScheduleListAsync(final
  899. GetReportScheduleListRequest request) {
  900.         Future<GetReportScheduleListResponse> response = asyncExecutor.submit(new Callable<GetReportScheduleListResponse>() {
  901.  
  902.             public GetReportScheduleListResponse call() throws MarketplaceWebServiceException {
  903.                 return getReportScheduleList(request);
  904.             }
  905.             });
  906.         return response;
  907.     }
  908.  
  909.     /**
  910.      * Get unmarshaller for current thread
  911.      */
  912.     private Unmarshaller getUnmarshaller() {
  913.         return unmarshaller.get();
  914.     }
  915. }