com.es.skreemr
Class SkreemRSearch

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.es.skreemr.SkreemRSearch
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class SkreemRSearch
extends DefaultHandler

Service uses SkreemR.com to look for songs on the web and returns a list of songs that can be dealt with later

Author:
Keith Blackard

Constructor Summary
SkreemRSearch()
          Creates a new SkreemRSearch Object.
 
Method Summary
 String getLastKeywords()
           
 int getLastPage()
           
 int getLastSize()
           
 List<SkreemRSong> getResults()
           
 List<SkreemRSong> nextPage()
          Continue search on next page, keeps same keywords and size.
 List<SkreemRSong> search(String keyWords, int page)
          Make a new search.
 List<SkreemRSong> search(String keyWords, int size, int page)
          Make a new search.
 void startElement(String namespaceURI, String localName, String name, Attributes atts)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SkreemRSearch

public SkreemRSearch()
Creates a new SkreemRSearch Object. There should at most be one instance.

Method Detail

search

public List<SkreemRSong> search(String keyWords,
                                int size,
                                int page)
                         throws IOException,
                                SAXException
Make a new search.

Parameters:
keyWords - The search parameters.
size - The number of pages of results to be returned.
page - The first page to start at.
Returns:
a list of songs found in search. Maximum size of list equals size * 10
Throws:
IOException
SAXException

search

public List<SkreemRSong> search(String keyWords,
                                int page)
                         throws IOException,
                                SAXException
Make a new search.

Parameters:
keyWords - The search parameters.
page - The first page to start at.
Returns:
a list of songs found in search. Maximum of 10 results in list.
Throws:
IOException
SAXException

nextPage

public List<SkreemRSong> nextPage()
                           throws IOException,
                                  SAXException
Continue search on next page, keeps same keywords and size.

Returns:
a list of songs found in search. Maximum size is based on last search size.
Throws:
IOException
SAXException

getResults

public List<SkreemRSong> getResults()
Returns:
the results of the previous search

getLastKeywords

public String getLastKeywords()
Returns:
the last keyword(s) used

getLastSize

public int getLastSize()
Returns:
the last size of search

getLastPage

public int getLastPage()
Returns:
the last start page

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String name,
                         Attributes atts)
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler


Copyright © 2007-2008. All Rights Reserved.