jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@day.com>
Subject Re: Problems with Cloning of folders within workspaces
Date Mon, 28 Apr 2008 09:51:54 GMT
hi anup

On Sun, Apr 27, 2008 at 9:17 AM, AnupChatterjee
<anup.chatterjee@marketlive.com> wrote:
>
>  Hi,
>
>  I have this setup -
>
>  A folder within a workspace which has files that I want to clone into
>  another workspace within the same repository.
>
>  nt:Folder -> nt:file -> nt:resource (mix:referenceable)
>  ...
>                 Node fileNode = folderNode.addNode(fileName, "nt:file");
>                 Node resourceNode =
>  fileNode.addNode(JcrConstants.JCR_CONTENT, "nt:resource");
>                 // resourceNode.addMixin("mix:versionable"); // For
>  Versioning this node
>                 resourceNode.setProperty(JcrConstants.JCR_MIMETYPE,
>  "text/plain");
>                 resourceNode.setProperty(JcrConstants.JCR_LASTMODIFIED,
>  GregorianCalendar.getInstance());
>                 // resNode.setProperty("jcr:encoding",
>                 // request.getCharacterEncoding());
>                 resourceNode.setProperty(JcrConstants.JCR_DATA, nodeText);
>  ...
>  I want to make the folder structure and the file node correspond between src
>  and target, hence need the clone operation.
>
>  When I request for clone of the folder which has the fileNode on the target
>  it gives me an itemExistsException while I'm sure it doesn't.
>  ...
>                         //Get the last parent of this file which exists in
>  target until Root.
>                         Node parentNode = fileNode.getParent();
>                         while(!parentNode.getPath().equals("/") &&
>  !targetRoot.hasNode(removeLeadingSlash(parentNode.getPath()))){
>                             //Current Parent doesn't exists in Target move
>  up one generation.
>                             fileNode = parentNode;
>                             parentNode = parentNode.getParent();
>                         }
>
>  targetSession.getWorkspace().clone(srcSession.getWorkspace().getName(),
>  fileNode.getPath(), fileNode.getPath(), false);
>  ...
>
>  I think the problem is with stateMgr.hasItemState(id) in
>  BatchedItemOperations.java which returns true on the UUID which isn't in
>  that particular workspace but another one in the same repository which might
>  be sharing the same cache.
>
>                 case CLONE:
>                     if (!referenceable) {
>                         // non-referenceable node: always create new uuid
>                         id = new NodeId(UUID.randomUUID());
>                         break;
>                     }
>                     // use same uuid as source node
>                     id = srcState.getNodeId();
>                     if (stateMgr.hasItemState(id)) {
>                         // node with this uuid already exists
>                         throw new ItemExistsException(safeGetJCRPath(id));
>                     }
>                     break;
>
>
>
>  I would appreciate if you can let me know if this is a bug or if something
>  is wrong with my settings.

is there a chance that you can put together a simple test case?
i couldn't find anything wrong in your code snippet and would like
to try to reproduce the issue or see if there's anything wrong
in the test case.

could you please also provide your configuration? incorret configuration
could theoretically be the cause of such issues.

thanks
stefan

>
>  Thanks,
>  Anup Chatterjee
>  --
>  View this message in context: http://www.nabble.com/Problems-with-Cloning-of-folders-within-workspaces-tp16921068p16921068.html
>  Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message