Version 12

    Out of the box Guvnor ships with JackRabbit as the default underlaying JCA repository implemantation. However, since version 5.1 it is possible to switch Guvnor to use ModeShape instead. In this article I will explain how to switch to ModeShape.

     

    1. Start with a fresh JBossAS-5.1, which can be downloaded from here.
    2. Download the ModeShape kit, which is a ZIP file with everything needed to run ModeShape as a service in a JBoss AS profile. Use version 2.5.0 or newer.
    3. Download out the guvnor-5.2.0-SNAPSHOT-jboss-as-5.1.war.
    4. Unzip ModeShape into the default profile of the appserver.
      • unzip <download-dir>/jboss-5.1.GA.zip
      • cd jboss-5.1.0.GA/server/default
      • unzip <download-dir/modeshape-2.5.0.Final-jbossas-dist.zip
    5. Now you can deploy guvnor.war
      • cd deploy
      • mkdir guvnor.war
      • cd guvnor.war
      • unzip <guvnor-build-dir>/guvnor-webapp/target/guvnor-webapp.war
    6. We don't need the JackRabbit jars anymore, modeshape already put the jcr-2.0.jar in the lib directory, and modeshape uses the hibernate jar that ship with jbossas, which means we can remove the following jars from the guvnor.war:
      • rm -f WEB-INF/lib/jackrabbit-*
      • rm -f WEB-INF/lib/hibernate-* persistence-api-1.0.jar lucene-core-2.4.1.jar
      • rm -f WEB-INF/lib/jcr-2.0.jar
    7. Now we need to change the guvnor configuration, so that it uses modeshape. To do this open the WEB-INF/components.xml in your favorite editor.
      • comment out the jackrabbit property settings, so it looks like:
        • {code:xml}<!-- JackRabbit

           

                  <property name="properties">

                      <key>org.drools.repository.configurator</key><value>org.drools.repository.jackrabbit.JackrabbitRepositoryConfigurator</value>

                  -->

                      <!--  the root directory for the repo storage the directory must exist. -->

                      <!--  <key>repository.root.directory</key><value>/opt/yourpath</value>  -->

                  <!--

                  </property>

                  -->{code}

      • uncomment the modeshape property settings, so it looks like
        • {code:xml}<!-- ModeShape

                      passwords for the background users (admin and mailman), these need to match the setting

                      you provided for JAAS (used by ModeShape only).

                  -->

                      <property name="properties">

                          <key>org.drools.repository.configurator</key>    <value>org.drools.repository.modeshape.ModeShapeRepositoryConfigurator</

          value>

                          <key>org.modeshape.jcr.URL</key>                 <value>jndi:jcr/local?repositoryName=repository</value>

                          <key>org.drools.repository.secure.passwords</key><value>false</value>

                          <key>org.drools.repository.logInAdmin.password</key>  <value>logInAdmin</value>

                          <key>org.drools.repository.mailman.password</key><value>mailman</value>

                      </property>{code}

      • ModeShape uses JAAS, so we should switch Guvnor over the use JAAS as well, therefore comment out the nilAuthentication section so it looks like
        • {code:xml}<!--

                  NO authentication. This will bypass the login screen when you hit the

                  app. Everyone is "guest"

                  <security:identity

                  authenticate-method="#{nilAuthenticator.authenticate}"/>

              -->{code}

      • Now enable JAAS security by uncommenting the jaas configuration section so it looks like
        • {code:xml}<!--

                  FOR EXAMPLE: the following one will use the jaas configuration called

                  "other" - which in jboss AS means you can use properties files for

                  users:

              -->

                  <security:identity authenticate-method="#{authenticator.authenticate}"

                  jaas-config-name="other"/>{code}

      • We want to be using the policy configured for ModeShape, which is called 'modeshape'. This policy is defined in the deploy/modeshape-jboss-beans.xml file. In order to use this policy change 'other' to 'modeshape' in the above JAAS section:
        • {code:xml}<security:identity authenticate-method="#{authenticator.authenticate}"

                  jaas-config-name="modeshape"/>{code}

    8. You may have noticed the settings of two passwords in the modeshape property settings for the 'admin' and 'mailman' users. These users are used by guvnor to perform background tasks. Now that we are no longer allowing for anyone to run as 'guest', we need to ass these two users to the modeshape users and roles files.
      • open the conf/props/modeshape-users.properties file and add the logInAdmin and mailman users,
        • {code}

          logInAdmin=logInAdmin

          mailman=mailman{code}

      • open the conf/props/modeshape-roles.properties file and add the logInAdmin and mailman role,
        • {code}

          logInAdmin=connect,admin

          mailman=connect,readonly,readwrite{code}

    9. Congrats, you are now ready to use Guvnor using ModeShape by going to http://localhost:8080/guvnor and logging in with logInAdmin/logInAdmin. Note that the ModeShape runs in memory by default, here is an article from the ModeShape guys if you want to back it with a JDBC datasource.

     

    Cheers,

     

    --Kurt