Client Access A proposal for client access
Requirements It must be simple for the bundle writer to deliver content to a diverse range of clients Separation of content and markup Performance issues, leverage smart clients Legacy clients Localisation issues
Architecture: Whiteboard Publisher Bundle A Bundle B Http Forum Display Registration events Only registers and modifies when data changes
Class Overview Publisher name Document DTD XSL templates Topic name title Element tag name attributes Has available 0..n Has sub topics 0..n Document data Object 0..n 1 1 Enough information to generate XML Session capabilities attributes Literal for XML specials Object[]String Vector Locale 1
English Html style sheet WML style sheet Dutch Instance example Document dtd= xsl: html, wml Html style sheet WML style sheet Vector String M&C App Element tag=version Element tag=sensors Element tag=top String 1.1 Element[3] tag=sensor (=actual sensor) Element tag=actuator Element[1] tag=actuator (=actual actuator)
Auto Generated XML M & C App …. …. …. ….
Advantages Correct generation of XML –Closing tags –Correct character encoding (entities, escaping) Better performance due to less string handling Much less code for bundle authors Sessions Security
Publisher Interfaces/Classes public interface Publisher { String getName(); Topic getMainTopic(Locale language); Document createDocument( Session session, String topic, Dictionary parameters, boolean post ); URL getResource(String name); } public class Topic { public Topic( String name, String title, String [] users, Topic[] topics ); public Topic( String name, String title); public void updated(); String getName(); String getTitle(); long getModifiedTime(); String [] getAuthorizedUsers(); Topic [] getSubTopics(); }
Document Interfaces public interface Document { String getDTD(); Element getData(); // -> data URL getTemplate(String mime); // -> format } public interface Element { String getName(); Dictionary getAttributes(); Object getContent(); } public interface Literal { String toString(); }
Session Interface public interface Session { String getUser(); String getBaseURL(); longgetCreateTime(); longgetLastAccessTime(); String [] getAcceptedMimeTypes(); void setValue( String key, Object value ); void removeValue( String key ); Object getValue( String key ); void delete(); }
Publisher code static Topic main_nl = new Topic( main_nl, Welkom ); static Topic main_en = new Topic( main_en, Welcome ); String getName() { return sample; } Topic getMainTopic( Locale locale ) { return locale.getCountry().equals(NL) ? main_nl : main_en; } Document createDocument( Session session, String tpc, Dictionary p){ return new DocumentImpl( main, DTD, new ElementImpl( top, null, Hello World ) getClass() ); } URL getResource( String name ) { return getClass().getResource(name); }
Status Halfway an HTTP implementation –Will handle session & security –Browser profiles select between XSL in the browser or local Will include library for simplifying XML handling Example family calendar Question: Shall we continue this?