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