client access a proposal for client access. requirements it must be simple for the bundle writer to...
TRANSCRIPT
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
BundleA
BundleB
HttpForum
Display
Registrationevents
Only registersand modifies when data changes
Class Overview
Publishername
DocumentDTDXSL templates
Topicnametitle
Elementtag nameattributes
Has available
0..n
Has sub topics
0..n
1
1
1 0..n
1
1
1Documentdata
Object 0..n
1
1
Enough informationto generate XML
Sessioncapabilitiesattributes
Literalfor XML specials
Object[]String
Vector
Locale
1
English
Htmlstylesheet
WMLstylesheet
Dutch
Instance example
Documentdtd=http://w3c…xsl: html, wml
Htmlstylesheet
WMLstylesheet
Vector
String“M&C App”
Elementtag=version
Elementtag=sensors
Elementtag=top
String“1.1”
Element[3]tag=sensor(=actual sensor)
Elementtag=actuator
Element[1]tag=actuator(=actual actuator)
Auto Generated XML
• <?xml version=‘1.0’ standalone=‘no’encoding=‘utf-8’?><?xsl:stylesheet type='text/xsl' href=’/forum/local/1/xyz_html.xsl’ ?><top> M & C App <sensors> <sensor id=‘1’> …. </sensor> <sensor id=‘2’> …. </sensor> <sensor id=‘2’> …. </sensor> </sensor> <actuators> <actuator id=‘1’> …. </actuator> </actuators ></top>
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();• long getCreateTime();• long getLastAccessTime();• 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?