Class XMLPreferenceDaoImpl
java.lang.Object
org.openwms.core.preferences.impl.file.XMLPreferenceDaoImpl
- All Implemented Interfaces:
EventListener
,PreferenceDao
,org.springframework.context.ApplicationListener<org.openwms.core.event.ReloadFilePreferencesEvent>
@Transactional(propagation=MANDATORY)
@Repository
class XMLPreferenceDaoImpl
extends Object
implements PreferenceDao, org.springframework.context.ApplicationListener<org.openwms.core.event.ReloadFilePreferencesEvent>
A XMLPreferenceDaoImpl reads an XML file of
Preferences
and keeps them in-memory in a Map. An initial preferences file can be
configured with a property openwms.core.config.initial-properties in the application.properties file.
On a ReloadFilePreferencesEvent
the internal Map is cleared and reloaded.
- Author:
- Heiko Scherrer
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate final org.springframework.context.ApplicationContext
private String
private org.springframework.core.io.Resource
private static final org.slf4j.Logger
private Preferences
private final Map
<PreferenceKey, GenericPreference> private final org.springframework.oxm.Unmarshaller
-
Constructor Summary
ConstructorDescriptionXMLPreferenceDaoImpl
(org.springframework.context.ApplicationContext ctx, org.springframework.oxm.Unmarshaller unmarshaller) -
Method Summary
Modifier and TypeMethodDescriptionfindAll()
Find all entities and return them as aList
.private boolean
private void
On bean initialization load allPreferences
into a Map.void
onApplicationEvent
(org.openwms.core.event.ReloadFilePreferencesEvent event) private void
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
ctx
private final org.springframework.context.ApplicationContext ctx -
unmarshaller
private final org.springframework.oxm.Unmarshaller unmarshaller -
fileName
-
fileResource
private org.springframework.core.io.Resource fileResource -
preferences
-
prefs
-
-
Constructor Details
-
XMLPreferenceDaoImpl
XMLPreferenceDaoImpl(org.springframework.context.ApplicationContext ctx, org.springframework.oxm.Unmarshaller unmarshaller)
-
-
Method Details
-
findAll
Find all entities and return them as aList
.- Specified by:
findAll
in interfacePreferenceDao
- Returns:
- List of all entities
-
onApplicationEvent
@Measured public void onApplicationEvent(org.openwms.core.event.ReloadFilePreferencesEvent event) - Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener<org.openwms.core.event.ReloadFilePreferencesEvent>
-
loadResources
@PostConstruct private void loadResources()On bean initialization load allPreferences
into a Map. -
initialPropertiesExist
private boolean initialPropertiesExist() -
reloadResources
private void reloadResources()
-