You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Alexander Klimetschek (JIRA)" <ji...@apache.org> on 2008/01/10 14:16:34 UTC

[jira] Created: (JCR-1304) Support system properties in ${...} vars in XML config files

Support system properties in ${...} vars in XML config files
------------------------------------------------------------

                 Key: JCR-1304
                 URL: https://issues.apache.org/jira/browse/JCR-1304
             Project: Jackrabbit
          Issue Type: New Feature
          Components: config, jackrabbit-jcr-commons
    Affects Versions: 1.3.3, 1.4, 1.5
            Reporter: Alexander Klimetschek


The variable replacement (${...}) in config files like repository.xml currently only allows for the special variables introduced by Jackrabbit, eg. ${wsp.name} or ${rep.home}. But it would be useful to support all java system properties here as it is some kind of a standard in Java XML config files (see Spring for an example).

This makes it easier to inject variables from outside the config file, eg. by setting them on the command line or injecting them programmatically in test cases. Typical parameters for that include database connection credentials, which one wants to avoid to put into repository.xml files that are often checked into SVN.

This is especially true for test cases, eg. I currently work on a persistence manager component and I want to include the repository.xml in the source tree (under applications/test) but without my specific credentials. These are applied by loading a user-specific properties file through the test case before the repository is started and the config is read.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-1304) Support system properties in ${...} vars in XML config files

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1304?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting resolved JCR-1304.
--------------------------------

    Resolution: Fixed

Committed my patch in revision 611143 and merged it to the 1.4 branch in revision 611145.

> Support system properties in ${...} vars in XML config files
> ------------------------------------------------------------
>
>                 Key: JCR-1304
>                 URL: https://issues.apache.org/jira/browse/JCR-1304
>             Project: Jackrabbit
>          Issue Type: New Feature
>          Components: config, jackrabbit-core
>            Reporter: Alexander Klimetschek
>            Assignee: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: enable-system-props-in-config-vars.patch, JCR-1304.patch, JCR-1304.patch
>
>
> The variable replacement (${...}) in config files like repository.xml currently only allows for the special variables introduced by Jackrabbit, eg. ${wsp.name} or ${rep.home}. But it would be useful to support all java system properties here as it is some kind of a standard in Java XML config files (see Spring for an example).
> This makes it easier to inject variables from outside the config file, eg. by setting them on the command line or injecting them programmatically in test cases. Typical parameters for that include database connection credentials, which one wants to avoid to put into repository.xml files that are often checked into SVN.
> This is especially true for test cases, eg. I currently work on a persistence manager component and I want to include the repository.xml in the source tree (under applications/test) but without my specific credentials. These are applied by loading a user-specific properties file through the test case before the repository is started and the config is read.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1304) Support system properties in ${...} vars in XML config files

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1304?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-1304:
-------------------------------

          Component/s:     (was: jackrabbit-jcr-commons)
                       jackrabbit-core
        Fix Version/s: 1.4
             Assignee: Jukka Zitting
             Priority: Minor  (was: Major)
    Affects Version/s:     (was: 1.3.3)
                           (was: 1.4)
                           (was: 1.5)

> Support system properties in ${...} vars in XML config files
> ------------------------------------------------------------
>
>                 Key: JCR-1304
>                 URL: https://issues.apache.org/jira/browse/JCR-1304
>             Project: Jackrabbit
>          Issue Type: New Feature
>          Components: config, jackrabbit-core
>            Reporter: Alexander Klimetschek
>            Assignee: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: enable-system-props-in-config-vars.patch, JCR-1304.patch, JCR-1304.patch
>
>
> The variable replacement (${...}) in config files like repository.xml currently only allows for the special variables introduced by Jackrabbit, eg. ${wsp.name} or ${rep.home}. But it would be useful to support all java system properties here as it is some kind of a standard in Java XML config files (see Spring for an example).
> This makes it easier to inject variables from outside the config file, eg. by setting them on the command line or injecting them programmatically in test cases. Typical parameters for that include database connection credentials, which one wants to avoid to put into repository.xml files that are often checked into SVN.
> This is especially true for test cases, eg. I currently work on a persistence manager component and I want to include the repository.xml in the source tree (under applications/test) but without my specific credentials. These are applied by loading a user-specific properties file through the test case before the repository is started and the config is read.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1304) Support system properties in ${...} vars in XML config files

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1304?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Klimetschek updated JCR-1304:
---------------------------------------

    Attachment: enable-system-props-in-config-vars.patch

Patches the o.a.j.util.Text.replaceVariables() method in jackrabbit-jcr-commons to look for system properties as well.

The jackrabbit specific properties are still inspected first, but if none is found, a lookup via System.getProperty() is made. If that fails, the behaviour is as before, ie. it either returns "" or throws an exception, depending on the is ignoreMissing variable.

As the Text class hasn't change over that last releases, this patch can be applied to 1.3, 1.4 and 1.5 (trunk) branches. (That's why I set the affects version field to those)

> Support system properties in ${...} vars in XML config files
> ------------------------------------------------------------
>
>                 Key: JCR-1304
>                 URL: https://issues.apache.org/jira/browse/JCR-1304
>             Project: Jackrabbit
>          Issue Type: New Feature
>          Components: config, jackrabbit-jcr-commons
>    Affects Versions: 1.3.3, 1.4, 1.5
>            Reporter: Alexander Klimetschek
>         Attachments: enable-system-props-in-config-vars.patch
>
>
> The variable replacement (${...}) in config files like repository.xml currently only allows for the special variables introduced by Jackrabbit, eg. ${wsp.name} or ${rep.home}. But it would be useful to support all java system properties here as it is some kind of a standard in Java XML config files (see Spring for an example).
> This makes it easier to inject variables from outside the config file, eg. by setting them on the command line or injecting them programmatically in test cases. Typical parameters for that include database connection credentials, which one wants to avoid to put into repository.xml files that are often checked into SVN.
> This is especially true for test cases, eg. I currently work on a persistence manager component and I want to include the repository.xml in the source tree (under applications/test) but without my specific credentials. These are applied by loading a user-specific properties file through the test case before the repository is started and the config is read.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1304) Support system properties in ${...} vars in XML config files

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557654#action_12557654 ] 

Alexander Klimetschek commented on JCR-1304:
--------------------------------------------

I just found nothing using Text.replaceVariables apart from the config files ;-)

Is RepositoryConfig.create ok? AFAIU it parses repository.xml. What about a workspace.xml of an exisiting workspace? Will it still contain the variables or are they replaced by their values when the workspace.xml is created?

> Support system properties in ${...} vars in XML config files
> ------------------------------------------------------------
>
>                 Key: JCR-1304
>                 URL: https://issues.apache.org/jira/browse/JCR-1304
>             Project: Jackrabbit
>          Issue Type: New Feature
>          Components: config, jackrabbit-jcr-commons
>    Affects Versions: 1.3.3, 1.4, 1.5
>            Reporter: Alexander Klimetschek
>         Attachments: enable-system-props-in-config-vars.patch, JCR-1304.patch
>
>
> The variable replacement (${...}) in config files like repository.xml currently only allows for the special variables introduced by Jackrabbit, eg. ${wsp.name} or ${rep.home}. But it would be useful to support all java system properties here as it is some kind of a standard in Java XML config files (see Spring for an example).
> This makes it easier to inject variables from outside the config file, eg. by setting them on the command line or injecting them programmatically in test cases. Typical parameters for that include database connection credentials, which one wants to avoid to put into repository.xml files that are often checked into SVN.
> This is especially true for test cases, eg. I currently work on a persistence manager component and I want to include the repository.xml in the source tree (under applications/test) but without my specific credentials. These are applied by loading a user-specific properties file through the test case before the repository is started and the config is read.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1304) Support system properties in ${...} vars in XML config files

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1304?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-1304:
-------------------------------

    Attachment: JCR-1304.patch

Good point about the workspace config, the attached updated version of my patch addresses this.

Text.replaceVariables is probably not used elsewhere within Jackrabbit, but I'd still be wary of changing the API. The current API is clean and simple and a client can trivially include (or exclude) system properties in the set of properties being replaced.

> Support system properties in ${...} vars in XML config files
> ------------------------------------------------------------
>
>                 Key: JCR-1304
>                 URL: https://issues.apache.org/jira/browse/JCR-1304
>             Project: Jackrabbit
>          Issue Type: New Feature
>          Components: config, jackrabbit-jcr-commons
>    Affects Versions: 1.3.3, 1.4, 1.5
>            Reporter: Alexander Klimetschek
>         Attachments: enable-system-props-in-config-vars.patch, JCR-1304.patch, JCR-1304.patch
>
>
> The variable replacement (${...}) in config files like repository.xml currently only allows for the special variables introduced by Jackrabbit, eg. ${wsp.name} or ${rep.home}. But it would be useful to support all java system properties here as it is some kind of a standard in Java XML config files (see Spring for an example).
> This makes it easier to inject variables from outside the config file, eg. by setting them on the command line or injecting them programmatically in test cases. Typical parameters for that include database connection credentials, which one wants to avoid to put into repository.xml files that are often checked into SVN.
> This is especially true for test cases, eg. I currently work on a persistence manager component and I want to include the repository.xml in the source tree (under applications/test) but without my specific credentials. These are applied by loading a user-specific properties file through the test case before the repository is started and the config is read.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1304) Support system properties in ${...} vars in XML config files

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1304?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-1304:
-------------------------------

    Attachment: JCR-1304.patch

Instead of changing the contract of Text.replaceVariables (there might be cases where you *don't* want system properties) I'd just change RepositoryConfig.create. See the attached JCR-1304.patch.

> Support system properties in ${...} vars in XML config files
> ------------------------------------------------------------
>
>                 Key: JCR-1304
>                 URL: https://issues.apache.org/jira/browse/JCR-1304
>             Project: Jackrabbit
>          Issue Type: New Feature
>          Components: config, jackrabbit-jcr-commons
>    Affects Versions: 1.3.3, 1.4, 1.5
>            Reporter: Alexander Klimetschek
>         Attachments: enable-system-props-in-config-vars.patch, JCR-1304.patch
>
>
> The variable replacement (${...}) in config files like repository.xml currently only allows for the special variables introduced by Jackrabbit, eg. ${wsp.name} or ${rep.home}. But it would be useful to support all java system properties here as it is some kind of a standard in Java XML config files (see Spring for an example).
> This makes it easier to inject variables from outside the config file, eg. by setting them on the command line or injecting them programmatically in test cases. Typical parameters for that include database connection credentials, which one wants to avoid to put into repository.xml files that are often checked into SVN.
> This is especially true for test cases, eg. I currently work on a persistence manager component and I want to include the repository.xml in the source tree (under applications/test) but without my specific credentials. These are applied by loading a user-specific properties file through the test case before the repository is started and the config is read.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.