Package rife.config
Class RifeConfig
java.lang.Object
rife.config.RifeConfig
Provides configuration over RIFE2 itself.
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassclassclassclassclassclassclassstatic final classThe settings of aRifeConfig, saved bysave().static interfaceRifeConfig.SavedAction<E extends Exception>An action thatwithSaved(rife.config.RifeConfig.SavedAction<E>)runs.classclassclassclass -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal RifeConfig.CmfConfigfinal RifeConfig.EngineConfigfinal RifeConfig.GlobalConfigfinal RifeConfig.ToolsConfigfinal RifeConfig.XmlConfig -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RifeConfig.CmfConfigcmf()static RifeConfig.DatabaseConfigdatabase()static RifeConfig.EngineConfigengine()static RifeConfig.GlobalConfigglobal()static RifeConfiginstance()Returns the shared singleton instance of theRifeConfigclass.static RifeConfig.MigrationsConfigstatic RifeConfig.ResourcesConfigsave()Saves every setting of thisRifeConfig, so that they can be restored by closing the returned instance.static RifeConfig.SchedulerConfigstatic RifeConfig.TemplateConfigtemplate()static RifeConfig.ToolsConfigtools()<E extends Exception>
voidwithSaved(RifeConfig.SavedAction<E> action) Runs an action and restores every setting of thisRifeConfigafterwards, also when the action throws.static RifeConfig.XmlConfigxml()
-
Field Details
-
global
-
authentication
-
database
-
cmf
-
engine
-
migrations
-
resources
-
scheduler
-
template
-
tools
-
xml
-
-
Constructor Details
-
RifeConfig
protected RifeConfig()
-
-
Method Details
-
instance
Returns the shared singleton instance of theRifeConfigclass.- Returns:
- the singleton
RifeConfiginstance - Since:
- 1.0
-
global
-
authentication
-
database
-
cmf
-
engine
-
migrations
-
resources
-
scheduler
-
template
-
tools
-
xml
-
save
Saves every setting of thisRifeConfig, so that they can be restored by closing the returned instance.Since
RifeConfigis shared by the whole JVM, tests use this to undo the settings that they, or the sites they run, change:try (var saved = RifeConfig.instance().save()) { RifeConfig.engine().setProxyRootUrl("https://example.com"); // ... }Only the settings are restored, not what was already built from them, like templates that were compiled. A setting that's generated when it's first used, like the engine secret, goes back to not being set when it wasn't, and is generated again. Code that runs at the same time on other threads sees the changes too.
- Returns:
- the saved settings, that restore this
RifeConfigwhen they're closed - Since:
- 1.11.0
- See Also:
-
withSaved
Runs an action and restores every setting of thisRifeConfigafterwards, also when the action throws.- Type Parameters:
E- the type of exception that the action can throw- Parameters:
action- the action to run- Throws:
E- when the action threw it- Since:
- 1.11.0
- See Also:
-