public class EndPointService
extends java.lang.Object
Constructor and Description |
---|
EndPointService(CacheService cacheService) |
Modifier and Type | Method and Description |
---|---|
void |
addEndPoint(java.util.List<EndPoint> endPointL,
EndPoint endPoint)
Adds an endpoint to the list
|
java.util.Map |
connectCloud(EndPoint endPoint,
java.lang.String userAgent,
java.util.Map<java.lang.String,java.lang.String> headers,
java.util.List<java.lang.String> errors)
Get the properties from a cloud end point
|
boolean |
getAutoServerRanking()
Checks if the server ranking is in auto mode
|
int |
getAutoServerRankingMaxFailures()
Returns the maximum amount of failures for server ranking's checks
|
int |
getAutoServerRankingNumRequests()
Returns the maximum number of requests
|
CacheService |
getCacheService()
Returns the underlying cache layer
|
java.util.List<java.lang.String> |
getCalledServers()
Returns the servers called
|
java.util.Map |
getCloudService(java.lang.String userAgent,
java.util.Map<java.lang.String,java.lang.String> headers)
Get device properties from DeviceAtlas cloud service
|
java.util.Map |
getCloudServiceResponse(EndPoint[] localEndPoints,
java.lang.String userAgent,
java.util.Map<java.lang.String,java.lang.String> headers,
java.util.List<java.lang.String> errors)
Treats the endPoint response
|
int |
getCloudServiceTimeout()
Returns the cloud service's timeout
|
java.lang.String |
getCloudUrl()
Gets the last endpoint url used when call the service
|
EndPoint[] |
getEndPoints()
Gets the list of ranking endpoints (manual or auto)
|
byte |
getFailoverAction()
Gets the current action to take regarding the connection service
|
java.util.List<java.lang.String> |
getFatalErrors()
Returns the list of errors
|
EndPoint |
getFirstEndPoint()
Returns the fist endpoint
|
EndPoint[] |
getOriginalEndPoints()
Returns the original endpoints list
|
java.lang.String |
getRankingStatus()
Returns the current ranking status
|
java.util.List<java.lang.Double> |
getServerLatency(EndPoint endPoint,
int numRequests)
Returns the latencies of endpoints
|
EndPoint[] |
getServersLatencies()
Get endPoints and their service latencies.
|
EndPoint[] |
getServersLatencies(int numRequests)
Get endPoints and their service latencies.
|
boolean |
isServerListManual()
true if the server list is the manual type
|
void |
moveEndPointOrder(EndPoint[] localEndPoints,
int i)
if top endPoints failed, move them to the bottom and re-cache the list
|
EndPoint[] |
rankServers()
If auto-ranking is on then rank the DeviceAtlas cloud end-points and put in cache.
|
void |
setAutoServerRanking(boolean autoServerRanking)
Set the server ranking in auto mode
|
void |
setAutoServerRankingMaxFailures(int autoServerRankingMaxFailures)
Sets the maximum amount of failures for server ranking's checks
|
void |
setAutoServerRankingNumRequests(int autoServerLatencyNumRequests)
Sets the maximum number of requests
|
void |
setCalledServers(java.util.List<java.lang.String> calledServers)
Sets the servers called
|
void |
setCloudServiceTimeout(int cloudServiceTimeout)
Sets the cloud service's timeout
|
void |
setCloudUrl(java.lang.String lastUsedCloudUrl)
Sets the last endpoint url used when call the service
|
void |
setEndPoints(EndPoint[] endPoints)
Sets the original list of endpoints
|
void |
setEndPointsIfNotRanked()
Sets the end point
|
void |
setFailoverAction(byte failoverAction)
Sets the action level
|
void |
setFirstEndPoint(EndPoint endPoint)
Sets the first endpoint
|
void |
setLicenceKey(java.lang.String licenceKey)
Sets the licence key
|
void |
setProxy(java.net.Proxy proxy)
Sets HTTP proxy settings for the remote requests
|
void |
setRankingStatus(java.lang.String rankingStatus)
Sets the current ranking status
|
void |
setServerListIsManual(boolean serverListIsManual)
Sets the type of server list (manual or not)
|
public EndPointService(CacheService cacheService)
public byte getFailoverAction()
public void setFailoverAction(byte failoverAction)
failoverAction
- public CacheService getCacheService()
public boolean isServerListManual()
public void setServerListIsManual(boolean serverListIsManual)
serverListIsManual
- public java.lang.String getCloudUrl()
public void setCloudUrl(java.lang.String lastUsedCloudUrl)
lastUsedCloudUrl
- public int getCloudServiceTimeout()
public void setCloudServiceTimeout(int cloudServiceTimeout)
cloudServiceTimeout
- public int getAutoServerRankingMaxFailures()
public void setAutoServerRankingMaxFailures(int autoServerRankingMaxFailures)
autoServerRankingMaxFailures
- public int getAutoServerRankingNumRequests()
public void setAutoServerRankingNumRequests(int autoServerLatencyNumRequests)
public java.lang.String getRankingStatus()
public void setRankingStatus(java.lang.String rankingStatus)
rankingStatus
- public void setLicenceKey(java.lang.String licenceKey)
licenceKey
- public EndPoint[] getEndPoints() throws CacheException
CacheException
public EndPoint[] getOriginalEndPoints()
public void setEndPoints(EndPoint[] endPoints)
endPoints
- public EndPoint getFirstEndPoint()
public void setFirstEndPoint(EndPoint endPoint)
endPoint
- public boolean getAutoServerRanking()
public void setAutoServerRanking(boolean autoServerRanking)
autoServerRanking
- public java.util.List<java.lang.String> getFatalErrors()
public java.util.List<java.lang.Double> getServerLatency(EndPoint endPoint, int numRequests)
endPoint
- numRequests
- public EndPoint[] getServersLatencies(int numRequests)
numRequests
- Number of times to request from serverpublic EndPoint[] getServersLatencies()
public java.util.List<java.lang.String> getCalledServers()
public void setCalledServers(java.util.List<java.lang.String> calledServers)
calledServers
- public void addEndPoint(java.util.List<EndPoint> endPointL, EndPoint endPoint)
endPointL
- endPoint
- public void setEndPointsIfNotRanked()
public EndPoint[] rankServers() throws CacheException
CacheException
- when an error checking server latencies appearspublic void setProxy(java.net.Proxy proxy)
proxy
- proxy to set for the remote requestspublic java.util.Map connectCloud(EndPoint endPoint, java.lang.String userAgent, java.util.Map<java.lang.String,java.lang.String> headers, java.util.List<java.lang.String> errors) throws ClientException
ClientException
public void moveEndPointOrder(EndPoint[] localEndPoints, int i) throws CacheException
localEndPoints
- i
- CacheException
public java.util.Map getCloudServiceResponse(EndPoint[] localEndPoints, java.lang.String userAgent, java.util.Map<java.lang.String,java.lang.String> headers, java.util.List<java.lang.String> errors) throws CacheException
localEndPoints
- userAgent
- headers
- errors
- CacheException
public java.util.Map getCloudService(java.lang.String userAgent, java.util.Map<java.lang.String,java.lang.String> headers) throws ClientException
ClientException