Top Description Fields Constructors Methods
net.fortuna.ical4j.model

public Class DefaultZoneRulesProvider

extends ZoneRulesProvider
Class Inheritance
Imports
net.fortuna.ical4j.data.ParserException, org.slf4j.Logger, .LoggerFactory, java.io.IOException, java.time.zone.ZoneRules, .ZoneRulesProvider, java.util.*, java.util.concurrent.ConcurrentHashMap

A default ZoneRulesProvider implementation for included timezone definitions. To avoid conflicting with the standard Java zone rules this provider maintains an internal map of local zone ids to globally unique ids.

Note

Globally unique zone identifiers are transient and will be regenerated for each instance of this class. They are only used to support registration and use of alternative definitions in the scope of this library.

Field Summary

Modifier and TypeField and Description
private static final String
private static final Logger
private final TimeZoneLoader
private final Map<String, ZoneRules>

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
protected boolean
provideRefresh()

Overrides java.time.zone.ZoneRulesProvider.provideRefresh.

SPI method to refresh the rules from the underlying data provider.

protected ZoneRules
provideRules(String
the zone ID as defined by ZoneId, not null
zoneId
,
boolean
whether the rules are being queried for caching, true if the returned rules will be cached by ZoneId, false if they will be returned to the user without being cached in ZoneId
forCaching
)

Implements abstract java.time.zone.ZoneRulesProvider.provideRules.

SPI method to get the rules for the zone ID.

This loads the rules for the specified zone ID. The provider implementation must validate that the zone ID is valid and available, throwing a ZoneRulesException if it is not.

protected NavigableMap<String, ZoneRules>
provideVersions(String
the zone ID as defined by ZoneId, not null
zoneId
)

Implements abstract java.time.zone.ZoneRulesProvider.provideVersions.

SPI method to get the history of rules for the zone ID.

This returns a map of historical rules keyed by a version string.

protected Set<String>
provideZoneIds()

Implements abstract java.time.zone.ZoneRulesProvider.provideZoneIds.

SPI method to get the available zone IDs.

Inherited from java.time.zone.ZoneRulesProvider:
getAvailableZoneIdsgetRulesgetVersionsrefreshregisterProvider

Field Detail

DEFAULT_RESOURCE_PREFIXback to summary
private static final String DEFAULT_RESOURCE_PREFIX
LOGback to summary
private static final Logger LOG
zoneLoaderback to summary
private final TimeZoneLoader zoneLoader
zoneRulesMapback to summary
private final Map<String, ZoneRules> zoneRulesMap

Constructor Detail

DefaultZoneRulesProviderback to summary
public DefaultZoneRulesProvider()
DefaultZoneRulesProviderback to summary
public DefaultZoneRulesProvider(TimeZoneLoader timeZoneLoader, Map<String, String> zoneIdMap)

Method Detail

provideRefreshback to summary
protected boolean provideRefresh()

Overrides java.time.zone.ZoneRulesProvider.provideRefresh.

Doc from java.time.zone.ZoneRulesProvider.provideRefresh.

SPI method to refresh the rules from the underlying data provider.

This method provides the opportunity for a provider to dynamically recheck the underlying data provider to find the latest rules. This could be used to load new rules without stopping the JVM. Dynamic behavior is entirely optional and most providers do not support it.

This implementation returns false.

Returns:boolean

true if the rules were updated

Annotations
@Override
provideRulesback to summary
protected ZoneRules provideRules(String zoneId, boolean forCaching)

Implements abstract java.time.zone.ZoneRulesProvider.provideRules.

Doc from java.time.zone.ZoneRulesProvider.provideRules.

SPI method to get the rules for the zone ID.

This loads the rules for the specified zone ID. The provider implementation must validate that the zone ID is valid and available, throwing a ZoneRulesException if it is not. The result of the method in the valid case depends on the caching flag.

If the provider implementation is not dynamic, then the result of the method must be the non-null set of rules selected by the ID.

If the provider implementation is dynamic, then the flag gives the option of preventing the returned rules from being cached in ZoneId. When the flag is true, the provider is permitted to return null, where null will prevent the rules from being cached in ZoneId. When the flag is false, the provider must return non-null rules.

Parameters
zoneId:String

the zone ID as defined by ZoneId, not null

forCaching:boolean

whether the rules are being queried for caching, true if the returned rules will be cached by ZoneId, false if they will be returned to the user without being cached in ZoneId

Returns:ZoneRules

the rules, null if forCaching is true and this is a dynamic provider that wants to prevent caching in ZoneId, otherwise not null

Annotations
@Override
provideVersionsback to summary
protected NavigableMap<String, ZoneRules> provideVersions(String zoneId)

Implements abstract java.time.zone.ZoneRulesProvider.provideVersions.

Doc from java.time.zone.ZoneRulesProvider.provideVersions.

SPI method to get the history of rules for the zone ID.

This returns a map of historical rules keyed by a version string. The exact meaning and format of the version is provider specific. The version must follow lexicographical order, thus the returned map will be order from the oldest known rules to the newest available rules. The default 'TZDB' group uses version numbering consisting of the year followed by a letter, such as '2009e' or '2012f'.

Implementations must provide a result for each valid zone ID, however they do not have to provide a history of rules. Thus the map will contain at least one element, and will only contain more than one element if historical rule information is available.

The returned versions remain available and valid for the lifetime of the application. A dynamic provider may increase the set of versions as more data becomes available.

Parameters
zoneId:String

the zone ID as defined by ZoneId, not null

Returns:NavigableMap<String, ZoneRules>

a modifiable copy of the history of the rules for the ID, sorted from oldest to newest, not null

Annotations
@Override
provideZoneIdsback to summary
protected Set<String> provideZoneIds()

Implements abstract java.time.zone.ZoneRulesProvider.provideZoneIds.

Doc from java.time.zone.ZoneRulesProvider.provideZoneIds.

SPI method to get the available zone IDs.

This obtains the IDs that this ZoneRulesProvider provides. A provider should provide data for at least one zone ID.

The returned zone IDs remain available and valid for the lifetime of the application. A dynamic provider may increase the set of IDs as more data becomes available.

Returns:Set<String>

the set of zone IDs being provided, not null

Annotations
@Override