2 Replies Latest reply on Jan 9, 2011 2:55 PM by Souvik Dutta

    Sequencing using source in one repository to destination in another fails?

    Souvik Dutta Newbie

      I am trying out a Modeshape configuration which essentially has two repositories, each with their own stores and default workspaces. I am trying to upload images into one. The image sequencer should sequence the added nodes and store the image metadata in the other. Both are in-memory repositories for now. Here's the code:

       

                  String repoId = "content";
                  String repoSrcId = "store";
                  String workSpace = "images";

       

                  String metaRepoId = "metadata";
                  String metaRepoSrcId = "imageexif";
                  String metaWorkSpace = "info";

       

                  // Configuration
                  JcrConfiguration config = new JcrConfiguration();

       

                  // Image repository source

                  config.repositorySource(repoSrcId).usingClass(
                          InMemoryRepositorySource.class).setDescription(
                          "The repository for our content").setProperty(
                          "defaultWorkspaceName", workSpace);

       

                  // Metadata repository source

                  config.repositorySource(metaRepoSrcId).usingClass(
                          InMemoryRepositorySource.class).setDescription(
                          "The meta repository for our content").setProperty(
                          "defaultWorkspaceName", metaWorkSpace);

       

                  // Image repository

                  config.repository(repoId)
                          .registerNamespace(ImageMetadataLexicon.Namespace.PREFIX,
                                  ImageMetadataLexicon.Namespace.URI).setSource(
                                  repoSrcId);

       

                  // Metadata repository

                  config.repository(metaRepoId)
                          .addNodeTypes("sequencing.cnd")
                          .registerNamespace("example", "http://www.example.com/exif")
                          .setSource(metaRepoSrcId);

       

                  // Sequencer

                  config.sequencer("Image Sequencer")
                          .usingClass(
                                  "org.modeshape.sequencer.image.ImageMetadataSequencer")
                          .loadedFromClasspath()
                          .setDescription(
                                  "Sequences image files to extract the characteristics of the image")
                          .sequencingFrom(
                                  "store:images://(*.(jpg|jpeg|gif|bmp|pcx|png|iff|ras|pbm|pgm|ppm|psd)[*])/jcr:content[@jcr:data]")
                          .andOutputtingTo("imageexif:info:/$1");

       

       

      When I run this, I get the following exception:

       

      21:04:03,445 ERROR Error finding sequencers to run against node 2010-12-30T15:34:03.298Z @<anonymous> [store] - 2 changes
      org.modeshape.graph.request.InvalidWorkspaceException: The workspace "info" does not exist in the "store" repository
          at org.modeshape.graph.connector.base.Processor.getWorkspace(Processor.java:629)
          at org.modeshape.graph.connector.base.Processor.process(Processor.java:510)
          at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:311)
          at org.modeshape.graph.connector.base.Connection.execute(Connection.java:115)
          at org.modeshape.graph.Graph.execute(Graph.java:283)
          at org.modeshape.graph.Graph$5.process(Graph.java:226)
          at org.modeshape.graph.request.RequestBuilder.verifyWorkspace(RequestBuilder.java:72)
          at org.modeshape.graph.Graph.useWorkspace(Graph.java:377)
          at org.modeshape.repository.sequencer.StreamSequencerAdapter.execute(StreamSequencerAdapter.java:192)
          at org.modeshape.repository.sequencer.SequencingService.processChange(SequencingService.java:494)
          at org.modeshape.repository.sequencer.SequencingService$RepositoryObserver$1.run(SequencingService.java:645)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:662)

       

      Modeshape is ignoring the "imageexif" source in the output configuration and is trying to find the "info" workspace in the "store" source instead. The documentation says the sequencer can be configured to sequence from one source / workspace to another. Unfortunately, this is not happening. Am I missing something?

       

       

      String repoId = "content";
      String repoSrcId = "store";
      String workSpace = "images";
      String metaRepoId = "metadata";
      String metaRepoSrcId = "imageexif";
      String metaWorkSpace = "info";
      // Configuration
      JcrConfiguration config = new JcrConfiguration();