4 Replies Latest reply on Mar 25, 2014 3:54 PM by chieukam

    How to programmatically shutdown or/and restart a repository

    chieukam

      Hello,


      we are actually using modeshape as our content repository to store many various binary files.


      The caches (main repository cache and binary cache) are configured to store all the data into a database.


      Our client decided in the last discussion to use database export (from quality assurance environment) and import (to the production environment) since it is a well known process in that company.

       

      As we don't want to restart the JBoss server after each data import into the production environment, the idea is to restart the corresponding repository at a given time (still to be defined).

       

      There are actually two ways (public methods) to start the server using modeshape:

      1. org.modeshape.jcr.JcrRepository#login (with or without parameters)

      2. org.modeshape.jcr.JcrRepository#getStartupProblems

       

      But actually there is no public method to shutdown the repository or/ one method to restart (shutdown+start) the repository: Why?

       

      After database update trying using the org.modeshape.jcr.api.Workspace#reindex (sync, async) doesn't work. My guest is that reindexing doesn't fetch data from the datasource

       

      Are there better ways to achieve what i am trying to do?

       

       

      I am currently running JBoss EAP 6.1.x and modeshape 3.6.0.

       

      Thanks in advance for the help,

      Willie

        • 1. Re: How to programmatically shutdown or/and restart a repository
          rhauch

          Although you said you're running EAP 6.1.x and ModeShape 3.6.0, you've not stated whether you're running the ModeShape subsystem for EAP or embedding ModeShape in your application(s).

           

          If the latter, have a look at our documentation for the repository deploy/undeploy methods on the ModeShapeEngine.

           

          If using the ModeShape subsystem, you'll use the command line interface (CLI) or remote admin API to interface with the subsystem. Again, look at our documentation for details on how to reload the ModeShape subsystem.

          1 of 1 people found this helpful
          • 2. Re: How to programmatically shutdown or/and restart a repository
            chieukam

            Hello Randall,

            many thanks for the hint.

             

            I am running the Modeshape subsystem for EAP. I just tested the reload command of the Command line interface and it worked fine for me. Actually not just the Modeshape subsystem but all other subsystems are reloaded using the following command:

             

            $JBOSS_HOME/bin/jboss-cli.sh --connect --command="reload"

             

            I could not find a way to start just the modeshape subsystem.

             

            Regards,

            • 3. Re: How to programmatically shutdown or/and restart a repository
              rhauch

              The CLI is pretty powerful, and you can do lots of things in various places. For example, while at the top, you should be able to do this:


              [standalone@localhost:9999 /] ./subsystem=modeshape/repository=sample:reload

               

              or, you can navigate from the root into the repository and reload from there ...

               

              [standalone@localhost:9999 /] cd /subsystem=modeshape/repository=sample

              [standalone@localhost:9999 /subsystem=modeshape/repository=sample] :reload


              • 4. Re: How to programmatically shutdown or/and restart a repository
                chieukam

                1. When entering ":" and pressing the tab key below the list of available properties

                [standalone@localhost:9999 subsystem=modeshape] :
                add    read-children-resources     read-operation-names        remove     write-attribute             
                read-attribute     read-children-types         read-resource    undefine-attribute          
                read-children-names         read-operation-description  read-resource-description   whoami 
                

                 

                The "reload" property is not part of it showing that i can use it specific for this subsystem as for example the "add" property

                 

                2. when just the pressing the tab key below the list of available properties

                [standalone@localhost:9999 subsystem=modeshape] 
                alias               connect             echo-dmr            ls                  read-operation      undeploy            
                batch               data-source         help                module              reload              version             
                cd                  deploy              history             pwd                 run-batch           xa-data-source      
                clear               deployment-info     if                  quit                shutdown            :                   
                command             deployment-overlay  jdbc-driver-info    read-attribute      try  
                

                 

                The "reload" property is now available in the list of global properties which always apply to the whole server. This explains why all subsystems are reloaded for me

                 

                I am just wondering why the ":reload" command is working for you. Which version of JBoss are you using?

                 

                May be i am missing some configurations. I am using JBoss Enterprise Application Platform - Version 6.1.0.GA