Class Amazon

    • Constructor Detail

      • Amazon

        public Amazon()
        No arg constructor. Defaults to system locale.
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: Charts
        Name of this chart provider.
        Specified by:
        getName in interface Charts
        Returns:
        chart provider name
      • getCharts

        public List<PlayList> getCharts​(Locale market)
                                 throws IOException
        Description copied from interface: Charts
        Fetch charts in the form of PlayLists for the given Locale. These lists may be specific to genre or other properties.
        Specified by:
        getCharts in interface Charts
        Parameters:
        market - locale market to use for lookup, if the implementation supports localization
        Returns:
        list of charts
        Throws:
        IOException
      • addPropertyChangeListener

        public void addPropertyChangeListener​(String propertyName,
                                              PropertyChangeListener propertyChangeListener)
        Add property change listener.
        Parameters:
        propertyName - property name
        propertyChangeListener - listener
      • removePropertyChangeListener

        public void removePropertyChangeListener​(String propertyName,
                                                 PropertyChangeListener propertyChangeListener)
        Remove property change listener.
        Parameters:
        propertyName - property name
        propertyChangeListener - listener
      • getLocale

        public Locale getLocale()
      • browseNodeLookup

        public com.amazon.webservices.awseCommerceService.BrowseNodeLookupResponse browseNodeLookup​(BrowseNode browseNode,
                                                                                                    long maximumAge,
                                                                                                    TimeUnit timeUnit)
                                                                                             throws IOException,
                                                                                                    javax.xml.bind.DataBindingException
        Looks up browsenode.
        Parameters:
        browseNode - browsenode
        maximumAge - max age
        timeUnit - max age time unit
        Returns:
        response
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • browseNodeLookup

        public com.amazon.webservices.awseCommerceService.BrowseNodeLookupResponse browseNodeLookup​(long browseNodeId,
                                                                                                    long maximumAge,
                                                                                                    TimeUnit timeUnit)
                                                                                             throws IOException
        Looks up browsenode.
        Parameters:
        browseNodeId - browsenode id
        maximumAge - max age
        timeUnit - max age time unit
        Returns:
        response
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • getGenreBrowseNodes

        public List<BrowseNode> getGenreBrowseNodes()
                                             throws IOException
        Get the genre browse nodes for the currently configured locale.
        Returns:
        list of genres
        Throws:
        IOException
      • writeGenreBrowseNodes

        public void writeGenreBrowseNodes​(Path path)
                                   throws IOException,
                                          javax.xml.bind.DataBindingException
        Dump genre browse nodes to a file.
        Parameters:
        path - file
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • writeGenreBrowseNodes

        public void writeGenreBrowseNodes()
                                   throws IOException,
                                          javax.xml.bind.DataBindingException
        Dump genre browse nodes to a file called "browsenode_[locale].txt".
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • itemSearch

        public com.amazon.webservices.awseCommerceService.ItemSearchResponse itemSearch​(String keywords)
                                                                                 throws IOException,
                                                                                        javax.xml.bind.DataBindingException
        Searches in SearchIndex Music for items which match the given keywords.
        Parameters:
        keywords - String that contains keywords
        Returns:
        search result
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • itemSearchJAXB

        public com.amazon.webservices.awseCommerceService.ItemSearchResponse itemSearchJAXB​(String keywords)
                                                                                     throws IOException,
                                                                                            javax.xml.bind.DataBindingException
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • itemSearch

        public com.amazon.webservices.awseCommerceService.ItemSearchResponse itemSearch​(String searchIndex,
                                                                                        String keywords)
                                                                                 throws IOException,
                                                                                        javax.xml.bind.DataBindingException
        Searches in a given SearchIndex for items which match the given keywords.
        Parameters:
        searchIndex - search index like "Music" or "MP3Downloads"
        keywords - String that contains keywords
        Returns:
        search result
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • itemSearchJAXB

        public com.amazon.webservices.awseCommerceService.ItemSearchResponse itemSearchJAXB​(String searchIndex,
                                                                                            String keywords)
                                                                                     throws IOException,
                                                                                            javax.xml.bind.DataBindingException
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • itemSearchTopSellers

        public com.amazon.webservices.awseCommerceService.ItemSearchResponse itemSearchTopSellers​(BrowseNode browseNode,
                                                                                                  int page)
                                                                                           throws IOException,
                                                                                                  javax.xml.bind.DataBindingException
        ItemSearch in a Music search index, result ordered by salesrank.
        Parameters:
        browseNode - browsenode in which to search
        page - result page to return
        Returns:
        result
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • itemSearchTopSellers

        public com.amazon.webservices.awseCommerceService.ItemSearchResponse itemSearchTopSellers​(String searchIndex,
                                                                                                  BrowseNode browseNode,
                                                                                                  int page)
                                                                                           throws IOException,
                                                                                                  javax.xml.bind.DataBindingException
        ItemSearch, result ordered by salesrank.
        Parameters:
        searchIndex - usually "Music", but values like "MP3Downloads" should also be possible (for the US at least).
        browseNode - browsenode in which to search
        page - result page to return
        Returns:
        result
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • getMusicAlbum

        public com.amazon.webservices.awseCommerceService.ItemSearchResponse getMusicAlbum​(String artist,
                                                                                           String title)
                                                                                    throws IOException,
                                                                                           javax.xml.bind.DataBindingException
        ItemSearch for Music matching an encodedArtist/encodedTitle.
        Parameters:
        artist - encodedArtist or null, if not significant
        title - encodedTitle or null, if not significant
        Returns:
        matching articles
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • getMP3DownloadsAlbum

        public com.amazon.webservices.awseCommerceService.ItemSearchResponse getMP3DownloadsAlbum​(String artist,
                                                                                                  String title)
                                                                                           throws IOException,
                                                                                                  javax.xml.bind.DataBindingException
        ItemSearch for MP3Downloads matching an encodedArtist/encodedTitle.
        Parameters:
        artist - encodedArtist or null, if not significant
        title - encodedTitle or null, if not significant
        Returns:
        matching articles
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • getTitle

        public com.amazon.webservices.awseCommerceService.ItemSearchResponse getTitle​(String searchIndex,
                                                                                      String title)
                                                                               throws IOException,
                                                                                      javax.xml.bind.DataBindingException
        ItemSearch for an item with the specified title.
        Parameters:
        searchIndex - index to search
        title - encodedTitle
        Returns:
        matching articles
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • similarItemLookup

        public com.amazon.webservices.awseCommerceService.ItemLookupResponse similarItemLookup​(com.amazon.webservices.awseCommerceService.ItemSearchResponse itemSearchResponse)
                                                                                        throws IOException,
                                                                                               javax.xml.bind.DataBindingException
        Look up the similar items from the given item search response.
        Parameters:
        itemSearchResponse - response with similar items
        Returns:
        response
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • itemLookup

        public com.amazon.webservices.awseCommerceService.ItemLookupResponse itemLookup​(String[] asin)
                                                                                 throws IOException,
                                                                                        javax.xml.bind.DataBindingException
        Look up items using their ASINs.
        Parameters:
        asin - array of ASINs
        Returns:
        response
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • itemLookup

        public com.amazon.webservices.awseCommerceService.ItemLookupResponse itemLookup​(String asin)
                                                                                 throws IOException,
                                                                                        javax.xml.bind.DataBindingException
        Look up an item using it's ASIN.
        Parameters:
        asin - an ASIN
        Returns:
        response
        Throws:
        IOException
        javax.xml.bind.DataBindingException
      • cacheResource

        protected boolean cacheResource​(URL url,
                                        byte[] content)
        Description copied from class: WebService
        Allows turning caching for a specific resource and its content on and off.
        Overrides:
        cacheResource in class WebService
        Parameters:
        url - url
        content - resource content
        Returns:
        by default this method returns true
      • useCacheOnly

        protected boolean useCacheOnly​(URL url)
        Description copied from class: WebService
        Allows to suppress the actual request.
        Overrides:
        useCacheOnly in class WebService
        Parameters:
        url - url
        Returns:
        true, if we only want to look stuff up in the cache, but never want to retrieve the actual URL