|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.wurfl.core.resource.DefaultWURFLModel
public class DefaultWURFLModel
This is the default WURFLModel implementation. This class store the
devicesById in a Map in memory so it is very quick and no need for cache.
| Constructor Summary | |
|---|---|
DefaultWURFLModel(WURFLResource root)
Build a model by WURFLResource. |
|
DefaultWURFLModel(WURFLResource root,
WURFLResources patches)
Build model by root WURFLResource and patches WURFLResources. |
|
| Method Summary | |
|---|---|
Set |
getAllCapabilities()
Return all capabilities name defined by held ModelDevices. |
Set |
getAllDevices()
Return all defined devices. |
Set |
getAllDevicesId()
Return all defined devices identifiers. |
Set |
getAllGroups()
Return all defined group's identifiers. |
Set |
getCapabilitiesForGroup(String groupId)
Return the capabilities defined in the given group. |
ModelDevice |
getDeviceAncestor(ModelDevice device)
Return a ModelDevice ancestor. |
ModelDevice |
getDeviceById(String id)
Returns ModelDevice by his id. |
ModelDevice |
getDeviceFallback(ModelDevice device)
Return the device's fallback. |
List |
getDeviceHierarchy(ModelDevice device)
Returns device hierarchy. |
Set |
getDevices(Set devicesIds)
Return the devices with given identifiers. |
ModelDevice |
getDeviceWhereCapabilityIsDefined(ModelDevice rootDevice,
String name)
Return a ModelDevice, found iterating a ModelDevice
hierarchy, defining the given capability. |
protected ModelDevice |
getGenericDevice()
|
String |
getGroupByCapability(String capabilityName)
Return the group in which a capability is defined. |
String |
getVersion()
Returns the version of backed WURFL repository. |
boolean |
isCapabilityDefined(String capability)
Return if a capability is defined by the held ModelDevices. |
boolean |
isDeviceDefined(String deviceId)
Return if this model define ModelDevice with given id. |
boolean |
isGroupDefined(String groupId)
Return if a group is defined by this model. |
int |
size()
Return the size (number of held devices) of this model. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultWURFLModel(WURFLResource root)
root - resource represents the wurfl main resource.
WURFLConsistencyException - if the model is not consistent.
public DefaultWURFLModel(WURFLResource root,
WURFLResources patches)
root - resource represents the wurfl main resource.patches - resources represent the wurfl patches to apply.
WURFLConsistencyException - if the model is not consistent.| Method Detail |
|---|
public String getVersion()
The version string may change by Resource to Resource. For XMLResource
the version string is: fileType:filePath:fileVersion where
fileType my be Root or Patch.
The version describe all resources loaded by the model, each resource is
divided by ";"
ex:
Root:/WEB-INF/wurfl.zip:1.2;Patch:/WEB-INF/patch_spv.xml:1.4;Patch:/WEB-INF/patch_web_browser.xml:1.0
getVersion in interface WURFLModel
public ModelDevice getDeviceById(String id)
throws DeviceNotDefinedException
WURFLModelModelDevice by his id.
getDeviceById in interface WURFLModelid - The identifier of requested device
DeviceNotDefinedException - If this model do not manage the device with given id.
public Set getDevices(Set devicesIds)
throws DeviceNotDefinedException
WURFLModel
getDevices in interface WURFLModeldevicesIds - The identifiers of the devices to retrieve.
ModelDevice
DeviceNotDefinedException - If a device with the passed identifier is not defined in this
model.public Set getAllDevices()
WURFLModel
getAllDevices in interface WURFLModelModelDevicepublic Set getAllDevicesId()
WURFLModel
getAllDevicesId in interface WURFLModel
public List getDeviceHierarchy(ModelDevice device)
throws DeviceNotInModelException
WURFLModel
A hierarchy is a ordered list of ModelDevice instances, starting
form generic to device.
Generic -> ... -> device
getDeviceHierarchy in interface WURFLModeldevice - The device to get hierarchy.
List of ModelDevice representing the device's
hierarchy.
DeviceNotInModelException
public ModelDevice getDeviceFallback(ModelDevice device)
throws DeviceNotInModelException
WURFLModel
getDeviceFallback in interface WURFLModeldevice - The device to get fallback.
device.
DeviceNotInModelException - If the given device is not held by this model.
public ModelDevice getDeviceAncestor(ModelDevice device)
throws DeviceNotInModelException
WURFLModelModelDevice ancestor.
The ancestor is the first root device found iterating over the
device hierarchy, from root to generic.
getDeviceAncestor in interface WURFLModeldevice - The device from get the ancestor.
DeviceNotInModelExceptionpublic boolean isDeviceDefined(String deviceId)
WURFLModel
isDeviceDefined in interface WURFLModeldeviceId - The identifier to probe.
public int size()
WURFLModel
size in interface WURFLModelpublic Set getAllGroups()
WURFLModel
getAllGroups in interface WURFLModelpublic boolean isGroupDefined(String groupId)
WURFLModel
isGroupDefined in interface WURFLModelgroupId - The group to probe.
ModelDevices definig the given group.
public String getGroupByCapability(String capabilityName)
throws CapabilityNotDefinedException
WURFLModel
getGroupByCapability in interface WURFLModelcapabilityName - The capability to find group for.
CapabilityNotDefinedException - If the given capability is not defined by this model.public Set getAllCapabilities()
WURFLModelModelDevices.
getAllCapabilities in interface WURFLModelpublic boolean isCapabilityDefined(String capability)
WURFLModelModelDevices.
isCapabilityDefined in interface WURFLModelcapability - The capability to probe.
public Set getCapabilitiesForGroup(String groupId)
throws GroupNotDefinedException
WURFLModel
getCapabilitiesForGroup in interface WURFLModelgroupId - The identifier of group to get capabilities from.
GroupNotDefinedException - If the given group is not defined by the held
ModelDevices.
public ModelDevice getDeviceWhereCapabilityIsDefined(ModelDevice rootDevice,
String name)
throws DeviceNotInModelException,
CapabilityNotDefinedException
WURFLModelModelDevice, found iterating a ModelDevice
hierarchy, defining the given capability.
getDeviceWhereCapabilityIsDefined in interface WURFLModelrootDevice - The devices to iterate from.name - The capability to probe.
ModelDevice defining given capability.
DeviceNotInModelException - If the device is not held by this model.
CapabilityNotDefinedException - If the capability to probe is not defined by this model.protected ModelDevice getGenericDevice()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||