2 Replies Latest reply on Jul 17, 2012 8:59 PM by Tony Herstell

    Firkling with the JBoss7 setup.

    Tony Herstell Master

      I have been trying to firkle with the Jboss 7 setup [standalone-modeshape.xml] (the one we unzip over 7.1.x) to create my own repository and workspace.

       

      The closest I got was creating a repository with the name apiarymanager but alas I could not figureout the changes to create a workspace named documents that worked.

       

      I wold have assumed the changes would be limited to this area:

       

      <!-- Each ModeShape repository uses one (or more) cache in a cache container. We define a single container

                       named "modeshape" (other names require specifying the container names in each repository configuration,

                       with a "sample" cache (each repository assumes the cache name matches the repository name). -->

                  <cache-container name="modeshape" default-cache="sample">

                      <local-cache name="sample">

                          <!-- ModeShape requires transactions -->

                          <transaction mode="NON_XA"/>

                          <!-- Use a cache with file-backed write-through storage. File-backed storage is simple, but not necessarily the fastest. -->

                          <file-store passivation="false" path="modeshape/store/sample" relative-to="jboss.server.data.dir" purge="false"/>

                      </local-cache>

                      <local-cache name="artifacts">

                          <!-- ModeShape requires transactions -->

                          <transaction mode="NON_XA"/>

                          <!-- Use a cache with file-backed write-through storage. File-backed storage is simple, but not necessarily the fastest. -->

                          <file-store passivation="false" path="modeshape/store/artifacts" relative-to="jboss.server.data.dir" purge="false"/>

                      </local-cache>

                  </cache-container>

              </subsystem>

              <subsystem xmlns="urn:jboss:domain:modeshape:1.0">

                  <!-- A sample repository that uses the "sample" cache in the "modeshape" container. All content, binary values,

                       and indexes are stored within the server's data directory. This is the simplest way to configure a repository

                       that uses defaults for everything; feel free to change and specify other configuration options.  -->

                  <repository name="sample"/>

                  <!-- A second sample repository that defines additional non-default components such as extra workspaces and sequencers. -->

                  <repository name="artifacts">

                      <!-- Define 3 workspaces to exist upon startup -->

                      <workspaces default-workspace="default" allow-workspace-creation="false">

                          <workspace name="default"/>

                          <workspace name="other"/>

                          <workspace name="extra"/>

                      </workspaces>

       

      I guessed at something like chaning sample to apiarymanager and creating a new workspaces called documents under that

      e.g.

      <subsystem xmlns="urn:jboss:domain:modeshape:1.0">

                  <repository name="apairymanager"/>

                  <workspaces default-workspace="documents" allow-workspace-creation="false">

                          <workspace name="documents"/>

                      </workspaces>

       

      then set local cache to :

      <local-cache name="apairymanager">

                          <transaction mode="NON_XA"/>

                          <file-store passivation="false" path="modeshape/store/apairymanager" relative-to="jboss.server.data.dir" purge="false"/>

                      </local-cache>

       

      What am I doing wrong?

       

      I assume I can then just pop in all those sequencers as well under the </workspaces> tag.

        • 1. Re: Firkling with the JBoss7 setup.
          Tony Herstell Master

          Of course:

           

              @Resource(mappedName = "java:/jcr/apiarymanager")

              private javax.jcr.Repository repository;

           

          and

           

               Credentials credentials = new SimpleCredentials("admin", "admin".toCharArray());

                  session = repository.login(credentials); // was "default"

                   logger.info("session: " + session + " obtained for repository "

                          + repository.getDescriptor(repository.REP_NAME_DESC));

          • 2. Re: Firkling with the JBoss7 setup.
            Tony Herstell Master

            Hum.. was simple after all..

             

              

                 *  Setup in JBoss7 JBoss7 JBoss7 JBoss7 JBoss7 JBoss7 JBoss7 JBoss7 JBoss7 JBoss7 JBoss7 JBoss7 JBoss7 JBoss7

                 *   <cache-container name="modeshape" default-cache="apiarymanager">

                 *      <local-cache name="apiarymanager">

                 *          <transaction mode="NON_XA"/>

                 *          <file-store relative-to="jboss.server.data.dir" path="modeshape/store/apiarymanager" passivation="false" purge="false"/>

                 *      </local-cache>

                 *      ...

                 *      </cache-container>

                 *

                 *  <subsystem xmlns="urn:jboss:domain:modeshape:1.0">

                 *      <repository name="sample"/>

                 *      <repository name="apiarymanager"/>

             

                @Resource(mappedName = "java:/jcr/apiarymanager")

                private javax.jcr.Repository repository;

             

            ...

                    Session session = repository.login(getAdminCredentials());

            ...

             

                    private Credentials getAdminCredentials() {

                         Credentials credentialsToReturn = null;

             

                          // This gets a session for using the "default" workspace.

                          credentialsToReturn = new SimpleCredentials("admin", "admin".toCharArray());

             

                          return credentialsToReturn;

                     }