public class JsonConfiguration extends java.lang.Object implements Destroyable, Producer<com.fasterxml.jackson.databind.node.ObjectNode>, FileSettingsConfiguration
| Constructor and Description |
|---|
JsonConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
void |
delete()
Deletes the configuration file if it exists.
|
void |
destroy()
Destroys this configuration by executing any pending write.
|
com.fasterxml.jackson.databind.node.ObjectNode |
get()
Gets the (possibly empty) configuration JSON node.
|
java.nio.file.Path |
getPath() |
void |
init()
Initializes this configuration by initializing a
Debouncer for writes and reading the configuration file. |
java.util.concurrent.locks.Lock |
readLock()
Gets the read lock for this configuration.
|
void |
refresh()
Refreshes the configuration from disk.
|
void |
scheduleWrite()
Schedule a write.
|
void |
setConfigLocationProvider(ConfigLocationProvider configLocationProvider)
Sets the configuration location provider.
|
void |
setFileName(java.lang.String fileName)
Sets the file name of this configuration.
|
void |
setWriteTimeout(int writeTimeout)
Sets the time to wait for additional changes before the configuration is persisted.
|
java.lang.String |
toString() |
java.util.concurrent.locks.Lock |
writeLock()
Gets the write lock for this configuration.
|
void |
writeNow()
Do not wait, but persist the settings right now.
|
public void init()
Debouncer for writes and reading the configuration file.public void refresh()
refresh in interface FileSettingsConfigurationpublic void destroy()
destroy in interface DestroyableDebouncer.finish()public void delete()
public com.fasterxml.jackson.databind.node.ObjectNode get()
get in interface java.util.function.Supplier<com.fasterxml.jackson.databind.node.ObjectNode>get in interface javax.inject.Provider<com.fasterxml.jackson.databind.node.ObjectNode>get in interface Producer<com.fasterxml.jackson.databind.node.ObjectNode>null)public void setWriteTimeout(int writeTimeout)
writeTimeout - the time out in millisecondspublic void setFileName(java.lang.String fileName)
fileName - the file namepublic void setConfigLocationProvider(ConfigLocationProvider configLocationProvider)
configLocationProvider - the providerpublic java.util.concurrent.locks.Lock readLock()
public java.util.concurrent.locks.Lock writeLock()
public void scheduleWrite()
timeout if no further
writes are scheduled, else it will postponed until their are no further requests for timeout
milliseconds.Debouncer.call()public void writeNow()
public java.nio.file.Path getPath()
getPath in interface FileSettingsConfigurationpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2015–2018 52°North Initiative for Geospatial Open Source Software GmbH. All rights reserved.