//
// Component: HardwarePlatform
//
// Create the HardwarePlatform component.
Component hardwarePlatformComponent =
createComponent("HardwarePlatform");
// pixeldepth -> BitsPerPixel
int pixelDepth = getPolicyValueAsInt(device, "pixeldepth", 0);
if (pixelDepth > 0) {
Property bitsPerPixelProperty = new Property("BitsPerPixel",
new Integer(pixelDepth));
hardwarePlatformComponent.addProperty(bitsPerPixelProperty);
}
// rendermode -> ColorCapable
String renderMode = device.getComputedPolicyValue("rendermode");
if (renderMode != null) {
Boolean colorCapable = Boolean.FALSE;
if ((renderMode.equals("rgb") ||
renderMode.equals("pallette")) && pixelDepth > 1) {
colorCapable = Boolean.TRUE;
}
Property colorCapableProperty = new Property("ColorCapable",
colorCapable);
hardwarePlatformComponent.addProperty(colorCapableProperty);
}
// modelnum -> Model
String modelNum = device.getComputedPolicyValue("modelnum");
if (modelNum != null) {
Property modelProperty = new Property("Model", modelNum);
hardwarePlatformComponent.addProperty(modelProperty);
}
// pixelsx,y -> ScreenSize
int pixelsX = getPolicyValueAsInt(device, "pixelsx", 0);
int pixelsY = getPolicyValueAsInt(device, "pixelsy", 0);
if (pixelsX > 0 && pixelsY > 0) {
Dimension screenSize = new Dimension(pixelsX, pixelsY);
Property screenSizeProperty = new Property("ScreenSize",
screenSize);
hardwarePlatformComponent.addProperty(screenSizeProperty);
}
// charactersx,y -> ScreenSizeChar
Dimension screenSizeChar;
int charactersX = getPolicyValueAsInt(device, "charactersx", 0);
int charactersY = getPolicyValueAsInt(device, "charactersy", 0);
if (charactersX > 0 && charactersY > 0) {
screenSizeChar = new Dimension(charactersX, charactersY);
Property screenSizeCharProperty = new Property("ScreenSizeChar",
screenSizeChar);
hardwarePlatformComponent.addProperty(screenSizeCharProperty);
}
// mfg -> Vendor
String manufacturer = device.getComputedPolicyValue("mfg");
if (manufacturer != null) {
Property vendorProperty = new Property("Vendor", manufacturer);
hardwarePlatformComponent.addProperty(vendorProperty);
}
// HardwarePlatform component is complete, so add it to the Profile.
profile.addComponent(hardwarePlatformComponent);
//
// Component: SoftwarePlatform
//
Component softwarePlatformComponent =
createComponent("SoftwarePlatform");
// UAProf.CcppAccept -> CcppAccept
String ccppAccept = device.getComputedPolicyValue("UAProf.CcppAccept");
if (ccppAccept != null) {
Set ccppAcceptSet = new HashSet();
ccppAcceptSet.add(ccppAccept);
Property ccppAcceptProperty = new Property("CcppAccept",
ccppAcceptSet);
softwarePlatformComponent.addProperty(ccppAcceptProperty);
}
// SoftwarePlatform component is complete, so add it to the Profile.
profile.addComponent(softwarePlatformComponent);
//
// Component: BrowserUA
//
Component browserUAComponent =
createComponent("BrowserUA");
// brwsrname -> BrowserName
String brwsrName = device.getComputedPolicyValue("brwsrname");
if (brwsrName != null) {
Property browserNameProperty = new Property("BrowserName",
brwsrName);
browserUAComponent.addProperty(browserNameProperty);
}
// brwsrvers -> BrowserVersion
String brwsrVers = device.getComputedPolicyValue("brwsrvers");
if (brwsrVers != null) {
Property browserVersionProperty = new Property("BrowserVersion",
brwsrVers);
browserUAComponent.addProperty(browserVersionProperty);
}
// BrowserUA component is complete, so add it to the Profile.
profile.addComponent(browserUAComponent);
//
// Component: WapCharacteristics
//
Component wapCharacteristicsComponent =
createComponent("WapCharacteristics");
// UAProf.WmlVersion -> WmlVersion
String wmlVersion = device.getComputedPolicyValue("UAProf.WmlVersion");
if (wmlVersion != null) {
Set wmlVersionSet = new HashSet();
wmlVersionSet.add(wmlVersion);
Property wmlVersionProperty = new Property("WmlVersion",
wmlVersionSet);
wapCharacteristicsComponent.addProperty(wmlVersionProperty);
}
// WapCharacteristics component is complete, so add it to the Profile.
profile.addComponent(wapCharacteristicsComponent);