Sunday, January 18, 2009

Eclipse RAP: Creatiing a multiuser RAP Application

What is RAP ?

Rich Ajax Platform, a web development platform for RCP Developers. RAP uses the whole plugin architecture of the eclipse platform and provides a SWT port called RWT for the web browsers. RWT uses the qooxdoo java script library to create the User interfaces on the browser side.

Singleton

Singleton pattern is something which is widely used on the eclipse platform. But for a web based application where multiple users will be accessing the application we need session based singleton implementation.

SessionSingletonBase

Eclipse RAP provides a base class called SessionSingletonBase which provides a singleton implementation for each session and avoids the sharing the application state between the users.

so just extends the SessionSingletonBase and create a singleton instance as done below.


SampleAppPlatform extends SessionSingletonBase {

public static final SampleAppPlatform getInstance() {
return (SampleAppPlatform) getInstance(SampleAppPlatform.class);
}
}


and try accessing the RAP web application from multiple browser instances and check the SampleAppPlatform state. It will be different.



No comments: