Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Scout/HowTo/4.0/Create a Standalone Client with DB Access"

< Scout‎ | HowTo‎ | 4.0
(Created page with "{{ScoutPage|cat=HowTo 4.0}} A common Scout application typically consists of a client part (front end) and a server part (back end). The client part takes care of presenting ...")
 
(Replaced content with "The Scout documentation has been moved to https://eclipsescout.github.io/.")
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{ScoutPage|cat=HowTo 4.0}}
+
The Scout documentation has been moved to https://eclipsescout.github.io/.
 
+
A common Scout application typically consists of a client part (front end) and a server part (back end). The client part takes care of presenting the data whereas the server part is responsible for the processing, loading and storing. This is a very clean and powerful architecture for enterprise application. But what if you don't need a server? What if you only want to have a client which accesses the database? Is Scout able to handle this? Yes it is! The key word is offline support.
+
 
+
== Make your application offline capable ==
+
An offline Scout application is basically the same as an online Scout application beside the need of a server (like Tomcat). The business logic is still implemented in the server plugins whereas the presentation logic stays at the client plugins. So basically what you need to do is to start the server plugins together with the client plugins.
+
 
+
Follow these steps to make your application offline capable:
+
 
+
=== Extend the product ===
+
Extend your existing client product (SWT or Swing) with the server plugin and its dependencies. If you only add the server plugin <code>org.eclipse.scout.demo.offline.server</code> you will notice on startup that some plugins are missing. Either use the button "Add Required Plugins" which adds the missing plugins automatically or use "Validate Plugins" in the "Run configuration" and add the missing plugins manually.
+
 
+
[[Image:Add_required_plugins.png|thumb|center|200px|Offline Product]]
+
 
+
=== Register the offline dispatcher service ===
+
Register the <code>OfflineDispatcherService</code> in your server plugin which actually represents the server on client side and takes care of transactions.
+
 
+
[[Image:register_offline_dispatcher_service.jpg|thumb|center|200px|OfflineDispatcherService]]
+
 
+
===Configure the offline support===
+
Configure the offline support by setting the following property in the config.ini of your clients:
+
org.eclipse.scout.rt.server.services.common.offline.OfflineDispatcherService#serverSessionClass=WRITE_HERE_CORRECT_PACKAGE.ServerSession
+
=== Enable the offline support ===
+
Enable the offline support by adding the following code to beginning of the <code>ClientSession#execLoadSession</code>:
+
<source lang="java">ClientSession.get().goOffline();</source>
+
This delegates the proxy service calls which are normally received and dispatched by the <code>ServiceTunnelServlet</code> to the <code>OfflineDispatcherService</code>.
+
 
+
== Benefits of offline support compared to plain jdbc ==
+
#Server functionality like transaction handling is available on client side
+
#DB access and GUI Logic is well separated out of the box because the application design is the same as with a regular Scout client/server applications
+
#Existing tutorials for client/server applications can be reused since the development process is the same
+
#Switching to online mode is possible any time if you want to
+
 
+
== Demo Project with Offline Support  ==
+
 
+
[[Media:Scout_howto_offline_demo_3.9.zip]]
+

Latest revision as of 07:34, 18 March 2024

The Scout documentation has been moved to https://eclipsescout.github.io/.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.