net.sourceforge.wurfl.core.resource
Interface WURFLModel

All Known Subinterfaces:
WURFLAccessibleModel
All Known Implementing Classes:
DefaultWURFLModel

public interface WURFLModel

This interface is used to access to the ModelDevices. The class need access to the ModelDevices, must to use this interface.

The main aim of this interface is to hold the object model of WURFL repository, the implementing classes can held the ModelDevices instance in several different manner.

Version:
$Id: WURFLModel.java 432 2010-05-06 12:12:53Z filippo.deluca $
Author:
Fantayeneh Asres Gizaw, Filippo De Luca

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 group)
          Return the capabilities defined in the given group.
 ModelDevice getDeviceAncestor(ModelDevice target)
          Return a ModelDevice ancestor.
 ModelDevice getDeviceById(String id)
          Returns ModelDevice by his id.
 ModelDevice getDeviceFallback(ModelDevice target)
          Return the device's fallback.
 List getDeviceHierarchy(ModelDevice root)
          Returns device hierarchy.
 Set getDevices(Set ids)
          Return the devices with given identifiers.
 ModelDevice getDeviceWhereCapabilityIsDefined(ModelDevice root, String capability)
          Return a ModelDevice, found iterating a ModelDevice hierarchy, defining the given capability.
 String getGroupByCapability(String capability)
          Return the group in which a capability is defined.
 String getVersion()
          Returns the version info of wurfl repository.
 boolean isCapabilityDefined(String capability)
          Return if a capability is defined by the held ModelDevices.
 boolean isDeviceDefined(String id)
          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.
 

Method Detail

getVersion

String getVersion()
Returns the version info of wurfl repository.

The returning string may vary by the kind of resources used to build model.

Returns:
String represents wurfl repository version.

getDeviceById

ModelDevice getDeviceById(String id)
                          throws DeviceNotDefinedException
Returns ModelDevice by his id.

Parameters:
id - The identifier of requested device
Returns:
ModelDevice identified by id.
Throws:
DeviceNotDefinedException - If this model do not manage the device with given id.

isDeviceDefined

boolean isDeviceDefined(String id)
Return if this model define ModelDevice with given id.

Parameters:
id - The identifier to probe.
Returns:
True if the device is defined, false otherwise.

getAllDevices

Set getAllDevices()
Return all defined devices.

Returns:
Set of ModelDevice

getAllDevicesId

Set getAllDevicesId()
Return all defined devices identifiers.

Returns:
Set of string representing the devices identifier.

getDevices

Set getDevices(Set ids)
               throws DeviceNotDefinedException
Return the devices with given identifiers.

Parameters:
ids - The identifiers of the devices to retrieve.
Returns:
Set of ModelDevice
Throws:
DeviceNotDefinedException - If a device with the passed identifier is not defined in this model.

getDeviceHierarchy

List getDeviceHierarchy(ModelDevice root)
                        throws DeviceNotInModelException
Returns device hierarchy.

A hierarchy is a ordered list of ModelDevice instances, starting form generic to device.

  Generic -> ... -> device
 

Parameters:
root - The device to get hierarchy.
Returns:
A List of ModelDevice representing the device's hierarchy.
Throws:
DeviceNotInModelException

getDeviceFallback

ModelDevice getDeviceFallback(ModelDevice target)
                              throws DeviceNotInModelException
Return the device's fallback.

Parameters:
target - The device to get fallback.
Returns:
A ModelDevice fallback of given device.
Throws:
DeviceNotInModelException - If the given device is not held by this model.

getDeviceAncestor

ModelDevice getDeviceAncestor(ModelDevice target)
                              throws DeviceNotInModelException
Return a ModelDevice ancestor.

The ancestor is the first root device found iterating over the device hierarchy, from root to generic.

Parameters:
target - The device from get the ancestor.
Returns:
The root target device parent.
Throws:
DeviceNotInModelException

size

int size()
Return the size (number of held devices) of this model.

Returns:
The size of this model.

getAllCapabilities

Set getAllCapabilities()
Return all capabilities name defined by held ModelDevices.

Returns:
A Set of String containing the capabilities name.

isCapabilityDefined

boolean isCapabilityDefined(String capability)
Return if a capability is defined by the held ModelDevices.

Parameters:
capability - The capability to probe.
Returns:
true if the capability is defined, false otherwise.

getGroupByCapability

String getGroupByCapability(String capability)
                            throws CapabilityNotDefinedException
Return the group in which a capability is defined.

Parameters:
capability - The capability to find group for.
Returns:
The capability parent group identifier.
Throws:
CapabilityNotDefinedException - If the given capability is not defined by this model.

getDeviceWhereCapabilityIsDefined

ModelDevice getDeviceWhereCapabilityIsDefined(ModelDevice root,
                                              String capability)
                                              throws DeviceNotInModelException,
                                                     CapabilityNotDefinedException
Return a ModelDevice, found iterating a ModelDevice hierarchy, defining the given capability.

Parameters:
root - The devices to iterate from.
capability - The capability to probe.
Returns:
The ModelDevice defining given capability.
Throws:
DeviceNotInModelException - If the device is not held by this model.
CapabilityNotDefinedException - If the capability to probe is not defined by this model.

getAllGroups

Set getAllGroups()
Return all defined group's identifiers.


isGroupDefined

boolean isGroupDefined(String groupId)
Return if a group is defined by this model.

Parameters:
groupId - The group to probe.
Returns:
true if the held ModelDevices definig the given group.

getCapabilitiesForGroup

Set getCapabilitiesForGroup(String group)
                            throws GroupNotDefinedException
Return the capabilities defined in the given group.

Parameters:
group - The identifier of group to get capabilities from.
Returns:
A Set of capabilities identifiers.
Throws:
GroupNotDefinedException - If the given group is not defined by the held ModelDevices.


Copyright © 2008-2010 WURFL-Pro srl. All Rights Reserved.