2 Replies Latest reply on Nov 10, 2014 10:23 AM by mustafamizrak

    ModeShape File System External Resource Move Problem

    mustafamizrak

      Hi,

       

      I configured ModeShape with external resources. My aim is to move "data" between internal and external resources as well as between external resources in same workspace.

       

       

      From internal to external resource with session.move() command, I get the following exception

       

      (javax.jcr.RepositoryException) javax.jcr.RepositoryException: Unable to move the nodes because the source path "/{}files_external_src/{}sample_uuid" contains at least a node which belongs to the external source "externalFsSource"
      

       

      From external resource to another external resource with session.move() command, I get the following exception

      (javax.jcr.RepositoryException) javax.jcr.RepositoryException: Unable to move the nodes because the source nodes belong to the "externalFsSource_src" source while the destination node belongs to the "externalFsSource_dst" source
      

       

      From external resource to another external resource with session.getWorkspace().clone(workspace, src, dst, true) or session.getWorkspace().clone(workspace, src, dst, false) commands, I get the following exception

      (javax.jcr.RepositoryException) javax.jcr.RepositoryException: Unable to perform the clone operation in the same workspace because at least one of the source nodes belongs to the "externalFsSource" source
      

       

       

      Is there any idea to handle that problem or do we skip any additional configuration?

       

      Regards,

        • 1. Re: ModeShape File System External Resource Move Problem
          rhauch

          You need to manually copy the contents from one location to another, and then remove the original. This is quite simple to do, but there are some assumptions that have to be made. If we were to do implement "move", then most app developers would be unaware of those assumptions.

           

          For example, connectors are not XA resources, so "move" cannot be implemented in a transactionally safe way. Of course, most applications won't need it to be, but client developers that implement simple copy-and-delete logic will now be aware of this.

           

          Secondly, it's easy to "move" an ancestor of a tree, but if that tree contains large amounts of information (including very large binary values) then ModeShape's move implementation would take a substantial amount of time. When app developers are responsible for the logic, they have to think about what they're doing.

           

          UPDATE: See MODE-1977 for what does and does not work when moving federated nodes.

          • 2. Re: Re: ModeShape File System External Resource Move Problem
            mustafamizrak

            I applied copy-and-delete logic to the implementation.

             

            This idea worked for external-to-external as expected. In other words, copying binary file from one external resource A to another external resource B and delete node from external resource A worked perfectly.

            However, copy-and-delete logic does not work for internal-to-external. Copy of binary file from internal resources to external resource is unproblematic but delete node and its children from internal node is still problem since deleted node and its children are remained in its original path.

             

            Although I have configured garbageCollection with CLI command /subsystem=modeshape/repository=sample:write-attribute(name=garbage-collection-interval,value="1"), it seems that it does not work.

            How can I handle this problem?


            Any help is appreciated!

             

            Best regards,