sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Re: JCR Node Type Management Issues
Date Wed, 19 Sep 2007 15:17:30 GMT
Felix Meschberger schrieb:
> Hi all,
> 
> Currently, the sling-content-jcr bundle has a ContentManagerFactory
> implementation (the JcrContentHelper, used to access Sling
> ContentManager instances), which listens for bundles being registered
> and registers node types registered in the bundles and loads initial
> content stored in those bundles. Additionally, this class cares to setup
> the Sling ContentManager instances used to access the OCM functionality.
> 
> While working on the sling-event bundle, we discovered a race condition
> with node type registration and repository use. To overcome this race
> condition, we propose to move the node type registration part from the
> ContentManagerFactory implementation to the AbstractSlingRepository
> class in the sling-jackrabbit-api bundle. This class is the base class
> for services registered to provide the repository. As such, this class
> has contact to the repository before the service is registered or made
> available to the users of the repository.
> 
> Some background information on the race condition: The JcrContentHelper
> is implemented as an OSGi Component and requires a repository and as
> such will only be activated when the repository is available. The
> AbstractRepositoryEventHandler in the sling-event bundle also requires a
> repository and is also implemented as an OSGi component. When now both
> components are waiting for a repository to become available, the
> AbstractRepositoryEventHandler may be activated before the
> JcrContentHelper is activated and therefore, the node types required by
> the AbstractRepositoryEventHandler are not available yet as the
> JcrContentHandler was not able yet to register them ...
> 
> What do you think of this change ?
> 
Big +1 :)

I think the expectation of a developer is that when the repository is
available (through the SlingRepository service), it is setup completly
(at least with respect to the bundle the current code is executed in).
Therefore any custom node types of this bundle should be add to the
repository before the repository service is made available.

Carsten

-- 
Carsten Ziegeler
cziegeler@apache.org

Mime
View raw message