jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sunil Dhage <sunil.dh...@coreobjects.com>
Subject RE: Unable to lock Exception.
Date Mon, 23 Nov 2009 06:30:37 GMT
Hi,
Thanks for your reply.

xyz.cnd contains these node type definitions.

[lc:account] > nt:folder, mix:lockable
-lc:accountid (string) mandatory primary

 /**
     * Registers custom node types for the application
     */
    protected void registerCustomNodeTypes(Workspace workspace) throws RepositoryException
    {   try
        {   ClassLoader loader = Thread.currentThread().getContextClassLoader();
            InputStream in = loader.getResourceAsStream("xyz.cnd");
            NodeTypeManagerImpl nodeTypeManager = (NodeTypeManagerImpl) workspace.getNodeTypeManager();
            // Registors the custom node types and namespaces
            nodeTypeManager.registerNodeTypes(in, JackrabbitNodeTypeManager.TEXT_X_JCR_CND,
true);
        }catch (NamespaceException nse)
        {   log.error("[contentCallback] Namespace registration issue : " + nse.getMessage());
        }catch (RepositoryException repse)
        {   log.error("[contentCallback] Repository registeration issue : " + repse.getMessage());
        } catch (IOException ex)
        {  log.error("[contentCallback] Error reading custom node definitions. Check dms-lc.cnd
is in classpath: " + ex.getMessage());
        }
    }

 /*
     * Adds a new candidate photo node from the root. adding,appending all the nodes
     * in the path.
     */
    private Node addPhotoContent(Session session,Node root) throws IOException,RepositoryException
    { ....

       try
       {  ......
           //looking for node at LC-root/candidatedocs/account
           path = getNodePath(contentpath.getProperty(ContentConstants.LC_ACCOUNT_PATH),new
Object[]{accountID});
           log.debug("Adding "+ContentConstants.LC_NODE_ACCOUNT+" at path ["+path+"]");
           Node account = verifyAndAddNode(session,candidatedocs,path,"lc:account");
           log.info("lockable status of account: '+account.isNodeType("mix:lockable"));  //ALWAYS
YIELDING FALSE
           account.save();
           account.lock(true,true);  //YIELDING EXCEPTION:  Unable to lock ....

**********Can I have a link, containing any example of how to create lockable nodes and how
to invoke lock on such nodes.

Regards,
Sunil

________________________________________
From: Alexander Klimetschek [aklimets@day.com]
Sent: Friday, November 20, 2009 8:01 PM
To: users@jackrabbit.apache.org
Subject: Re: Unable to lock Exception.

On Fri, Nov 20, 2009 at 08:47, Sunil Dhage <sunil.dhage@coreobjects.com> wrote:
> I have a node "account" to be locked. Since there can be concurrent threads which try
to access this node.
>
> I have provided mix:lockable to the node definition in .cnd file.  [lc:account] >nt:folder,mix:lockable
>
> And when I tried printing account.isNodeType("mix:lockable");  yielding false all the
times.

Maybe something with node type registration fails or the account node
is not created with the primary node type lc:account. Could you check?
And/or provide code example?

Regards,
Alex

--
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message