RE: [API] First draft of the Java API bindings

What a great start, fantastic, thanks!

Team, can we have a space on dev.w3.org/cvsweb so we can put Jose's work there ... (on the understanding that this is open source under the W3C license - that OK with TID?)

Thanks
Jo



> -----Original Message-----
> From: public-ddwg-request@w3.org [mailto:public-ddwg-request@w3.org] On
> Behalf Of José Manuel Cantera Fonseca
> Sent: 10 October 2007 18:20
> To: public-ddwg@w3.org
> Subject: [API] First draft of the Java API bindings
> 
> 
> 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:42:01 UTC