client access a proposal for client access. requirements it must be simple for the bundle writer to...

12
Client Access A proposal for client access

Upload: dominic-brooks

Post on 27-Mar-2015

223 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 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

Client Access

A proposal for client access

Page 2: 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

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

Page 3: 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

Architecture: Whiteboard

Publisher

BundleA

BundleB

HttpForum

Display

Registrationevents

Only registersand modifies when data changes

Page 4: 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

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

Page 5: 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

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)

Page 6: 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

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 &amp; C App <sensors> <sensor id=‘1’> …. </sensor> <sensor id=‘2’> …. </sensor> <sensor id=‘2’> …. </sensor> </sensor> <actuators> <actuator id=‘1’> …. </actuator> </actuators ></top>

Page 7: 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

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

Page 8: 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

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();

• }

Page 9: 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

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();

}

Page 10: 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

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();• }

Page 11: 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

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); • }

Page 12: 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

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?