- From: José Manuel Cantera Fonseca <jmcf@tid.es>
- Date: Wed, 10 Oct 2007 19:20:24 +0200
- To: public-ddwg@w3.org
Dear All, I have created a first draft of the Java API bindings [1], even I'm proud to announce that I have a first version of the implementation of those APIs using WURFL :). I have done it as a proof of concept of the quality of the design. I have designed all the functions that are in the current editor's draft and others that might be in subsequent drafts. Also a simple bootstrapping mechanism is provided. I think this APIs should provide a good starting point for those who are not comfortable with IDL. Also, I'm gonna send a UML diagram illustrating the design of the API. I will also commit in the group's CVS the Java files. The main entry points to the API are the interfaces: + DDRAdmin + DDR + DDRMetadata + DDRIdentification [1] http://www.w3.org/2005/MWI/DDWG/drafts/api/DDRAPI-JavaBinding/ Using the APIs the code to call a DDR could as simple as: DDRServiceRegistry registry = DDRServiceRegistryImpl.newInstance(); DDRService service = registry.newDefaultDDRService(); service.setProperty("WURFL_FILE", "resource/wurfl.xml"); service.initialize(); DDRIdentification recognition = service.getDDRIdentification(); Map headers = new java.util.HashMap(); headers.put("User-Agent", "MOT-T720/G_05.01.43R"); ContextKey key = recognition.identifyByHttpHeaders(headers); DDRProperty prop = new DDRPropertyHelper("resolution_width"); DCComponent device = new DeviceComponentHelper(); DDRPropertyValue value = service.getDDR().getPropertyValue(key, prop, device); System.out.println("Retrieved value:" + value.getValue()); DDRPropertyValueList list = service.getDDR().getAllPropertyValues(key, device); for(int j = 0; j < list.getSize(); j++) { System.out.println("Capability: " + list.item(j).getProperty().getId() + " values " + list.item(j).getValue()); }
Received on Wednesday, 10 October 2007 17:24:52 UTC