I'm currently trying to use Pluto for implementing a portal for
ApacheSling and I'm not stumbling across the PortalContextService which
is used by the PortletServlet to register/unregister services.

The current mechanism is fine if the portlet container is
started/stopped together with the servlet container. In Apache Sling we
use OSGi and the container itself is a bundle which can be started,
stopped, updated at any time. So currently whenever I restart the
container bundle, all registered servlets get lost as the PortletServlet
does not try to re-register.

I think we could easily handle this more dynamic case if we implement a
simple registry in the portlet api itself. So the portlet api provides a
ContextService (no good idea for the interface names yet, so I just
choose the shortest available for this mail):
- register(Callback)
- unregister(Callback)
- Iterator<Callback) getCallbacks()

These methods are invoked by the servlet on init/destroy. The servlet
itself implements the Callback interface:
- ServletContext getServletContext()
- String getPortletName()
- init(DriverPortletContext, DriverPortletConfig)
- destroy()

When the container starts it gets all callbacks from the ContextService,
and calls the init() method. When the container stops, it calls all
destroy methods.
If the servlet unregisters while the container is not up, nothing
happens; if it unregisters while the container is up, destroy() is called.

This is just a quick draft out of the top of my head.

WDYT?

Carsten
-- 
Carsten Ziegeler
[email protected]

Reply via email to