Issue Type: Improvement Improvement
Assignee: Unassigned
Created: 29/Jul/13 4:54 PM
Description:

This class is currently a melting pot of

Generic path-related methods - which can be useful both in a filesystem- and jcr- context:

  • isAbsolute()
  • getAbsolutePath()

Filesystem-related, Magnolia-specific methods

  • Unused methods (or methods that should not be used) - getCacheDirectoryPath()
    • These should just go
  • Methods that provide a java.io.File for some of the default properties (getTempDirectory(), getCacheDirectory(), and getHistoryFile().
    • of these 3, only the first is relevant to all modules. The other 2 are actually module specific.
    • none of these actually makes sure the directory is actually created. They attempt to create the directory structure on every call, but never check for results.
  • getRepositoriesConfigFile() which is also not used. (the corresponding property is used directly)
  • getAppRootDir() which is used 3 times, in 3 different ways:
    • once to generate an "appName" in MBeanUtil (which is a very flawed way of uniquely identifying a Magnolia instance)
    • once to get to the web.xml file - which will way if the app is deployed as an unexpanded .war file
    • once to load config files (will probably also fail if the app is deployed as an unexpanded .war file, but info.magnolia.cms.util.ConfigUtil#getConfigFile already works around that, I think)
  • getAbsoluteFileSystemPath, which is used in the combination with the above - but not always (ConfigUtil.getConfigFile for example replicates this logic to find configuration files)

JCR, generic utility methods:

  • getUniqueLabel()
    • should be named getUniqueNodeName()
  • getValidatedLabel() which transforms an arbitrary String into a valid jcr name.
    • should be named validateNodeName()
    • isCharValid(), which should be private

Proposals:

  • For all filesystem-only methods - move whatever is module-specific to the module in question. Keep the minimum in core, make magnolia.home a first-class citizen property and provide:
    • a clear way of making sure the required paths are valid, exist and can be read from/written to.
    • MagnoliaDirectories could provide "home" (where all files reside) "app root dir" (renamed to webappDir), although usages of the latter should be kept to a minimum and one should probably prefer using javax.servlet.ServletContext#getResource
  • For all JCR-related methods - move to NodeUtil ?
  • For the 3 methods that aren't specific to fs or JCR, meh. They're simple enough, I wouldn't mind the duplication - but they probably don't need to be public either.
Project: Magnolia
Priority: Neutral Neutral
Reporter: Grégory Joseph
Security Level: Public
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to