|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.free2be.dimensions.device.DeviceFactory
com.free2be.dimensions.device.profile.DeviceProfileFactory
public class DeviceProfileFactory
A factory that reads the x-wap-profile header url and retrieves the .rdf (on the web or cached). All elements in the file will be retrieved through standard device API. For optimal efficiency caching is taking place to minimize parsing since the device characteristics are most likely consistent over time. A local serialized device object will be stored on the filesystem and retrieved keyed by the hashcode of the url that references the rdf. The device is also stored at the applcation scope since there is no session-specific attributes of this device profile.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.free2be.dimensions.device.DeviceFactory |
---|
DeviceFactory.ConfidenceLevel |
Field Summary | |
---|---|
static java.lang.String |
PROFILE_HEADER_KEY
|
Fields inherited from class com.free2be.dimensions.device.DeviceFactory |
---|
CONTENT, DEFAULT, DEVICE, MINIMUM_LEVEL_FOR_FINAL, MODEL, NONE, OVERRIDE, PRE_DETERMINED, STANDARD |
Constructor Summary | |
---|---|
DeviceProfileFactory()
|
Method Summary | |
---|---|
protected static java.io.File |
createFile(java.lang.String deviceProfileUrlValue)
|
protected static void |
deleteFromCache(java.io.File file)
|
static Device |
discoverDeviceProfile(java.lang.String deviceProfileUrlValue,
javax.servlet.http.HttpServletRequest request)
|
DeviceFactory.ConfidenceLevel |
getConfidenceLevel()
Retrieves the confidence level this factory has in fulfilling the request based on the information provided during intialization. |
Device |
getDevice()
Retrieves a device to represent the calling client's device. |
DeviceFactory.ConfidenceLevel |
getHighestConfidenceLevel()
Returns the highest confidence level the implementing device factory can provide. |
void |
initialize(java.lang.Object informationSource)
Loads device profiles from UAProf .rdf xml files published on the web. |
protected static Device |
loadFromApplicationScope(java.lang.String deviceProfileUrlValue,
javax.servlet.http.HttpServletRequest request)
|
protected static Device |
loadFromLocalCache(java.lang.String deviceProfileUrlValue,
javax.servlet.http.HttpServletRequest request)
Loads the device from local cache if it has already been found. |
protected static Device |
loadFromUrl(java.lang.String deviceProfileUrlValue,
javax.servlet.http.HttpServletRequest request)
Loads a Profile from the url paramaters. |
protected static void |
storeInApplicationScope(Device device,
java.lang.String deviceProfileUrlValue,
javax.servlet.http.HttpServletRequest request)
|
protected static void |
storeInLocalCache(Device device,
java.lang.String deviceProfileUrlValue)
|
protected static java.lang.String |
stripOffQuotes(java.lang.String deviceProfileUrlValue)
Sometimes the url reference is coming with quotes.!!! |
Methods inherited from class com.free2be.dimensions.device.DeviceFactory |
---|
clearPersistantDevice, getDeviceFactory, getFactories, getPersistentFactories |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PROFILE_HEADER_KEY
Constructor Detail |
---|
public DeviceProfileFactory()
Method Detail |
---|
public Device getDevice()
DeviceFactory
getDevice
in class DeviceFactory
public DeviceFactory.ConfidenceLevel getConfidenceLevel()
DeviceFactory
getConfidenceLevel
in class DeviceFactory
public DeviceFactory.ConfidenceLevel getHighestConfidenceLevel()
DeviceFactory
getHighestConfidenceLevel
in class DeviceFactory
public void initialize(java.lang.Object informationSource)
All references to the persistant files will be keyed off the x-wap-profile http header value which references a url. 1. Application Scope (ServletContext.attribute) for a constructed device already present. 2. Local Persistance where the object has been serialized and saved. 3. URL reference published online by the device manufacturer or carrier.
initialize
in class DeviceFactory
informationSource
- The HttpRequest object possibly containing x-wap-profile header or
a Map containing x-wap-profile as a key and the url of interest as the value of that key
and the request identified by key 'request'.public static Device discoverDeviceProfile(java.lang.String deviceProfileUrlValue, javax.servlet.http.HttpServletRequest request) throws java.net.MalformedURLException, DeviceProfileException
java.net.MalformedURLException
DeviceProfileException
protected static Device loadFromLocalCache(java.lang.String deviceProfileUrlValue, javax.servlet.http.HttpServletRequest request)
protected static void deleteFromCache(java.io.File file)
protected static java.io.File createFile(java.lang.String deviceProfileUrlValue)
protected static void storeInLocalCache(Device device, java.lang.String deviceProfileUrlValue)
protected static Device loadFromApplicationScope(java.lang.String deviceProfileUrlValue, javax.servlet.http.HttpServletRequest request)
protected static void storeInApplicationScope(Device device, java.lang.String deviceProfileUrlValue, javax.servlet.http.HttpServletRequest request)
protected static java.lang.String stripOffQuotes(java.lang.String deviceProfileUrlValue)
protected static Device loadFromUrl(java.lang.String deviceProfileUrlValue, javax.servlet.http.HttpServletRequest request) throws java.net.MalformedURLException, DeviceProfileException
java.net.MalformedURLException
DeviceProfileException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |