Hi Paul,

I’m glad to hear that this is working. It does look like it could use a little 
tidying up though. The overall approach seems similar to that used in the 
OpenSecurityController project, although that is even more decomposed into 
services, and might be a better model follow up.

The UI instance is provided as a service 
<https://github.com/opensecuritycontroller/osc-core/blob/534d035033804d360bd6fc253eaad4cda49a2d59/osc-ui/src/main/java/org/osc/core/ui/UiServlet.java#L59>
 using a provider
The UI provider uses Prototype scope service instances 
<https://github.com/opensecuritycontroller/osc-core/blob/534d035033804d360bd6fc253eaad4cda49a2d59/osc-ui/src/main/java/org/osc/core/broker/view/MainUIProvider.java#L34>
 to create a UI instance per session. These are released when the UI detaches 
<https://github.com/opensecuritycontroller/osc-core/blob/534d035033804d360bd6fc253eaad4cda49a2d59/osc-ui/src/main/java/org/osc/core/broker/view/MainUIProvider.java#L45>
The UI then uses Prototype scope service instances to create views 
<https://github.com/opensecuritycontroller/osc-core/blob/534d035033804d360bd6fc253eaad4cda49a2d59/osc-ui/src/main/java/org/osc/core/broker/view/MainUI.java#L138>
 and passes them to a view provider 
<https://github.com/opensecuritycontroller/osc-core/blob/534d035033804d360bd6fc253eaad4cda49a2d59/osc-ui/src/main/java/org/osc/core/broker/view/MainUI.java#L195>.
 The view provider ensures the view service is released when it is detached 
<https://github.com/opensecuritycontroller/osc-core/blob/534d035033804d360bd6fc253eaad4cda49a2d59/osc-ui/src/main/java/org/osc/core/broker/view/OSCViewProvider.java#L63>

This model allows an incredibly flexible UI to be built entirely from OSGi 
services, right down to the views. This means that the individual view 
instances can be DS components, and therefore simply injected with business 
services 
<https://github.com/opensecuritycontroller/osc-core/blob/534d035033804d360bd6fc253eaad4cda49a2d59/osc-ui/src/main/java/org/osc/core/broker/view/ApplianceView.java>.
 This saves you from having huge hellish constructors, and from having a UI 
component that has all the dependencies for every one of its views.

I hope this helps to demonstrate some of the awesome power that you can get 
from leveraging the OSGi service model.

Best Regards,

Tim

> On 25 Jun 2018, at 11:17, Paul F Fraser via osgi-dev <osgi-dev@mail.osgi.org> 
> wrote:
> 
> At last I have a working vaadin UI in the new enRoute environment.
> 
> https://github.com/QNENet/vaadin-osgi-enRoute
> 
> The code is based on work by Mirjan Merruko of Vaadin in preparation for 
> possible inclusion in an upcoming Vaadin release.
> 
> I have no yet tried any themes other than the default Valo and the default 
> widgetset.
> 
> Paul Fraser
> 
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to