public class Provider extends Object
| Modifier and Type | Field and Description |
|---|---|
private Controller |
controller |
Dataset |
dataSet
The data set associated with the provider.
|
private long |
detectionCount |
private SortedList<MatchMethods,Long> |
methodCounts
The number of detections performed using the method.
|
private Cache<String,Match.MatchState> |
userAgentCache
A cache for user agents.
|
| Constructor and Description |
|---|
Provider()
Builds a new provider with the embedded data set.
|
Provider(Dataset dataSet)
Constructs a new provided using the data set.
|
Provider(Dataset dataSet,
Controller controller,
int cacheServiceInternal)
Constructs a new provider with the dataset, controller and cache
specified.
|
Provider(Dataset dataSet,
int cacheServiceInterval)
Constructs a new provided using the data set.
|
Provider(int cacheServiceInterval)
Builds a new provider with the embedded data set and a cache with the
service internal specified.
|
| Modifier and Type | Method and Description |
|---|---|
Match |
createMatch()
Creates a new match object to be used for matching.
|
long |
getDetectionCount()
The total number of detections performed by the data set.
|
private static String |
getDeviceUserAgent(Map<String,String> headers)
Used to check other header fields in case a device user agent is being used
and returns the devices useragent string.
|
private static byte[] |
getEmbeddedByteArray()
Reads the embedded data into a byte array to be used as a byte buffer in
the factory.
|
Match |
match(Map<String,String> headers)
For a given collection of HTTP headers returns a match containing
information about the capabilities of the device and it's components.
|
Match |
match(Map<String,String> headers,
Match match)
For a given collection of HTTP headers returns a match containing
information about the capabilities of the device and it's components.
|
Match |
match(String targetUserAgent)
For a given user agent returns a match containing information about the
capabilities of the device and it's components.
|
Match |
match(String targetUserAgent,
Match match)
For a given user agent returns a match containing information about the
capabilities of the device and it's components.
|
private Match |
matchNoCache(String targetUserAgent,
Match match) |
private Cache<String,Match.MatchState> userAgentCache
private long detectionCount
private final SortedList<MatchMethods,Long> methodCounts
public final Dataset dataSet
private Controller controller
public Provider()
throws IOException
IOExceptionpublic Provider(int cacheServiceInterval)
throws IOException
cacheServiceInterval - cache service internal in seconds.IOExceptionpublic Provider(Dataset dataSet)
dataSet - Data set to use for device detectionpublic Provider(Dataset dataSet, int cacheServiceInterval)
cacheServiceInterval - cache service internal in seconds.dataSet - Data set to use for device detectionProvider(Dataset dataSet, Controller controller, int cacheServiceInternal)
dataSet - controller - cacheServiceInternal - public long getDetectionCount()
private static byte[] getEmbeddedByteArray()
throws IOException
IOExceptionpublic Match createMatch()
Exceptionpublic Match match(Map<String,String> headers) throws IOException
headers - List of HTTP headers to use for the detectionIOExceptionpublic Match match(Map<String,String> headers, Match match) throws IOException
headers - List of HTTP headers to use for the detectionmatch - object created to store the results of the matchIOExceptionpublic Match match(String targetUserAgent) throws IOException
targetUserAgent - IOExceptionpublic Match match(String targetUserAgent, Match match) throws IOException
targetUserAgent - The user agent string to use as the targetmatch - A match object created by a previous match, or via the
CreateMatch method.IOExceptionExceptionprivate Match matchNoCache(String targetUserAgent, Match match) throws IOException
IOExceptionprivate static String getDeviceUserAgent(Map<String,String> headers)
headers - Collection of Http headers associated with the request.