Package org.apache.juneau.config.store
Class FileStore
java.lang.Object
org.apache.juneau.Context
org.apache.juneau.config.store.ConfigStore
org.apache.juneau.config.store.FileStore
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- AnnotationProvider
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 SummaryNested Classes
- 
Field SummaryFieldsFields inherited from class org.apache.juneau.ContextCONTEXT_APPLY_FILTERFields inherited from interface org.apache.juneau.AnnotationProviderDISABLE_ANNOTATION_CACHING
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()copy()Creates a builder from this context object.static FileStore.Buildercreate()Creates a new builder for this object.booleanChecks whether the configuration with the specified name exists in this store.protected voidGets called when the watcher service on this store is triggered with a file system change.protected JsonMapReturns the properties on this bean as a map for debugging.Returns the contents of the configuration file.protected StringresolveName(String name) Subclasses can override this method to convert config names to internal forms.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.ConfigStoregetMap, register, unregister, updateMethods inherited from class org.apache.juneau.ContextcreateBuilder, createSession, firstAnnotation, firstAnnotation, firstAnnotation, firstAnnotation, firstDeclaredAnnotation, forEachAnnotation, forEachAnnotation, forEachAnnotation, forEachAnnotation, forEachDeclaredAnnotation, getSession, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, init, isDebug, lastAnnotation, lastAnnotation, lastAnnotation, lastAnnotation, lastDeclaredAnnotation, toString
- 
Field Details- 
DEFAULTDefault file store, all default values.
 
- 
- 
Constructor Details- 
FileStoreConstructor.- Parameters:
- builder- The builder for this object.
 
 
- 
- 
Method Details- 
createCreates a new builder for this object.- Returns:
- A new builder.
 
- 
copyDescription 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. 
- 
readDescription copied from class:ConfigStoreReturns the contents of the configuration file.- Specified by:
- readin class- ConfigStore
- Parameters:
- name- The config file name.
- Returns:
- The contents of the configuration file.
   
 A blank string if the config does not exist.
 Nevernull .
- Throws:
- IOException- Thrown by underlying stream.
 
- 
writeDescription copied from class:ConfigStoreSaves the contents of the configuration file if the underlying storage hasn't been modified.- Specified by:
- writein class- ConfigStore
- 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.
- Throws:
- IOException- Thrown by underlying stream.
 
- 
existsDescription copied from class:ConfigStoreChecks whether the configuration with the specified name exists in this store.- Specified by:
- existsin class- ConfigStore
- Parameters:
- name- The config name.
- Returns:
- true if the configuration with the specified name exists in this store.
 
- 
resolveNameDescription copied from class:ConfigStoreSubclasses can override this method to convert config names to internal forms.For example, the FileStoreclass can take in both"MyConfig" and"MyConfig.cfg" as names that both resolve to"MyConfig.cfg" .- Overrides:
- resolveNamein class- ConfigStore
- Parameters:
- name- The name to resolve.
- Returns:
- The resolved name.
 
- 
updateDescription 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 class- ConfigStore
- Parameters:
- name- The config name (e.g. the filename without the extension).
- newContents- The new contents.
- Returns:
- This object.
 
- 
close
- 
onFileEventGets called when the watcher service on this store is triggered with a file system change.- Parameters:
- e- The file system event.
- Throws:
- IOException- Thrown by underlying stream.
 
- 
propertiesDescription copied from class:ContextReturns the properties on this bean as a map for debugging.- Overrides:
- propertiesin class- Context
- Returns:
- The properties on this bean as a map for debugging.
 
 
-