public class PropertyUserStore extends AbstractLifeCycle 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 com.eclipse.Util.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 OBF:.
Modifier and Type | Class and Description |
---|---|
static interface |
PropertyUserStore.UserListener
UserListener
|
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
protected Path |
_configPath |
protected Resource |
_configResource |
protected boolean |
_firstLoad |
protected IdentityService |
_identityService |
protected Map<String,UserIdentity> |
_knownUserIdentities |
protected List<String> |
_knownUsers |
protected List<PropertyUserStore.UserListener> |
_listeners |
protected boolean |
hotReload |
protected PathWatcher |
pathWatcher |
Constructor and Description |
---|
PropertyUserStore() |
Modifier and Type | Method and Description |
---|---|
protected void |
doStart()
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.
|
protected void |
doStop() |
String |
getConfig()
Deprecated.
use
getConfigPath() instead |
Path |
getConfigPath()
Get the Config
Path reference. |
Resource |
getConfigResource() |
UserIdentity |
getUserIdentity(String userName) |
boolean |
isHotReload()
Is hot reload enabled on this user store
|
protected void |
loadUsers() |
void |
onPathWatchEvent(PathWatcher.PathWatchEvent event) |
void |
registerUserListener(PropertyUserStore.UserListener listener)
registers a listener to be notified of the contents of the property file
|
void |
setConfig(String configFile)
Deprecated.
use
setConfigPath(String) instead |
void |
setConfigPath(File configFile)
Set the Config Path from a
File reference |
void |
setConfigPath(Path configPath)
Set the Config Path
|
void |
setConfigPath(String configFile)
Set the Config Path from a String reference to a file
|
void |
setHotReload(boolean enable)
Enable Hot Reload of the Property File
|
String |
toString() |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
protected Path _configPath
protected Resource _configResource
protected PathWatcher pathWatcher
protected boolean hotReload
protected IdentityService _identityService
protected boolean _firstLoad
protected final Map<String,UserIdentity> _knownUserIdentities
protected List<PropertyUserStore.UserListener> _listeners
@Deprecated public String getConfig()
getConfigPath()
instead@Deprecated public void setConfig(String configFile)
setConfigPath(String)
insteadconfigFile
- the config filepublic void setConfigPath(String configFile)
configFile
- the config filepublic void setConfigPath(File configFile)
File
referenceconfigFile
- the config filepublic void setConfigPath(Path configPath)
configPath
- the config pathpublic UserIdentity getUserIdentity(String userName)
public Resource getConfigResource() throws IOException
IOException
- if unable to get the resourcepublic boolean isHotReload()
public void setHotReload(boolean enable)
enable
- true to enable, false to disableprotected void loadUsers() throws IOException
IOException
protected void doStart() throws Exception
doStart
in class AbstractLifeCycle
Exception
AbstractLifeCycle.doStart()
public void onPathWatchEvent(PathWatcher.PathWatchEvent event)
onPathWatchEvent
in interface PathWatcher.Listener
protected void doStop() throws Exception
doStop
in class AbstractLifeCycle
Exception
AbstractLifeCycle.doStop()
public void registerUserListener(PropertyUserStore.UserListener listener)
listener
- the user listenerCopyright © 1995–2017 Webtide. All rights reserved.