[Hippo-cms7-user] How can i get an instance of "javax.jcr.Repository" in hst-assembly hippo 7.7
w.ko at onehippo.com
Sat Apr 7 04:14:06 CEST 2012
One more thing is that you'd better get references of the component
manager and components whenever you want to use because the component
manager and its components can be re-initialized at runtime by default
whenever hst configuration is changed. See  for detail.
In other words, if your bean has had a reference to the repository bean,
then it should be improved to get the reference as local variable in
operations because the repository bean can be closed and a new bean has
been re-initialized at runtime.
On 4/7/12 10:08 AM, Woonsan Ko wrote:
> I don't think there has been any significant changes affecting the API
> HstServices#getComponentManager() returns a valid instance only when the
> HST container has been successfully initialized.
> And, the HST container is initialized by HstSiteConfigServlet which is
> configured in the web.xml.
> If hst-config.properties has "check.repositories.running = false", then
> the servlet initializes the container right during the initialization of
> the servlet itself. If the configuration has "check.repositories.running
> = true", the servlet waits until hippo repository starts".
> Therefore, if you have a spring application context configuration
> somewhere through either context level or servlet level, then you have
> to consider this initialization order.
> If you don't want to be bothered by this initialization order, they you
> might consider invoking HstServices.getComponentManager() in your
> component code just before using it lazily.
> On 4/6/12 10:34 PM, Ebrahim wrote:
>> I am trying to port an old plugin to Hippo 7.7, in an older version of
>> i used to use the following snippet to get an instance of the jcr
>> <bean id="containerComponentManager"
>> <property name="targetClass" value="org.hippoecm.hst.site.HstServices"
>> <property name="targetMethod" value="getComponentManager" />
>> <bean id="javax.jcr.Repository"
>> <property name="targetObject" ref="containerComponentManager" />
>> <property name="targetMethod" value="getComponent" />
>> <property name="arguments">
>> but it no longer works, because
>> "org.hippoecm.hst.site.HstServices.getComponentManager()" returns null.
>> Any idea on why is that and how to get and instance of "jcr repository"?
>> View this message in context:
>> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
>> Hippo-cms7-user mailing list and forums
w.ko at onehippo.com www.onehippo.com
Boston - 1 Broadway, Cambridge, MA 02142
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
More information about the Hippo-cms7-user