2 Replies Latest reply on Feb 4, 2015 12:01 PM by paolo.barberis.73

    How to create a new workspace in Modeshape manually

    paolo.barberis.73

      We are working with this platform:

       

      JBoss 6.1.0.GA

      Modeshape 3.6.0

       

      I just need to create a new workspace and to put inside images,javascripts, and other files I need for a webapp we are developing.

      I tried to connect via webdav to our modeshape repository and create a new test directory inside, but I always receive this exception:

      2015-02-03 16:47 WARN  [org.modeshape.web.jcr.webdav.ModeShapeWebdavStore] (http-/0.0.0.0:8021-1) Cannot obtain a session for the repository 'repository': The workspace test was not found

      I looked on stackoverflow and on the official guide of modeshape, but I still cannot catch how to do this "easy" task.

      It seems there's no documentation that explains how to manually create a new workspace in a repository.

       

      Anybody has an idea of how to do this?

        • 1. Re: How to create a new workspace in Modeshape manually
          rhauch

          Be sure that when logging in to get a Session that you specify the name of your workspace.

           

          You can either configure it in the repository configuration; in your case, within the "standalone-modeshape.xml" of your EAP installation, or whatever EAP configuration file you're using. There's already an example in that file:

           

          <repository name="artifacts">
           
          <!-- ... -->
           
          <!-- Define 3 workspaces to exist upon startup -->
           
          <workspaces default-workspace="default" allow-workspace-creation="false">
            
          <workspace name="default">
              
          <initial-content>initial-content-default.xml</initial-content>
            
          </workspace>
            
          <workspace name="other"/>
            
          <workspace name="extra"/>
           
          </workspaces>
           
          <!-- ... -->
          <repository name="artifacts">

           

          The same is true for Wildfly with ModeShape 4.x.

           

          For those using ModeShape outside of EAP or Wildfly, you can configure this in your JSON repository configuration file. Here's a fragment that does the same thing as the XML fragment above:

           

          "workspaces" : {
            
          "predefined" : ["other", "extra"],
            
          "default" : "default",
            
          "allowCreation" : true,
            
          "initialContent" : {
              
          "default" : "initial-content-default.xml"
            
          }
          },

           

          And finally, if your configuration allows workspace creation, you can programmatically create workspaces using the standard JCR API.

           

          (I also answered your Stack Overflow question.)

          • 2. Re: How to create a new workspace in Modeshape manually
            paolo.barberis.73

            Thanks,

             

            I managed to make this work only upgrading the environment to:

             

            JBoss 6.3 EAP and Modeshape 3.8.1