Interface DataSource

All Known Implementing Classes:
JedisDataSource

public interface DataSource
Provides access to persistent data, e.g. devices, users, ...
  • Method Details

    • getIds

      SortedSet<String> getIds(Class<?> entityClass)
    • get

      <T> T get(Class<T> entityClass, int id)
    • getAll

      <T> List<T> getAll(Class<T> entityClass)
    • save

      <T> T save(T entity, int id)
    • delete

      void delete(Class<?> entityClass, int id)
    • deleteAll

      void deleteAll(Class<?> entityClass)
    • nextId

      int nextId(Class<?> entityClass)
    • get

      <T> T get(Class<T> entityClass)
    • save

      <T> T save(T entity)
    • delete

      void delete(Class<?> entityClass)
    • keys

      Set<String> keys(String globPattern)
    • delete

      void delete(String key)
    • setIdSequence

      void setIdSequence(Class<?> entityClass, int value)
      Sets id sequence to initial value. This method should only used by migrations.
    • getGateway

      String getGateway()
      Returns the router's IP address
    • setGateway

      void setGateway(String gateway)
      Set the router's IP address
      Parameters:
      gateway -
    • getDeviceIds

      SortedSet<String> getDeviceIds()
      Returns a sorted set of all device IDs
    • getDevices

      Set<Device> getDevices()
      Returns a sorted set of all devices
    • getDevice

      Device getDevice(String deviceId)
      Returns a device with a specific ID
    • getDeviceScanningInterval

      Long getDeviceScanningInterval()
      Get the pause in seconds between scanning for new devices
      Returns:
    • setDeviceScanningInterval

      void setDeviceScanningInterval(Long seconds)
      Set the pause in seconds between scanning for new devices
    • getUserIds

      Set<String> getUserIds()
      Returns all user IDs
      Returns:
    • save

      void save(Device device)
      Save a device
      Parameters:
      device -
    • updateLastSeen

      void updateLastSeen(Device device)
      Update only the last seen timestamp of a device
    • save

      void save(User user)
      Save a user
      Parameters:
      user -
    • addUser

      User addUser(User user)
      Add a new user
      Parameters:
      user -
      Returns:
    • delete

      void delete(User user)
      Deletes a user
      Parameters:
      user -
    • delete

      void delete(Device device)
      Delete a device
      Parameters:
      device -
    • getVersion

      String getVersion()
      Returns the current schema version. This method should only used by migrations.
      Returns:
    • setVersion

      void setVersion(String version)
      Sets the current schema version. This method should only be used by migrations.
      Parameters:
      version -
    • setCurrentNetworkState

      void setCurrentNetworkState(NetworkStateId networkState)
      Parameters:
      networkState -
    • getCurrentNetworkState

      NetworkStateId getCurrentNetworkState()
      Returns:
    • setDhcpRange

      void setDhcpRange(DhcpRange range)
      Sets the range of IP addresses the DHCP server should give to clients
      Parameters:
      range -
    • clearDhcpRange

      void clearDhcpRange()
      Removes the DHCP range.
    • getDhcpRange

      DhcpRange getDhcpRange()
      Returns the range of IP addresses the DHCP server should give to clients
      Returns:
    • getAutomaticUpdateConfig

      AutomaticUpdaterConfiguration getAutomaticUpdateConfig()
      Return the configuration for automatic updates
      Returns:
    • save

      void save(AutomaticUpdaterConfiguration configuration)
      Save the new time frame for automatic updates
      Parameters:
      configuration -
    • setAutomaticUpdatesActivated

      void setAutomaticUpdatesActivated(boolean activated)
      Save the state of the AutomaticUpdater
      Parameters:
      activated -
    • getAutomaticUpdatesActivated

      String getAutomaticUpdatesActivated()
      Get the state of the AutomaticUpdater (active or not)
      Returns:
      String "true" or "false" if this information exists, null otherwise
    • createSnapshot

      void createSnapshot()
      Persist a snapshot of the database to disk. Call this method after important data has been written.
    • saveSynchronously

      void saveSynchronously()
    • saveLastUpdateTime

      void saveLastUpdateTime(java.time.LocalDateTime lastUpdate)
      Save the last time an update was executed (either automatic or manually)
      Parameters:
      lastUpdate -
    • getLastUpdateTime

      java.time.LocalDateTime getLastUpdateTime()
      Get the last time an update was performed
      Returns:
    • getSSLEnabledState

      boolean getSSLEnabledState()
    • setSSLEnabledState

      void setSSLEnabledState(boolean enabled)
    • saveCurrentTorExitNodes

      void saveCurrentTorExitNodes(Set<String> selectedCountries)
      Save the current set of exit nodes in allowed countries for Tor instance
      Parameters:
      selectedCountries -
    • getCurrentTorExitNodes

      Set<String> getCurrentTorExitNodes()
      Get the current set of country names, which were chosen as allowed tor exit node countries
      Returns:
    • setWebRTCBlockingState

      void setWebRTCBlockingState(boolean enabled)
      Enable or disable the WebRTCBlockerProcessor, to block WebRTC connection establishments because it might leak the IP (even though the client is routed through TOR)
      Parameters:
      enabled -
    • getWebRTCBlockingState

      boolean getWebRTCBlockingState()
      Get the current state of the blocking of WebRTC
      Returns:
    • setHTTPRefererRemovingState

      void setHTTPRefererRemovingState(boolean enabled)
      Enable or disable the deletion of the HTTP Referer header from the requests
      Parameters:
      enabled -
    • getHTTPRefererRemovingState

      boolean getHTTPRefererRemovingState()
    • setGoogleCaptivePortalRedirectorState

      void setGoogleCaptivePortalRedirectorState(boolean enabled)
      Enable or disable the direct responding (by the eBlocker) to the "Google Captive Portal check"
      Parameters:
      enabled -
    • getGoogleCaptivePortalRedirectorState

      boolean getGoogleCaptivePortalRedirectorState()
    • setDntHeaderState

      void setDntHeaderState(boolean enabled)
      Enable or disable setting the DNT (Do not track) Header
      Parameters:
      enabled -
    • getDntHeaderState

      boolean getDntHeaderState()
    • setDoNotShowReminder

      void setDoNotShowReminder(boolean show)
      Enable or disable displaying the license expiration reminder to the user
      Parameters:
      show -
    • isDoNotShowReminder

      boolean isDoNotShowReminder()
    • setShowSplashScreen

      void setShowSplashScreen(boolean show)
      Enable or disable displaying of the splash screen for eBlocker 2
      Parameters:
      show -
    • isShowSplashScreen

      boolean isShowSplashScreen()
    • setAutoEnableNewDevices

      void setAutoEnableNewDevices(boolean autoEnableNewDevices)
    • isAutoEnableNewDevices

      boolean isAutoEnableNewDevices()
    • getCompressionMode

      CompressionMode getCompressionMode()
    • setCompressionMode

      void setCompressionMode(CompressionMode compressionMode)
    • getSslRecordErrors

      boolean getSslRecordErrors()
    • setSslRecordErrors

      void setSslRecordErrors(boolean recordSslErrors)
    • getCurrentLanguage

      Language getCurrentLanguage()
      Get the currently used language in the frontend
      Returns:
    • setCurrentLanguage

      void setCurrentLanguage(Language language)
      Set the current language for the frontend
      Parameters:
      language -
    • setTimezone

      void setTimezone(String posixString)
      Save the POSIX timezone String for the default timezone to use
      Parameters:
      posixString -
    • getTimezone

      String getTimezone()
      Get the POSIX timezone string
      Returns:
    • getAppModuleState

      AppWhitelistModuleBase.State getAppModuleState(int moduleID)
      Get the 'enabled' status of the AppWhitelistModule with a certain ID
      Parameters:
      moduleID -
      Returns:
      DEFAULT: if no status was set by the user, it is still the default ENABLED: the user enabled the module DISABLED: the user disabled the module
    • setAppWhitelistModuleStatus

      void setAppWhitelistModuleStatus(int moduleID, boolean enabled)
      Set an 'enabled' status for a certain AppWhitelistModule
      Parameters:
      moduleID -
      enabled -
    • getRedirectDecision

      Decision getRedirectDecision(String sessionId, String domain)
    • setRedirectDecision

      void setRedirectDecision(String sessionId, String domain, Decision decision)
    • setPasswordHash

      void setPasswordHash(byte[] passwordHash)
    • getPasswordHash

      byte[] getPasswordHash()
    • deletePasswordHash

      void deletePasswordHash()
    • getListsPackageVersion

      String getListsPackageVersion()
    • isIpFixedByDefault

      boolean isIpFixedByDefault()
    • setIsExpertMode

      void setIsExpertMode(boolean expert)
    • isExpertMode

      boolean isExpertMode()
    • setIpFixedByDefault

      void setIpFixedByDefault(boolean ipFixedByDefault)
    • setIpAddressesFixed

      void setIpAddressesFixed(boolean fixed)
    • getCleanShutdownFlag

      boolean getCleanShutdownFlag()
      Returns the flag that indicates that the last shutdown was clean.
      Returns:
      true if the shutdown was clean (or if it has never been set yet)
    • setCleanShutdownFlag

      void setCleanShutdownFlag(boolean cleanShutdown)
      Sets the flag that indicates that the last shutdown was clean. Set this to false during startup (after evaluating the flag). Set this to true in a shutdown hook.
      Parameters:
      cleanShutdown -
    • setOpenVpnServerState

      void setOpenVpnServerState(boolean state)
    • getOpenVpnServerState

      boolean getOpenVpnServerState()
    • setOpenVpnServerFirstRun

      void setOpenVpnServerFirstRun(boolean state)
    • getOpenVpnServerFirstRun

      boolean getOpenVpnServerFirstRun()
    • setOpenVpnServerHost

      void setOpenVpnServerHost(String host)
    • getOpenVpnServerHost

      String getOpenVpnServerHost()
    • getOpenVpnMappedPort

      Integer getOpenVpnMappedPort()
    • setOpenVpnMappedPort

      void setOpenVpnMappedPort(Integer port)
    • getOpenVpnPortForwardingMode

      PortForwardingMode getOpenVpnPortForwardingMode()
    • setOpenVpnPortForwardingMode

      void setOpenVpnPortForwardingMode(PortForwardingMode mode)
    • getOpenVpnExternalAddressType

      ExternalAddressType getOpenVpnExternalAddressType()
    • setOpenVpnExternalAddressType

      void setOpenVpnExternalAddressType(ExternalAddressType type)
    • getResolvedDnsGateway

      String getResolvedDnsGateway()
    • setResolvedDnsGateway

      void setResolvedDnsGateway(String gateway)
    • getDhcpLeaseTime

      Integer getDhcpLeaseTime()
    • setDhcpLeaseTime

      void setDhcpLeaseTime(Integer leaseTime)
    • isMalwareUrlFilterEnabled

      boolean isMalwareUrlFilterEnabled()
    • setMalwareUrlFilterEnabled

      void setMalwareUrlFilterEnabled(boolean enabled)
    • isContentFilterEnabled

      boolean isContentFilterEnabled()
    • setContentFilterEnabled

      void setContentFilterEnabled(boolean enabled)
    • areRouterAdvertisementsEnabled

      boolean areRouterAdvertisementsEnabled()
    • setRouterAdvertisementsEnabled

      void setRouterAdvertisementsEnabled(boolean enabled)
    • arePrivacyExtensionsEnabled

      boolean arePrivacyExtensionsEnabled()
    • setPrivacyExtensionsEnabled

      void setPrivacyExtensionsEnabled(boolean enabled)