nz.ac.waikato.mcennis.rat.parser.xmlHandler
Class LastFMUserExpansion

java.lang.Object
  extended by nz.ac.waikato.mcennis.rat.parser.xmlHandler.LastFMUserExpansion

public class LastFMUserExpansion
extends java.lang.Object

Class for setting up a set of parsers for crawling LastFM or reading XML files downloaded from LastFM. Also is the object responsible for crawling all the files associated with a LastFM username.


Constructor Summary
LastFMUserExpansion()
           
 
Method Summary
static void blockUsername(java.lang.String userName)
          Prevent the given username from being exapnded
 void expandUser(Crawler crawler, java.lang.String username)
          Takes the given username and schedules the parsing of LastFM using this information if this username has not already been scheduled for download or blocked.
 Parser[] setUpParsers(java.io.File toFileDirectory, Graph graph)
          Create the set of parsers for a crawler to parse.
 Parser[] setUpParsers(java.io.File toFileDirectory, Graph graph, java.lang.String[] parserNames)
          Create the set of parsers for a crawler to parse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LastFMUserExpansion

public LastFMUserExpansion()
Method Detail

blockUsername

public static void blockUsername(java.lang.String userName)
Prevent the given username from being exapnded

Parameters:
userName - name to not parse

setUpParsers

public Parser[] setUpParsers(java.io.File toFileDirectory,
                             Graph graph)
Create the set of parsers for a crawler to parse. If the toFileDirectory is set, it saves copies of all files in that directory, otherwise no saving of files is performed. The graph is set as the graph associated with each of the given objects.

Parameters:
toFileDirectory - location to store files or null if no files are to be stored
graph - graph to be used for holding the data generated by the parsers
Returns:
array of parsers for loading into a crawler

setUpParsers

public Parser[] setUpParsers(java.io.File toFileDirectory,
                             Graph graph,
                             java.lang.String[] parserNames)
Create the set of parsers for a crawler to parse. If the toFileDirectory is set, it saves copies of all files in that directory, otherwise no saving of files is performed. The graph is set as the graph associated with each of the given objects. The parser names are derived from the arrayof parser names. This throws an OutOfBounds exception if the number of names does not match the number of parsers created.

Parameters:
toFileDirectory - location to store files or null if no files are to be stored
graph - graph to be used for holding the data generated by the parsers
parserNames - names to use for each of the parsers.
Returns:
array of parsers for loading into a crawler

expandUser

public void expandUser(Crawler crawler,
                       java.lang.String username)
                throws java.net.MalformedURLException,
                       java.io.IOException
Takes the given username and schedules the parsing of LastFM using this information if this username has not already been scheduled for download or blocked.

Parameters:
crawler - crawler for parsing LastFM
username - user whose LastFM data is to be downloaded
Throws:
java.net.MalformedURLException
java.io.IOException