[xwiki-devs] [Proposal] Refactoring of xwiki-configuration module
Hi, I'd like to modify the configuration module so that it can support adding dynamic configuration data (located in XWikiPreferences, WebPreferences or other). I'd like to propose: * We remove the notion of ConfigurationManager * We make ConfigurationSource components * We create a XWikiPropertiesConfigurationSource (hint = "xwikiproperties") * (future) We create XWikiPreferencesDocumentConfigurationSource, SpacePreferencesDocumentConfigurationSource, UserPreferencesDocumentConfigurationSource components * Create a DefaultConfigurationSource component (hint = "default") which has @Requirement("xwikiproperties") (and other sources later on). It's a composite ConfigurationSource which calls the various internal sources in the right order. In term of usage here's what you'd write. For example for DefaultRenderingConfiguration: @Component public class DefaultRendernigConfiguration implements RenderingConfiguration { @Requirement ConfigurationSource source; private static final String PREFIX = "rendering."; private static final String DEFAULT_LINK_LABEL_FORMAT = "%p"; public String getLinkLabelFormat() { return (String) this.source.getProperty(PREFIX + "linkLabelFormat", DEFAULT_LINK_LABEL_FORMAT); } } WDYT? Thanks -Vincent
+1 We need to be able to ask for property when we need it because *DocumentConfigurationSource will get the information bases on the current context (depending on the wiki, the space etc...). On Wed, Jun 17, 2009 at 16:05, Vincent Massol<[email protected]> wrote:
Hi,
I'd like to modify the configuration module so that it can support adding dynamic configuration data (located in XWikiPreferences, WebPreferences or other).
I'd like to propose: * We remove the notion of ConfigurationManager * We make ConfigurationSource components * We create a XWikiPropertiesConfigurationSource (hint = "xwikiproperties") * (future) We create XWikiPreferencesDocumentConfigurationSource, SpacePreferencesDocumentConfigurationSource, UserPreferencesDocumentConfigurationSource components * Create a DefaultConfigurationSource component (hint = "default") which has @Requirement("xwikiproperties") (and other sources later on). It's a composite ConfigurationSource which calls the various internal sources in the right order.
In term of usage here's what you'd write. For example for DefaultRenderingConfiguration:
@Component public class DefaultRendernigConfiguration implements RenderingConfiguration { @Requirement ConfigurationSource source;
private static final String PREFIX = "rendering.";
private static final String DEFAULT_LINK_LABEL_FORMAT = "%p";
public String getLinkLabelFormat() { return (String) this.source.getProperty(PREFIX + "linkLabelFormat", DEFAULT_LINK_LABEL_FORMAT); } }
WDYT?
Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
+1 Vincent Massol wrote:
Hi,
I'd like to modify the configuration module so that it can support adding dynamic configuration data (located in XWikiPreferences, WebPreferences or other).
I'd like to propose: * We remove the notion of ConfigurationManager * We make ConfigurationSource components * We create a XWikiPropertiesConfigurationSource (hint = "xwikiproperties") * (future) We create XWikiPreferencesDocumentConfigurationSource, SpacePreferencesDocumentConfigurationSource, UserPreferencesDocumentConfigurationSource components * Create a DefaultConfigurationSource component (hint = "default") which has @Requirement("xwikiproperties") (and other sources later on). It's a composite ConfigurationSource which calls the various internal sources in the right order.
In term of usage here's what you'd write. For example for DefaultRenderingConfiguration:
@Component public class DefaultRendernigConfiguration implements RenderingConfiguration { @Requirement ConfigurationSource source;
private static final String PREFIX = "rendering.";
private static final String DEFAULT_LINK_LABEL_FORMAT = "%p";
public String getLinkLabelFormat() { return (String) this.source.getProperty(PREFIX + "linkLabelFormat", DEFAULT_LINK_LABEL_FORMAT); } }
WDYT?
Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (3)
-
Marius Dumitru Florea -
Thomas Mortagne -
Vincent Massol