RegisterSign In

API Documentation: Abstract Class NetworkConfigResource

Package: com.mckoi.network

The general configuration properties of a node that may change over the lifespan of a node session. The node configuration is typically located on a server accessible by all the nodes on the network. The current configuration values are periodically refreshed so that a change in the status of the network can be immediately reflected in all the nodes in the network.

The node configuration includes two important properties, 'connect_whitelist' which is a comma deliminated list of all IP addresses that a node is permitted to talk with, and 'network_nodelist' which is a list of the addresses of all nodes in the network. For example,

  connect_whitelist=127.0.0.1,\
     192.168.12.10, 192.168.12.11,\
     192.168.12.12, 192.168.12.15,\
     192.168.13.100

  network_nodelist=\
     192.168.12.10:3500, 192.168.12.11:3500,\
     192.168.12.12:3500, 192.168.12.15:3500,\
     192.168.13.100:3500
 

Constructors Summary

NetworkConfigResource()

Methods Summary

abstract void loadResource() throws IOException
abstract long getLastModifiedTime() throws IOException
abstract Properties refreshNodeProperties() throws IOException
void load() throws IOException
boolean isIPAllowed(String ip_address)
String getNetworkNodelist()
int getCheckTimeout()
static NetworkConfigResource getNetConfig(java.net.URL url)
static NetworkConfigResource getNetConfig(File f)
static NetworkConfigResource parse(String file_string)

Constructor Details

NetworkConfigResource()

Constructor.

Method Details

void loadResource()

Loads the resource into memory.

long getLastModifiedTime()

Retrieves the 'last modified' time of the configuration resource. Returns -1 if the last modification time of the resource is unknown. This is used to skip updating a configuration if the file hasn't changed.

Properties refreshNodeProperties()

Fetches the configuration node properties from the storage global storage component.

void load()

Loads the configuration properties, generating an IOException if the configuration properties could not be fetched because the resource is not available.

boolean isIPAllowed(String ip_address)

Returns true if the given ip address is allowed (whitelisted).

String getNetworkNodelist()

Returns the 'network_nodelist' property from the configuration.

int getCheckTimeout()

Returns the amount of time, in seconds, between checks of the resource file as set by the configuration property 'configcheck_timeout'.

static NetworkConfigResource getNetConfig(java.net.URL url)

Returns an implementation of NetworkConfigResource based on a URL resource.

static NetworkConfigResource getNetConfig(File f)

Returns an implementation of NetworkConfigResource based on a File resource.

static NetworkConfigResource parse(String file_string)

Parses a network configuration string. Either the string starts with http://, ftp://, etc, and is considered a URL, or starts with file://, or nothing and is considered a file.

The text on this page is licensed under the Creative Commons Attribution 3.0 License. Java is a registered trademark of Oracle and/or its affiliates.
Mckoi is Copyright © 2000 - 2020 Diehl and Associates, Inc. All rights reserved.