Class YahooClientImpl
- java.lang.Object
-
- org.marketcetera.marketdata.yahoo.YahooClientImpl
-
- All Implemented Interfaces:
Runnable,YahooClient,org.springframework.context.Lifecycle
class YahooClientImpl extends Object implements Runnable, YahooClient
Provides aYahooClientimplementation.- Since:
- 2.1.4
- Version:
- $Id$
- Author:
- Colin DuPlantis
-
-
Field Summary
Fields Modifier and Type Field Description private YahooFeedCredentialscredentialscredentials used for the Yahoo connection(package private) static StringDELIMITER_SYMBOLsentinel value used to separate query tokensprivate YahooFeedServicesfeedServicesYahoo feed services value(package private) static StringFIELD_DELIMITERsentinel value used to separate query tokensprivate AtomicBooleanisRunningindicates if the client is running(package private) static StringQUERY_SEPARATORsentinel value used to separate query tokensprivate AtomicLongrequestCounterthe counter used to keep track of the number of requestsprivate Set<YahooRequest>requeststhe active Yahoo requestsprivate Threadthreadthread used for submitting requests
-
Constructor Summary
Constructors Constructor Description YahooClientImpl(YahooFeedServices inFeedServices)Create a new YahooClient instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel(YahooRequest inRequest)Cancels th given request.longgetRequestCounter()Gets the current count of requests.booleanisLoggedIn()Indicates if the connection is currently logged in or not.booleanisRunning()booleanlogin(YahooFeedCredentials inCredentials)Logs in to the Yahoo data source with the given credentials.voidlogout()Logs out from the Yahoo data source.voidrequest(YahooRequest inRequest)Executes the given request.voidresetRequestcounter()Resets the count of requests.voidrun()voidstart()voidstop()private Stringsubmit(YahooRequest inRequest)Submits the given request and returns the response from Yahoo.
-
-
-
Field Detail
-
QUERY_SEPARATOR
static final String QUERY_SEPARATOR
sentinel value used to separate query tokens- See Also:
- Constant Field Values
-
FIELD_DELIMITER
static final String FIELD_DELIMITER
sentinel value used to separate query tokens- See Also:
- Constant Field Values
-
DELIMITER_SYMBOL
static final String DELIMITER_SYMBOL
sentinel value used to separate query tokens- See Also:
- Constant Field Values
-
feedServices
private final YahooFeedServices feedServices
Yahoo feed services value
-
thread
private volatile Thread thread
thread used for submitting requests
-
credentials
private volatile YahooFeedCredentials credentials
credentials used for the Yahoo connection
-
isRunning
private final AtomicBoolean isRunning
indicates if the client is running
-
requests
private final Set<YahooRequest> requests
the active Yahoo requests
-
requestCounter
private final AtomicLong requestCounter
the counter used to keep track of the number of requests
-
-
Constructor Detail
-
YahooClientImpl
YahooClientImpl(YahooFeedServices inFeedServices)
Create a new YahooClient instance.- Parameters:
inFeedServices- aYahooFeedServicesvalue
-
-
Method Detail
-
isRunning
public boolean isRunning()
- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
start
public void start()
- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()
- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
login
public boolean login(YahooFeedCredentials inCredentials)
Description copied from interface:YahooClientLogs in to the Yahoo data source with the given credentials.- Specified by:
loginin interfaceYahooClient- Parameters:
inCredentials- aYahooFeedCredentialsvalue- Returns:
- a
booleanvalue
-
logout
public void logout()
Description copied from interface:YahooClientLogs out from the Yahoo data source.- Specified by:
logoutin interfaceYahooClient
-
isLoggedIn
public boolean isLoggedIn()
Description copied from interface:YahooClientIndicates if the connection is currently logged in or not.- Specified by:
isLoggedInin interfaceYahooClient- Returns:
- a
booleanvalue
-
request
public void request(YahooRequest inRequest)
Description copied from interface:YahooClientExecutes the given request.- Specified by:
requestin interfaceYahooClient- Parameters:
inRequest- aYahooRequestvalue
-
cancel
public void cancel(YahooRequest inRequest)
Description copied from interface:YahooClientCancels th given request.- Specified by:
cancelin interfaceYahooClient- Parameters:
inRequest- aYahooRequestvalue
-
getRequestCounter
public long getRequestCounter()
Description copied from interface:YahooClientGets the current count of requests.- Specified by:
getRequestCounterin interfaceYahooClient- Returns:
- a
longvalue
-
resetRequestcounter
public void resetRequestcounter()
Description copied from interface:YahooClientResets the count of requests.- Specified by:
resetRequestcounterin interfaceYahooClient
-
submit
private String submit(YahooRequest inRequest) throws IOException
Submits the given request and returns the response from Yahoo.- Parameters:
inRequest- aYahooRequestvalue- Returns:
- a
Stringvalue - Throws:
IOException- if an error occurs submitting the request
-
-