Package org.drasyl

Class DrasylConfig


  • public class DrasylConfig
    extends Object
    This class represents the configuration for a DrasylNode. For example, it defines the identity and the Super Peer.

    This is an immutable object.

    • Constructor Detail

      • DrasylConfig

        public DrasylConfig()
      • DrasylConfig

        public DrasylConfig​(com.typesafe.config.Config config)
        Creates a new config for a drasyl node.
        Parameters:
        config - config to be loaded
        Throws:
        DrasylConfigException - if config is invalid
    • Method Detail

      • getProofOfWork

        public static ProofOfWork getProofOfWork​(com.typesafe.config.Config config,
                                                 String path)
        Gets the ProofOfWork at the given path. Similar to Config, an exception is thrown for an invalid value.
        Parameters:
        config - the application's portion of the configuration
        path - path expression
        Returns:
        the ProofOfWork value at the requested path
        Throws:
        DrasylConfigException - if value is absent or null
      • getPath

        public static Path getPath​(com.typesafe.config.Config config,
                                   String path)
        Gets the Path at the given path.
        Parameters:
        config - the application's portion of the configuration
        path - path expression
        Returns:
        the Path value at the requested path
        Throws:
        DrasylConfigException - if value at path is invalid
      • getShort

        public static short getShort​(com.typesafe.config.Config config,
                                     String path)
        Gets the short at the given path. Similar to Config, an exception is thrown for an out-of-range value.
        Parameters:
        config - the application's portion of the configuration
        path - path expression
        Returns:
        the short value at the requested path
        Throws:
        DrasylConfigException - if value is not convertible to a short
      • getByte

        public static byte getByte​(com.typesafe.config.Config config,
                                   String path)
        Gets the byte at the given path. Similar to Config, an exception is thrown for an out-of-range value.
        Parameters:
        config - the application's portion of the configuration
        path - path expression
        Returns:
        the byte value at the requested path
        Throws:
        DrasylConfigException - if value is not convertible to a short
      • getURI

        public static URI getURI​(com.typesafe.config.Config config,
                                 String path)
        Gets the URI at the given path.
        Parameters:
        config - the application's portion of the configuration
        path - path expression
        Returns:
        the URI value at the requested path
        Throws:
        DrasylConfigException - if value at path is invalid
      • getSerializationSerializers

        public static Map<String,​Serializer> getSerializationSerializers​(com.typesafe.config.Config config,
                                                                               String path)
      • parseFile

        public static DrasylConfig parseFile​(File file)
        Parses a file into a Config instance as with
        Parameters:
        file - the file to parse
        Returns:
        the parsed configuration
        Throws:
        DrasylConfigException - on IO or parse errors
      • parseString

        public static DrasylConfig parseString​(String s)
        Parses a file into a Config instance as with
        Parameters:
        s - string to parse
        Returns:
        the parsed configuration
        Throws:
        DrasylConfigException - on IO or parse errors
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getRemotePingTimeout

        public Duration getRemotePingTimeout()
      • getRemotePingCommunicationTimeout

        public Duration getRemotePingCommunicationTimeout()
      • getRemoteUniteMinInterval

        public Duration getRemoteUniteMinInterval()
      • getRemotePingMaxPeers

        public int getRemotePingMaxPeers()
      • getNetworkId

        public int getNetworkId()
      • isMonitoringEnabled

        public boolean isMonitoringEnabled()
      • getMonitoringHostTag

        public String getMonitoringHostTag()
      • getMonitoringInfluxUri

        public URI getMonitoringInfluxUri()
      • getMonitoringInfluxUser

        public String getMonitoringInfluxUser()
      • getMonitoringInfluxPassword

        public String getMonitoringInfluxPassword()
      • getMonitoringInfluxDatabase

        public String getMonitoringInfluxDatabase()
      • getMonitoringInfluxReportingFrequency

        public Duration getMonitoringInfluxReportingFrequency()
      • isRemoteEnabled

        public boolean isRemoteEnabled()
      • getRemoteBindHost

        public InetAddress getRemoteBindHost()
      • getRemoteBindPort

        public int getRemoteBindPort()
      • getRemoteEndpoints

        public Set<Endpoint> getRemoteEndpoints()
      • isRemoteExposeEnabled

        public boolean isRemoteExposeEnabled()
      • getRemotePingInterval

        public Duration getRemotePingInterval()
      • isRemoteSuperPeerEnabled

        public boolean isRemoteSuperPeerEnabled()
      • getRemoteSuperPeerEndpoints

        public Set<Endpoint> getRemoteSuperPeerEndpoints()
      • getIdentityProofOfWork

        public ProofOfWork getIdentityProofOfWork()
      • getIdentityPath

        public Path getIdentityPath()
      • getRemoteMessageMtu

        public int getRemoteMessageMtu()
      • getRemoteMessageMaxContentLength

        public int getRemoteMessageMaxContentLength()
      • getRemoteMessageComposedMessageTransferTimeout

        public Duration getRemoteMessageComposedMessageTransferTimeout()
      • getRemoteMessageHopLimit

        public byte getRemoteMessageHopLimit()
      • isRemoteMessageArmEnabled

        public boolean isRemoteMessageArmEnabled()
      • isIntraVmDiscoveryEnabled

        public boolean isIntraVmDiscoveryEnabled()
      • isRemoteLocalHostDiscoveryEnabled

        public boolean isRemoteLocalHostDiscoveryEnabled()
      • getRemoteLocalHostDiscoveryPath

        public Path getRemoteLocalHostDiscoveryPath()
      • getRemoteLocalHostDiscoveryLeaseTime

        public Duration getRemoteLocalHostDiscoveryLeaseTime()
      • getSerializationsBindingsInbound

        public Map<Class<?>,​String> getSerializationsBindingsInbound()
      • getSerializationsBindingsOutbound

        public Map<Class<?>,​String> getSerializationsBindingsOutbound()