com.es.skreemr
Class SkreemRSearch

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

public class SkreemRSearch
extends org.xml.sax.helpers.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
 java.lang.String getLastKeywords()
           
 int getLastPage()
           
 int getLastSize()
           
 java.util.List<SkreemRSong> getResults()
           
 java.util.List<SkreemRSong> nextPage()
          Continue search on next page, keeps same keywords and size.
 java.util.List<SkreemRSong> search(java.lang.String keyWords, int page)
          Make a new search.
 java.util.List<SkreemRSong> search(java.lang.String keyWords, int size, int page)
          Make a new search.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String name, org.xml.sax.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 java.util.List<SkreemRSong> search(java.lang.String keyWords,
                                          int size,
                                          int page)
                                   throws java.io.IOException,
                                          org.xml.sax.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:
java.io.IOException
org.xml.sax.SAXException

search

public java.util.List<SkreemRSong> search(java.lang.String keyWords,
                                          int page)
                                   throws java.io.IOException,
                                          org.xml.sax.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:
java.io.IOException
org.xml.sax.SAXException

nextPage

public java.util.List<SkreemRSong> nextPage()
                                     throws java.io.IOException,
                                            org.xml.sax.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:
java.io.IOException
org.xml.sax.SAXException

getResults

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

getLastKeywords

public java.lang.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(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String name,
                         org.xml.sax.Attributes atts)
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler


Copyright © 2007-2009. All Rights Reserved.