Hi Paul,

> The MainUI references all of the ComponentServiceObjects used in the project.
> 
> Could you suggest how this would be handled when new types need to added at 
> runtime.

The Views are just prototype scope services. You could easily use a whiteboard 
for them and find them based on service properties and/or common types. This 
would obviously mean that the views needed to be presented in a more 
flexible/extensible container than the OpenSecurityController uses (i.e. one 
that can cope with additional tabs). You would also need to update the UI model 
on the fly as view services came and went, but that shouldn’t be too 
challenging. Some better help/support for this model should probably be part of 
the Vaadin library’s OSGi support. If you have their ear then it might be worth 
getting them to look at what’s being done here.

> Also, how would the situation be handled when each session(user) has a 
> different set of ComponentServiceObjects  made available, for instance, an 
> Access Control List depending on the user role.

I would make that part of the UI implementation, filtering the views that it 
adds based on the ACL from the user session. The user’s vaadin session is 
available during the vaadin UI initialisation callback, which is when most of 
your setup is supposed to be done anyway.

Best Regards,

Tim

> On 29 Jun 2018, at 08:12, Paul F Fraser <pa...@a2zliving.com> wrote:
> 
> Tim,
> 
> Thanks for the pointer to OpenSecurityController. It covers many aspects of 
> the service model not well explained anywhere else that I have been able to 
> find.
> 
> A couple of questions...
> 
> The MainUI references all of the ComponentServiceObjects used in the project.
> 
> Could you suggest how this would be handled when new types need to added at 
> runtime.
> 
> Also, how would the situation be handled when each session(user) has a 
> different set of ComponentServiceObjects  made available, for instance, an 
> Access Control List depending on the user role.
> 
> Paul
> 
> On 28/06/2018 7:49 PM, Tim Ward wrote:
>> 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
> 

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

Reply via email to