Package org.apache.juneau.config.store
Class MemoryStore
java.lang.Object
org.apache.juneau.Context
org.apache.juneau.config.store.ConfigStore
org.apache.juneau.config.store.MemoryStore
- All Implemented Interfaces:
Closeable,AutoCloseable
Filesystem-based storage location for configuration files.
Points to a file system directory containing configuration files.
Notes:
- This class is thread safe and reusable.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MemoryStoreDefault memory store, all default values.Fields inherited from class org.apache.juneau.Context
CONTEXT_APPLY_FILTER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()No-op.copy()Creates a builder from this context object.static MemoryStore.Buildercreate()Creates a new builder for this object.booleanChecks whether the configuration with the specified name exists in this store.Returns the contents of the configuration file.Called when the physical contents of a config file have changed.Saves the contents of the configuration file if the underlying storage hasn't been modified.Methods inherited from class org.apache.juneau.config.store.ConfigStore
getMap, properties, register, resolveName, unregister, updateMethods inherited from class org.apache.juneau.Context
createBuilder, createSession, getAnnotationProvider, getSession, init, isDebug, toString
-
Field Details
-
DEFAULT
Default memory store, all default values.
-
-
Constructor Details
-
MemoryStore
Constructor.- Parameters:
builder- The builder for this object.
-
-
Method Details
-
create
Creates a new builder for this object.- Returns:
- A new builder.
-
close
No-op.- Throws:
IOException
-
copy
Description copied from class:ContextCreates a builder from this context object.Builders are used to define new contexts (e.g. serializers, parsers) based on existing configurations.
-
exists
Description copied from class:ConfigStoreChecks whether the configuration with the specified name exists in this store.- Specified by:
existsin classConfigStore- Parameters:
name- The config name.- Returns:
true if the configuration with the specified name exists in this store.
-
read
Description copied from class:ConfigStoreReturns the contents of the configuration file.- Specified by:
readin classConfigStore- Parameters:
name- The config file name.- Returns:
- The contents of the configuration file.
A blank string if the config does not exist.
Nevernull .
-
update
Description copied from class:ConfigStoreCalled when the physical contents of a config file have changed.Triggers calls to
ConfigStoreListener.onChange(String)on all registered listeners.- Overrides:
updatein classConfigStore- Parameters:
name- The config name (e.g. the filename without the extension).newContents- The new contents.- Returns:
- This object.
-
write
Description copied from class:ConfigStoreSaves the contents of the configuration file if the underlying storage hasn't been modified.- Specified by:
writein classConfigStore- Parameters:
name- The config file name.expectedContents- The expected contents of the file.newContents- The new contents.- Returns:
- If
null , then we successfully stored the contents of the file.
Otherwise the contents of the file have changed and we return the new contents of the file.
-