You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Paco Avila <mo...@gmail.com> on 2009/09/03 10:53:31 UTC

spring se-jcr

I'm testing the Jakrabbit Spring integration and have some questions. I have
tried http://forum.springsource.org/forumdisplay.php?f=65 but seems quite
died. My main actual problem is the node locking. If the lock is not session
scoped I should save the lock token when the session is gone and add to the
session when it is opened again. But this process seems to be quite
automatic in this spring module, so how can deal with this?

This is the piece of code:

@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    public void lock() {
        jcrTemplate.execute(new JcrCallback() {
            public Object doInJcr(Session session) throws
RepositoryException {
                log.info("Session: "+session.getUserID()+" - "+session);
                Node root = session.getRootNode();
                Node pruebas = root.getNode("pruebas");
                pruebas.lock(true, false);
                session.save();
                return null;
            }
        });
    }

Also I wonder why the user credentias are coded in the configuration. If I
use this jcr-spring module only can be one session user in the system?

    <bean id="jcrSessionFactory"
class="org.springframework.extensions.jcr.jackrabbit.JackrabbitSessionFactory">
        <property name="repository" ref="jcrRepository" />
        <property name="credentials">
            <bean class="javax.jcr.SimpleCredentials">
                <constructor-arg index="0" value="xxx" />
                <constructor-arg index="1" value="null" />
            </bean>
        </property>
    </bean>

I have readed some spring-jcr mail in the past, and I hope any help on these
questions.

Thanks in advance.
-- 
Paco Avila
GIT Consultors
tel: +34 971 498310
fax: +34 971496189
e-mail: pavila@git.es
http://www.git.es