3 Replies Latest reply on Nov 27, 2012 10:57 AM by Randall Hauch

    Variable replacement not working in ModeShape 3.0.0.Final

    Rick Cole Newbie

      I am trying to use variable replacement in the repository json configuration file to dynamically set the location of the repository files at startup. However, I have found that it is not working. Upon closer inspection of the code, I see the following call in the org.modeshape.jcr.RepositoryConfiguration class:

       

          protected static Document replaceSystemPropertyVariables( Document doc ) {

              if (doc.isEmpty()) return doc;

              Document modified = doc.withVariablesReplacedWithSystemProperties();

              if (modified == doc) return doc;

       

       

              // Otherwise, we changed some values. Note that the system properties can only be used in

              // string values, whereas the schema may expect non-string values. Therefore, we need to validate

              // the document against the schema and possibly perform some conversions of values ...

              return SCHEMA_LIBRARY.convertValues(doc, JSON_SCHEMA_URI);

          }

       

      From this, it looks like the 'modified' document is created, then it is ignored and not sent back to the caller. This means that the variable replacement is not getting back to the caller. I can see that the variables are properly replaced in the 'modified' document, but they are not replaced in the returned document. It would seem that we should use 'modified' in the call to convertValues(). Or, am I doing something wrong?

       

      Rick