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 [[email protected]]
Sent: Friday, November 20, 2009 8:01 PM
To: [email protected]
Subject: Re: Unable to lock Exception.

On Fri, Nov 20, 2009 at 08:47, Sunil Dhage <[email protected]> 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
[email protected]

Reply via email to