Class PropertyUserStore

  • All Implemented Interfaces:
    java.util.EventListener, LifeCycle, PathWatcher.Listener

    public class PropertyUserStore
    extends UserStore
    implements PathWatcher.Listener

    This class monitors a property file of the format mentioned below and notifies registered listeners of the changes to the the given file.

      username: password [,rolename ...]

    Passwords may be clear text, obfuscated or checksummed. The class Password should be used to generate obfuscated passwords or password checksums.

    If DIGEST Authentication is used, the password must be in a recoverable format, either plain text or obfuscated.

    • Field Detail

      • _configPath

        protected java.nio.file.Path _configPath
      • _hotReload

        protected boolean _hotReload
      • _firstLoad

        protected boolean _firstLoad
    • Constructor Detail

      • PropertyUserStore

        public PropertyUserStore()
    • Method Detail

      • getConfig

        public java.lang.String getConfig()
        Get the config (as a string)
        the config path as a string
      • setConfig

        public void setConfig​(java.lang.String config)
        Set the Config Path from a String reference to a file
        config - the config file
      • getConfigPath

        public java.nio.file.Path getConfigPath()
        Get the Config Path reference.
        the config path
      • setConfigFile

        public void setConfigFile​( configFile)
        Set the Config Path from a File reference
        configFile - the config file
      • setConfigPath

        public void setConfigPath​(java.nio.file.Path configPath)
        Set the Config Path
        configPath - the config path
      • getConfigResource

        public Resource getConfigResource()
        the resource associated with the configured properties file, creating it if necessary
      • isHotReload

        public boolean isHotReload()
        Is hot reload enabled on this user store
        true if hot reload was enabled before startup
      • setHotReload

        public void setHotReload​(boolean enable)
        Enable Hot Reload of the Property File
        enable - true to enable, false to disable
      • toString

        public java.lang.String toString()
        toString in class UserStore
      • loadUsers

        protected void loadUsers()
      • doStart

        protected void doStart()
                        throws java.lang.Exception
        Depending on the value of the refresh interval, this method will either start up a scanner thread that will monitor the properties file for changes after it has initially loaded it. Otherwise the users will be loaded and there will be no active monitoring thread so changes will not be detected.
        doStart in class AbstractLifeCycle
        AbstractLifeCycle.StopException - If thrown, the lifecycle will immediately be stopped.
        java.lang.Exception - If there was a problem starting. Will cause a transition to FAILED state
      • doStop

        protected void doStop()
                       throws java.lang.Exception
        Description copied from class: AbstractLifeCycle
        Method to override to stop the lifecycle
        doStop in class AbstractLifeCycle
        java.lang.Exception - If there was a problem stopping. Will cause a transition to FAILED state
      • registerUserListener

        public void registerUserListener​(PropertyUserStore.UserListener listener)
        Registers a listener to be notified of the contents of the property file
        listener - the user listener