celeboss
Interface CelebDataSource

All Known Implementing Classes:
HTMLDataSource

public interface CelebDataSource

This interface represents a class that can provide a means to update entities in the data model. The data source is scoped to a specific user and password combination.

Version:
1.0
Author:
bevans
See Also:
CelebDataSourceFactory

Method Summary
 java.lang.String buyShares(Celebrity celebrity, int number)
          Buy shares in a Celebrity.
 java.util.Set getCelebrities()
          Return an array of all the visible Celebrities for this data source.
 java.util.Set getLeagues()
          Return an Set of all the Mini League that the assoicated account is a member.
 java.lang.String getUsername()
          Returns the username of the account assoicated to this source.
 boolean isLive()
          Is this data source live; does the load the details directly from the remote Celebdaq server.
 java.lang.String sellShares(Celebrity celebrity, int number)
          Sell shares in a Celebrity.
 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 specific Celebrity with data from the managed source.
 void updateLeague(MiniLeague league)
          This method updates the specific League with data from the managed source.
 void updatePortfolio(Portfolio portfolio)
          This method updates the specific Portfolio with data from the managed source.
 

Method Detail

buyShares

public java.lang.String buyShares(Celebrity celebrity,
                                  int number)
                           throws java.io.IOException
Buy shares in a Celebrity. The portfolio will be updated once the operation is complete.

Parameters:
celebrity - Celebrity to buy
number - Number to buy
Returns:
Description of error condition
Throws:
java.io.IOException - Problem contacting server

getCelebrities

public java.util.Set getCelebrities()
                             throws java.io.IOException
Return an array of all the visible Celebrities for this data source. The result returns the unique issue number for each.

Returns:
A Set of celebrsity issue numbers as Integers.
Throws:
java.io.IOException - Problem contacting server

getLeagues

public java.util.Set getLeagues()
                         throws java.io.IOException
Return an Set of all the Mini League that the assoicated account is a member. The result returns the unique issue number for each.

Returns:
A Set of leagues issue numbers as Integers.
Throws:
java.io.IOException - Problem contacting server

getUsername

public java.lang.String getUsername()
Returns the username of the account assoicated to this source.

Returns:
Username of account.

isLive

public boolean isLive()
Is this data source live; does the load the details directly from the remote Celebdaq server.

Returns:
Live source

sellShares

public java.lang.String sellShares(Celebrity celebrity,
                                   int number)
                            throws java.io.IOException
Sell shares in a Celebrity. The portfolio will be updated once the operation is complete.

Parameters:
celebrity - Celebrity to sell
number - Number to sell
Returns:
Description of error condition
Throws:
java.io.IOException - Problem contacting server

setUserPassword

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

Parameters:
user - New user
password - New Password

updateCelebrity

public void updateCelebrity(Celebrity celeb)
                     throws java.io.IOException
This method updates the specific Celebrity with data from the managed source.

Parameters:
celeb - Celebrity to update.
Throws:
java.io.IOException - Problem contacting server

updateLeague

public void updateLeague(MiniLeague league)
                  throws java.io.IOException
This method updates the specific League with data from the managed source.

Parameters:
league - The league to update.
Throws:
java.io.IOException - Problem contacting server

updatePortfolio

public void updatePortfolio(Portfolio portfolio)
                     throws java.io.IOException
This method updates the specific Portfolio with data from the managed source.

Parameters:
portfolio - The portfolio to update.
Throws:
java.io.IOException - Problem contacting server