Class AbstractCachedData

java.lang.Object
org.bedework.timezones.common.AbstractCachedData
All Implemented Interfaces:
Serializable, CachedData, org.bedework.util.logging.Logged
Direct Known Subclasses:
AbstractDb, FileCachedData, ZipCachedData

public abstract class AbstractCachedData extends Object implements org.bedework.util.logging.Logged, CachedData
Abstract class to help simplify implementation
Author:
douglm
See Also:
  • Field Details

  • Constructor Details

    • AbstractCachedData

      public AbstractCachedData(TzConfig cfg, String msgPrefix) throws TzException
      Parameters:
      cfg - our config
      msgPrefix - - for messages
      Throws:
      TzException - on fatal error
  • Method Details

    • getStats

      public List<Stat> getStats() throws TzException
      Specified by:
      getStats in interface CachedData
      Returns:
      stats for the module
      Throws:
      TzException - on fatal error
    • findIds

      public abstract List<String> findIds(String val) throws TzException
      Find tz identifiers or alias names that (partially) match the given value
      Parameters:
      val - pattern to match
      Returns:
      list of strings - never null
      Throws:
      TzException - on fatal error
    • getDtstamp

      public String getDtstamp() throws TzException
      Specified by:
      getDtstamp in interface CachedData
      Returns:
      XML formatted UTC dateTime
      Throws:
      TzException - on fatal error
    • fromAlias

      public String fromAlias(String val)
      Description copied from interface: CachedData
      Given an alias return the tzid for that alias
      Specified by:
      fromAlias in interface CachedData
      Parameters:
      val - alias
      Returns:
      aliased name or null
    • getAliasesStr

      public String getAliasesStr()
      Specified by:
      getAliasesStr in interface CachedData
      Returns:
      String value of aliases file.
    • findAliases

      public SortedSet<String> findAliases(String tzid)
      Specified by:
      findAliases in interface CachedData
      Parameters:
      tzid - for which we want aliases
      Returns:
      list of aliases or null
    • getNameList

      public SortedSet<String> getNameList()
      Specified by:
      getNameList in interface CachedData
      Returns:
      namelist or null
    • setExpanded

      public void setExpanded(ExpandedMapEntryKey key, ExpandedMapEntry tzs)
      Specified by:
      setExpanded in interface CachedData
      Parameters:
      key - to expanded map
      tzs - entries from map
    • getExpanded

      public ExpandedMapEntry getExpanded(ExpandedMapEntryKey key)
      Specified by:
      getExpanded in interface CachedData
      Parameters:
      key - to expanded map
      Returns:
      expanded or null
    • getCachedVtz

      public String getCachedVtz(String name)
      Description copied from interface: CachedData
      Get cached VTIMEZONE specifications
      Specified by:
      getCachedVtz in interface CachedData
      Parameters:
      name - tzid
      Returns:
      cached spec or null.
    • getAllCachedVtzs

      public Collection<String> getAllCachedVtzs()
      Description copied from interface: CachedData
      Get all cached VTIMEZONE specifications
      Specified by:
      getAllCachedVtzs in interface CachedData
      Returns:
      cached specs or null.
    • getTimeZone

      public net.fortuna.ical4j.model.TimeZone getTimeZone(String tzid)
      Description copied from interface: CachedData
      Get a timezone object from the server given the id.
      Specified by:
      getTimeZone in interface CachedData
      Parameters:
      tzid - the id
      Returns:
      TimeZone with id or null
    • getXTimeZone

      public IcalendarType getXTimeZone(String tzid)
      Description copied from interface: CachedData
      Get a timezone object from the server given the id.
      Specified by:
      getXTimeZone in interface CachedData
      Parameters:
      tzid - the id
      Returns:
      IcalendarType with id or null
    • getAliasedXTimeZone

      public IcalendarType getAliasedXTimeZone(String tzid)
      Description copied from interface: CachedData
      Get an aliased timezone object from the server given the id.
      Specified by:
      getAliasedXTimeZone in interface CachedData
      Parameters:
      tzid - the id
      Returns:
      IcalendarType with id or null
    • getAliasedCachedVtz

      public String getAliasedCachedVtz(String name)
      Description copied from interface: CachedData
      Get an aliased cached VTIMEZONE specifications
      Specified by:
      getAliasedCachedVtz in interface CachedData
      Parameters:
      name - tzid
      Returns:
      cached spec or null.
    • getTimezones

      public List<org.bedework.util.timezones.model.TimezoneType> getTimezones(String[] tzids)
      Specified by:
      getTimezones in interface CachedData
      Parameters:
      tzids - - to fetch
      Returns:
      list of summary info
    • getTimezones

      public List<org.bedework.util.timezones.model.TimezoneType> getTimezones(String changedSince)
      Specified by:
      getTimezones in interface CachedData
      Parameters:
      changedSince - - null or dtstamp value
      Returns:
      list of summary info
    • findTimezones

      public List<org.bedework.util.timezones.model.TimezoneType> findTimezones(String name) throws TzException
      Specified by:
      findTimezones in interface CachedData
      Parameters:
      name - to be partially matched
      Returns:
      list of matching summary info
      Throws:
      TzException - on fatal error
    • processSpec

      protected void processSpec(String id, String caldef, String etag, String storedDtstamp)
      Parameters:
      id - of tz
      caldef - a tz spec in the form of a String VCALENDAR representation
      etag - for entry
      storedDtstamp - to set last mod
    • processSpec

      protected void processSpec(String id, net.fortuna.ical4j.model.Calendar cal, String etag, String storedDtstamp)
      Parameters:
      id - of tz
      cal - a tz spec in the form of a CALENDAR component
      etag - for entry
      storedDtstamp - to set last mod
    • parseDef

      protected net.fortuna.ical4j.model.Calendar parseDef(String caldef)
    • vtzFromCal

      protected net.fortuna.ical4j.model.component.VTimeZone vtzFromCal(net.fortuna.ical4j.model.Calendar cal)
    • resetTzs

      protected void resetTzs()
    • addAlias

      protected net.fortuna.ical4j.model.component.VTimeZone addAlias(String alias, net.fortuna.ical4j.model.component.VTimeZone vtz)
    • escape

      protected String escape(String val)
    • getLogger

      public org.bedework.util.logging.BwLogger getLogger()
      Specified by:
      getLogger in interface org.bedework.util.logging.Logged