celeboss.HTMLload
Class HTMLDataSource

java.lang.Object
  extended byceleboss.HTMLload.HTMLDataSource
All Implemented Interfaces:
CelebDataSource
Direct Known Subclasses:
WebDataSource

public abstract class HTMLDataSource
extends java.lang.Object
implements CelebDataSource

This is an abstract data source based on HTML repsentation of the CelebDaq data. The actual generation of the HTML streams are provided by the implementation of the subclass.

Version:
1.0
Author:
bevans

Constructor Summary
protected HTMLDataSource(java.lang.String username)
          Create a basic HTML parser associated to the specifiec username.
 
Method Summary
 java.util.Set getCelebrities()
          Extract the list of known celebrity issue numbers from web server.
protected abstract  java.io.InputStream getCelebrityStream(int celebrityId)
          This method return a HTML stream detailing the celebrity associated to the issue number.
protected abstract  java.io.InputStream getLeagueOfLeagueStream(int leagueId)
          Returns a HTML stream detailing the League of League value for the specified league.
 java.util.Set getLeagues()
          Extract the list of Mini leagues this user is a member.
protected abstract  java.io.InputStream getLeaguesStream()
          This method return a HTML stream detailing the mini-leagues this account is a member.
protected abstract  java.io.InputStream getLeagueStream(int leagueID)
          This method return a HTML stream for a mini-leagues.
protected abstract  java.io.InputStream getPortfolioStream()
          This method return a HTML stream detailing the portfolio associated to the user account.
 java.lang.String getUsername()
          Get the name of the user associated to this source.
 void setUserPassword(java.lang.String user, java.lang.String password)
          Update teh username and password assigned to this datasource
 void updateCelebrity(Celebrity celeb)
          This method updates the specified Celebrity details with the associated data source.
 void updateLeague(MiniLeague league)
          Update the specified league.
 void updatePortfolio(Portfolio portfolio)
          Update the specified portfolio using this data source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface celeboss.CelebDataSource
buyShares, isLive, sellShares
 

Constructor Detail

HTMLDataSource

protected HTMLDataSource(java.lang.String username)
Create a basic HTML parser associated to the specifiec username.

Parameters:
username - Name of new user.
Method Detail

getCelebrities

public java.util.Set getCelebrities()
                             throws java.io.IOException
Extract the list of known celebrity issue numbers from web server. THis uses the portfolio description of the user as the source.

Specified by:
getCelebrities in interface CelebDataSource
Returns:
Array of celebrity issue numbers; null is returned if a problem occurs.
Throws:
java.io.IOException - Problem contacting server

getCelebrityStream

protected abstract java.io.InputStream getCelebrityStream(int celebrityId)
                                                   throws java.io.IOException
This method return a HTML stream detailing the celebrity associated to the issue number.

Parameters:
celebrityId - Celebrity issue number.
Returns:
InputStream of html.
Throws:
java.io.IOException - Problem generating stream.

getLeagueOfLeagueStream

protected abstract java.io.InputStream getLeagueOfLeagueStream(int leagueId)
                                                        throws java.io.IOException
Returns a HTML stream detailing the League of League value for the specified league.

Parameters:
leagueId - Identifier of the league
Returns:
Stream holding the best HTML page containing league
Throws:
java.io.IOException

getLeagues

public java.util.Set getLeagues()
                         throws java.io.IOException
Extract the list of Mini leagues this user is a member. Returned is a set of issue numbers from web server.

Specified by:
getLeagues in interface CelebDataSource
Returns:
Array of league issue numbers.
Throws:
java.io.IOException - Problem contacting server

getLeaguesStream

protected abstract java.io.InputStream getLeaguesStream()
                                                 throws java.io.IOException
This method return a HTML stream detailing the mini-leagues this account is a member.

Returns:
InputStream of html.
Throws:
java.io.IOException - Problem generating stream.

getLeagueStream

protected abstract java.io.InputStream getLeagueStream(int leagueID)
                                                throws java.io.IOException
This method return a HTML stream for a mini-leagues.

Parameters:
leagueID - League to get stream for.
Returns:
InputStream of html.
Throws:
java.io.IOException - Problem generating stream.

getPortfolioStream

protected abstract java.io.InputStream getPortfolioStream()
                                                   throws java.io.IOException
This method return a HTML stream detailing the portfolio associated to the user account.

Returns:
InputStream of html.
Throws:
java.io.IOException - Problem generating stream.

getUsername

public java.lang.String getUsername()
Get the name of the user associated to this source.

Specified by:
getUsername in interface CelebDataSource
Returns:
Username.

setUserPassword

public void setUserPassword(java.lang.String user,
                            java.lang.String password)
Update teh username and password assigned to this datasource

Specified by:
setUserPassword in interface CelebDataSource
Parameters:
user - New user
password - New Password

updateCelebrity

public void updateCelebrity(Celebrity celeb)
                     throws java.io.IOException
This method updates the specified Celebrity details with the associated data source.

Specified by:
updateCelebrity in interface CelebDataSource
Parameters:
celeb - Entity to update.
Throws:
java.io.IOException - Problem contacting server

updateLeague

public void updateLeague(MiniLeague league)
                  throws java.io.IOException
Update the specified league.

Specified by:
updateLeague in interface CelebDataSource
Parameters:
league - League identifier.
Throws:
java.io.IOException - Problem contacting server

updatePortfolio

public void updatePortfolio(Portfolio portfolio)
                     throws java.io.IOException
Update the specified portfolio using this data source.

Specified by:
updatePortfolio in interface CelebDataSource
Parameters:
portfolio - Portfolio to update.
Throws:
java.io.IOException - Problem contacting server