If you need version migrating I suggest you pipeline it on two different
services as Marcel suggested. The migrator depends on the raw service and
registers a delegate service after it has migrated the database. You can easily
make a pipeline like this. A simple service property will do the trick. In DS
it is easy to use the target filter (that can be set by config admin so you
code is ignorant of the fact) to manage the pipeline.
db -> migrator -> client
In general you make things surprisingly complex once you step outside the
standard service dependency model. Services provide a dynamic dependency
primitive that is much more powerful than most people think. Trying to do
'clever' things is like having Lego and mixing it with Meccano. For one aspect
a might be a cool solution. However, it will look like crap and later you find
that lots of things suddenly have to be handled specially instead of snapping
on.
Kind regards,
Peter Kriens
On 19 mrt. 2014, at 12:25, Bertrand Delacretaz <[email protected]> wrote:
> Hi,
>
> On Tue, Mar 18, 2014 at 10:22 PM, Neil Bartlett <[email protected]> wrote:
>> ...Whatever you're trying to do in your special listener, wouldn't it be
>> better done inside the same bundle as the service?...
>
> You're right, and this is similar to what Bruce suggests - the
> bundle's initialization code can look for initializer services using a
> whiteboard pattern, and call them before making the actual service
> available.
>
> To answer Marcel's question about the use case, the app in question is
> Sling-based and uses a content repository service. When upgrading the
> app you might need to make some changes to the content before the new
> version of the app starts working with the content repository. So yes,
> making this part of the content repository service design makes
> absolute sense.
>
> David B's hooks suggestion also looks interesting, as a generic way of
> talking to services early in the setup phase.
>
> Thanks everybody for the pointers!
>
> -Bertrand
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]