Package org.refcodes.configuration
Class ScheduledResourcePropertiesDecorator
- java.lang.Object
-
- org.refcodes.configuration.AbstractPropertiesDecorator<T>
-
- org.refcodes.configuration.AbstractResourcePropertiesDecorator<ResourceProperties>
-
- org.refcodes.configuration.ScheduledResourcePropertiesDecorator
-
- All Implemented Interfaces:
org.refcodes.component.Startable
,org.refcodes.component.Stoppable
,Properties
,ResourceProperties
,ScheduledResourceProperties
,org.refcodes.mixin.DelimiterAccessor
,org.refcodes.mixin.Disposable
,org.refcodes.mixin.Dumpable
,org.refcodes.mixin.TypeAccessor<java.lang.String>
,org.refcodes.structure.CanonicalMap
,org.refcodes.structure.Containable
,org.refcodes.structure.Dictionary<java.lang.String,java.lang.String>
,org.refcodes.structure.Keys<java.lang.String,java.lang.String>
,org.refcodes.structure.PathMap<java.lang.String>
,org.refcodes.structure.PropertiesAccessorMixin
public class ScheduledResourcePropertiesDecorator extends AbstractResourcePropertiesDecorator<ResourceProperties> implements ScheduledResourceProperties
TheScheduledResourcePropertiesDecorator
decoratesResourceProperties
from which the properties are to be reloaded periodically viaAbstractResourcePropertiesDecorator.reload(ReloadMode)
. Depending on the invoked constructor, you can define whether orphan removal (seeAbstractResourcePropertiesDecorator.reload(ReloadMode)
) is to be taken care of and the poll loop time, e.g. in which time interval the properties are to be reloaded.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.structure.CanonicalMap
org.refcodes.structure.CanonicalMap.CanonicalMapBuilder, org.refcodes.structure.CanonicalMap.MutableCanonicalMap
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.DelimiterAccessor
org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty
-
Nested classes/interfaces inherited from interface org.refcodes.structure.Dictionary
org.refcodes.structure.Dictionary.MutableDictionary<K extends java.lang.Object,V extends java.lang.Object>
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.Disposable
org.refcodes.mixin.Disposable.Disposedable
-
Nested classes/interfaces inherited from interface org.refcodes.structure.Keys
org.refcodes.structure.Keys.MutableKeys<K extends java.lang.Object,V extends java.lang.Object>, org.refcodes.structure.Keys.MutableValues<K extends java.lang.Object,V extends java.lang.Object>
-
Nested classes/interfaces inherited from interface org.refcodes.structure.PathMap
org.refcodes.structure.PathMap.MutablePathMap<T extends java.lang.Object>, org.refcodes.structure.PathMap.PathMapBuilder<T extends java.lang.Object>
-
Nested classes/interfaces inherited from interface org.refcodes.configuration.Properties
Properties.MutableProperties, Properties.PropertiesBuilder
-
Nested classes/interfaces inherited from interface org.refcodes.structure.PropertiesAccessorMixin
org.refcodes.structure.PropertiesAccessorMixin.PropertiesBuilderMixin<T extends java.lang.Object>, org.refcodes.structure.PropertiesAccessorMixin.PropertiesMixin, org.refcodes.structure.PropertiesAccessorMixin.PropertiesMutatorMixin
-
Nested classes/interfaces inherited from interface org.refcodes.configuration.ResourceProperties
ResourceProperties.MutableResoureProperties, ResourceProperties.ResourcePropertiesBuilder
-
Nested classes/interfaces inherited from interface org.refcodes.configuration.ScheduledResourceProperties
ScheduledResourceProperties.ScheduledMuableResourceProperties, ScheduledResourceProperties.ScheduledResourcePropertiesBuilder
-
Nested classes/interfaces inherited from interface org.refcodes.component.Startable
org.refcodes.component.Startable.StartAutomaton, org.refcodes.component.Startable.StartBuilder<B extends org.refcodes.component.Startable.StartBuilder<B>>, org.refcodes.component.Startable.UncheckedStartable
-
-
Field Summary
-
Fields inherited from interface org.refcodes.configuration.Properties
DEFAULT_COMMENT
-
Fields inherited from interface org.refcodes.configuration.ResourceProperties
VALUE_ATTRIBUTES
-
-
Constructor Summary
Constructors Constructor Description ScheduledResourcePropertiesDecorator(ResourceProperties aProperties)
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with default settings being a poll loop time of 10 seconds (as ofPollLoopTime.NORM
and orphan removal (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called withtrue
).ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, int aScheduleTimeInMillis)
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with setting the given poll loop time and orphan removal (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called withtrue
).ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, int aScheduleTimeInMillis, ReloadMode aReloadMode)
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with setting the given poll loop time and the given orphan removal strategy (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called with your argument).ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, int aScheduleTimeInMillis, ReloadMode aReloadMode, org.refcodes.controlflow.ThreadMode aThreadMode)
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with setting the given poll loop time and the given orphan removal strategy (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called with your argument).ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, int aScheduleTimeInMillis, org.refcodes.controlflow.ThreadMode aThreadMode)
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with setting the given poll loop time and orphan removal (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called withtrue
).ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, ReloadMode aReloadMode)
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with setting the the default poll loop time of 10 seconds (as ofPollLoopTime.NORM
and the given orphan removal strategy (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called with your argument).ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, ReloadMode aReloadMode, org.refcodes.controlflow.ThreadMode aThreadMode)
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with setting the the default poll loop time of 10 seconds (as ofPollLoopTime.NORM
and the given orphan removal strategy (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called with your argument).ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, org.refcodes.controlflow.ThreadMode aThreadMode)
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with default settings being a poll loop time of 10 seconds (as ofPollLoopTime.NORM
and orphan removal (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called withtrue
).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
void
start()
void
stop()
-
Methods inherited from class org.refcodes.configuration.AbstractPropertiesDecorator
childrenOf, containsKey, get, getDelimiter, getProperties, isEmpty, keySet, retrieveFrom, retrieveTo, setProperties, size, toDataStructure, values
-
Methods inherited from class org.refcodes.configuration.AbstractResourcePropertiesDecorator
reload, reload, toSerialized, toSerialized
-
Methods inherited from interface org.refcodes.structure.CanonicalMap
toInstance, toInstance, toType, toType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.refcodes.structure.PathMap
directories, directories, entries, entries, fromExternalKey, get, get, getArray, getArray, getBoolean, getBoolean, getByte, getByte, getCharacter, getCharacter, getDouble, getDouble, getFloat, getFloat, getIndexes, getIndexes, getInteger, getInteger, getLong, getLong, getRootPath, getShort, getShort, hasIndexed, hasIndexed, hasParentPath, isArray, isArray, isDirectory, isEntry, isIndexed, isIndexed, isPath, isRecord, isRootPath, keySet, paths, paths, queryPaths, records, records, toDataStructure, toDataStructure, toExternalKey, toMap, toNormalizedPath, toNormalizedPath, toParentPath, toPath, toPath
-
Methods inherited from interface org.refcodes.configuration.Properties
childrenOf, containsValue, getDelimiter, getIndexed, getIndexed, getType, query, query, queryFrom, queryTo, retrieve, retrieveFrom, retrieveTo, toMap, toProperties, toPropertyPath
-
Methods inherited from interface org.refcodes.structure.PropertiesAccessorMixin
containsKey, get, getBoolean, getBoolean, getByte, getByte, getCharacter, getCharacter, getDouble, getDouble, getFloat, getFloat, getInteger, getInteger, getLong, getLong, getShort, getShort, use, useBoolean, useBoolean, useByte, useByte, useDouble, useDouble, useFloat, useFloat, useInteger, useInteger, useLong, useLong, useShort, useShort
-
Methods inherited from interface org.refcodes.configuration.ResourceProperties
reload, reload, toSerialized, toSerialized
-
-
-
-
Constructor Detail
-
ScheduledResourcePropertiesDecorator
public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties) throws java.io.IOException, java.text.ParseException, java.lang.IllegalStateException
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with default settings being a poll loop time of 10 seconds (as ofPollLoopTime.NORM
and orphan removal (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called withtrue
). The schedulingThread
is started as daemon thread (seeThreadMode.DAEMON
). Immediately starts polling after construction of this instance for new properties.- Parameters:
aProperties
- The properties from which the properties are to be reloaded periodically.- Throws:
java.io.IOException
- thrown in case accessing the resource encountered an I/O problem.java.lang.IllegalStateException
- in case the attached resource does not support reloading.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
ScheduledResourcePropertiesDecorator
public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, int aScheduleTimeInMillis) throws java.io.IOException, java.text.ParseException, java.lang.IllegalStateException
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with setting the given poll loop time and orphan removal (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called withtrue
). The schedulingThread
is started as daemon thread (seeThreadMode.DAEMON
). Immediately starts polling after construction of this instance for new properties.- Parameters:
aProperties
- The properties from which the properties are to be reloaded periodically.aScheduleTimeInMillis
- The time in milliseconds between polling for new properties.- Throws:
java.io.IOException
- thrown in case accessing the resource encountered an I/O problem.java.lang.IllegalStateException
- in case the attached resource does not support reloading.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
ScheduledResourcePropertiesDecorator
public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, ReloadMode aReloadMode) throws java.io.IOException, java.text.ParseException, java.lang.IllegalStateException
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with setting the the default poll loop time of 10 seconds (as ofPollLoopTime.NORM
and the given orphan removal strategy (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called with your argument). The schedulingThread
is started as daemon thread (seeThreadMode.DAEMON
). Immediately starts polling after construction of this instance for new properties.- Parameters:
aProperties
- The properties from which the properties are to be reloaded periodically.aReloadMode
- when set toReloadMode.ORPHAN_REMOVAL
, then properties existing in the attached resource but not(!) in theProperties
itself are(!) removed. Else properties not existing in the attached resource are kept.- Throws:
java.io.IOException
- thrown in case accessing the resource encountered an I/O problem.java.lang.IllegalStateException
- in case the attached resource does not support reloading.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
ScheduledResourcePropertiesDecorator
public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, int aScheduleTimeInMillis, ReloadMode aReloadMode) throws java.io.IOException, java.text.ParseException, java.lang.IllegalStateException
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with setting the given poll loop time and the given orphan removal strategy (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called with your argument). The schedulingThread
is started as daemon thread (seeThreadMode.DAEMON
). Immediately starts polling after construction of this instance for new properties.- Parameters:
aProperties
- The properties from which the properties are to be reloaded periodically.aScheduleTimeInMillis
- The time in milliseconds between polling for new properties.aReloadMode
- when set toReloadMode.ORPHAN_REMOVAL
, then properties existing in the attached resource but not(!) in theProperties
itself are(!) removed. Else properties not existing in the attached resource are kept.- Throws:
java.io.IOException
- thrown in case accessing the resource encountered an I/O problem.java.lang.IllegalStateException
- in case the attached resource does not support reloading.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
ScheduledResourcePropertiesDecorator
public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, org.refcodes.controlflow.ThreadMode aThreadMode) throws java.io.IOException, java.text.ParseException, java.lang.IllegalStateException
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with default settings being a poll loop time of 10 seconds (as ofPollLoopTime.NORM
and orphan removal (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called withtrue
). Immediately starts polling after construction of this instance for new properties.- Parameters:
aProperties
- The properties from which the properties are to be reloaded periodically.aThreadMode
- TheThreadMode
mode of operation regarding theThread
doing the scheduling job.- Throws:
java.io.IOException
- thrown in case accessing the resource encountered an I/O problem.java.lang.IllegalStateException
- in case the attached resource does not support reloading.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
ScheduledResourcePropertiesDecorator
public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, int aScheduleTimeInMillis, org.refcodes.controlflow.ThreadMode aThreadMode) throws java.io.IOException, java.text.ParseException, java.lang.IllegalStateException
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with setting the given poll loop time and orphan removal (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called withtrue
). Immediately starts polling after construction of this instance for new properties.- Parameters:
aProperties
- The properties from which the properties are to be reloaded periodically.aScheduleTimeInMillis
- The time in milliseconds between polling for new properties.aThreadMode
- TheThreadMode
mode of operation regarding theThread
doing the scheduling job.- Throws:
java.io.IOException
- thrown in case accessing the resource encountered an I/O problem.java.lang.IllegalStateException
- in case the attached resource does not support reloading.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
ScheduledResourcePropertiesDecorator
public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, ReloadMode aReloadMode, org.refcodes.controlflow.ThreadMode aThreadMode) throws java.io.IOException, java.text.ParseException, java.lang.IllegalStateException
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with setting the the default poll loop time of 10 seconds (as ofPollLoopTime.NORM
and the given orphan removal strategy (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called with your argument). Immediately starts polling after construction of this instance for new properties.- Parameters:
aProperties
- The properties from which the properties are to be reloaded periodically.aReloadMode
- when set toReloadMode.ORPHAN_REMOVAL
, then properties existing in the attached resource but not(!) in theProperties
itself are(!) removed. Else properties not existing in the attached resource are kept.aThreadMode
- TheThreadMode
mode of operation regarding theThread
doing the scheduling job.- Throws:
java.io.IOException
- thrown in case accessing the resource encountered an I/O problem.java.lang.IllegalStateException
- in case the attached resource does not support reloading.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
ScheduledResourcePropertiesDecorator
public ScheduledResourcePropertiesDecorator(ResourceProperties aProperties, int aScheduleTimeInMillis, ReloadMode aReloadMode, org.refcodes.controlflow.ThreadMode aThreadMode) throws java.io.IOException, java.text.ParseException, java.lang.IllegalStateException
Constructs theScheduledResourcePropertiesDecorator
wrapping the givenResourceProperties
with setting the given poll loop time and the given orphan removal strategy (as ofAbstractResourcePropertiesDecorator.reload(ReloadMode)
being called with your argument). Immediately starts polling after construction of this instance for new properties.- Parameters:
aProperties
- The properties from which the properties are to be reloaded periodically.aScheduleTimeInMillis
- The time in milliseconds between polling for new properties.aReloadMode
- when set toReloadMode.ORPHAN_REMOVAL
, then properties existing in the attached resource but not(!) in theProperties
itself are(!) removed. Else properties not existing in the attached resource are kept.aThreadMode
- TheThreadMode
mode of operation regarding theThread
doing the scheduling job.- Throws:
java.io.IOException
- thrown in case accessing the resource encountered an I/O problem.java.lang.IllegalStateException
- in case the attached resource does not support reloading.java.text.ParseException
- Signals that an error has been reached unexpectedly while parsing the data to be loaded.
-
-
Method Detail
-
start
public void start() throws org.refcodes.component.StartException
- Specified by:
start
in interfaceorg.refcodes.component.Startable
- Throws:
org.refcodes.component.StartException
-
stop
public void stop() throws org.refcodes.component.StopException
- Specified by:
stop
in interfaceorg.refcodes.component.Stoppable
- Throws:
org.refcodes.component.StopException
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceorg.refcodes.mixin.Disposable
-
-