p2ps.imp.peer.config
Class ConfigUtils

java.lang.Object
  extended byp2ps.imp.peer.config.ConfigUtils

public class ConfigUtils
extends java.lang.Object

A utility class for reading/writing configs

Version:
$Revision: 295 $
Author:
Ian Wang

Field Summary
static java.lang.String ADVERT_INSTANTIATORS_TAG
           
static java.lang.String CLIENT_SECURITY_LEVEL
           
static java.lang.String COUNTRY_TAG
           
static java.lang.String DEFAULT_CLIENT_SECURITY_LEVEL
           
static int DEFAULT_MAX_PORT
           
static int DEFAULT_MIN_PORT
           
static java.lang.String DEFAULT_SERVER_SECURITY_LEVEL
           
static java.lang.String DISCOVERY_SERVICE_CLASS_TAG
           
static java.lang.String EMAIL_TAG
           
static java.lang.String GROUP_SERVICE_CLASS_TAG
           
static java.lang.String ID_FACTORY_CLASS_TAG
           
static java.lang.String IDENTITY_TAG
           
static java.lang.String KEY_ALIAS_TAG
           
static java.lang.String KEY_STORE_TAG
           
static java.lang.String KEY_STORE_TEMPORARY_TAG
           
static java.lang.String LOCALITY_TAG
           
static java.lang.String NAME_TAG
           
static java.lang.String NETWORK_INTERFACE_CLASS_TAG
           
static java.lang.String ORGANIZATIONAL_TAG
           
static java.lang.String ORGANIZATIONAL_UNIT_TAG
           
static java.lang.String P2PS_CONFIG_TAG
           
static java.lang.String PEER_FACTORY_CLASS_TAG
           
static java.lang.String PIPE_SERVICE_CLASS_TAG
           
static java.lang.String PORT_MAX_TAG
           
static java.lang.String PORT_MIN_TAG
           
static java.lang.String PORT_RANGE_INPUT_ONLY_TAG
           
static java.lang.String PROPERTIES_FILE
           
static java.lang.String REMOTE_RENDEZVOUS_URI_TAG
           
static java.lang.String RENDEZVOUS_ALWAYS
           
static java.lang.String RENDEZVOUS_IF_REQUIRED
           
static java.lang.String RENDEZVOUS_NEVER
           
static java.lang.String RENDEZVOUS_SERVICE_CLASS_TAG
           
static java.lang.String RENDEZVOUS_TAG
           
static java.lang.String SERVER_SECURITY_LEVEL
           
static java.lang.String STATE_TAG
           
 
Constructor Summary
ConfigUtils()
           
 
Method Summary
static java.io.File getDefaultFile()
           
static void printConfig(Config config)
          Outputs the config to the System.out
static Config readConfig()
          Static constructor and loader for P2PS Config
static Config readConfig(java.io.File file)
          Static constructor for P2PS Config from an input file
static void writeConfig(Config config)
          Write a configuration to the default file
static void writeConfig(Config config, java.io.File file)
          Write a configuration to the specified file
static void writeConfig(Config config, java.io.Writer writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MIN_PORT

public static final int DEFAULT_MIN_PORT
See Also:
Constant Field Values

DEFAULT_MAX_PORT

public static final int DEFAULT_MAX_PORT
See Also:
Constant Field Values

DEFAULT_CLIENT_SECURITY_LEVEL

public static final java.lang.String DEFAULT_CLIENT_SECURITY_LEVEL
See Also:
Constant Field Values

DEFAULT_SERVER_SECURITY_LEVEL

public static final java.lang.String DEFAULT_SERVER_SECURITY_LEVEL
See Also:
Constant Field Values

PROPERTIES_FILE

public static final java.lang.String PROPERTIES_FILE
See Also:
Constant Field Values

P2PS_CONFIG_TAG

public static final java.lang.String P2PS_CONFIG_TAG
See Also:
Constant Field Values

KEY_STORE_TAG

public static final java.lang.String KEY_STORE_TAG
See Also:
Constant Field Values

KEY_ALIAS_TAG

public static final java.lang.String KEY_ALIAS_TAG
See Also:
Constant Field Values

KEY_STORE_TEMPORARY_TAG

public static final java.lang.String KEY_STORE_TEMPORARY_TAG
See Also:
Constant Field Values

CLIENT_SECURITY_LEVEL

public static final java.lang.String CLIENT_SECURITY_LEVEL
See Also:
Constant Field Values

SERVER_SECURITY_LEVEL

public static final java.lang.String SERVER_SECURITY_LEVEL
See Also:
Constant Field Values

IDENTITY_TAG

public static final java.lang.String IDENTITY_TAG
See Also:
Constant Field Values

NAME_TAG

public static final java.lang.String NAME_TAG
See Also:
Constant Field Values

EMAIL_TAG

public static final java.lang.String EMAIL_TAG
See Also:
Constant Field Values

ORGANIZATIONAL_UNIT_TAG

public static final java.lang.String ORGANIZATIONAL_UNIT_TAG
See Also:
Constant Field Values

ORGANIZATIONAL_TAG

public static final java.lang.String ORGANIZATIONAL_TAG
See Also:
Constant Field Values

LOCALITY_TAG

public static final java.lang.String LOCALITY_TAG
See Also:
Constant Field Values

STATE_TAG

public static final java.lang.String STATE_TAG
See Also:
Constant Field Values

COUNTRY_TAG

public static final java.lang.String COUNTRY_TAG
See Also:
Constant Field Values

DISCOVERY_SERVICE_CLASS_TAG

public static final java.lang.String DISCOVERY_SERVICE_CLASS_TAG
See Also:
Constant Field Values

PIPE_SERVICE_CLASS_TAG

public static final java.lang.String PIPE_SERVICE_CLASS_TAG
See Also:
Constant Field Values

RENDEZVOUS_SERVICE_CLASS_TAG

public static final java.lang.String RENDEZVOUS_SERVICE_CLASS_TAG
See Also:
Constant Field Values

GROUP_SERVICE_CLASS_TAG

public static final java.lang.String GROUP_SERVICE_CLASS_TAG
See Also:
Constant Field Values

PEER_FACTORY_CLASS_TAG

public static final java.lang.String PEER_FACTORY_CLASS_TAG
See Also:
Constant Field Values

ID_FACTORY_CLASS_TAG

public static final java.lang.String ID_FACTORY_CLASS_TAG
See Also:
Constant Field Values

NETWORK_INTERFACE_CLASS_TAG

public static final java.lang.String NETWORK_INTERFACE_CLASS_TAG
See Also:
Constant Field Values

ADVERT_INSTANTIATORS_TAG

public static final java.lang.String ADVERT_INSTANTIATORS_TAG
See Also:
Constant Field Values

RENDEZVOUS_TAG

public static final java.lang.String RENDEZVOUS_TAG
See Also:
Constant Field Values

RENDEZVOUS_ALWAYS

public static final java.lang.String RENDEZVOUS_ALWAYS
See Also:
Constant Field Values

RENDEZVOUS_IF_REQUIRED

public static final java.lang.String RENDEZVOUS_IF_REQUIRED
See Also:
Constant Field Values

RENDEZVOUS_NEVER

public static final java.lang.String RENDEZVOUS_NEVER
See Also:
Constant Field Values

PORT_MIN_TAG

public static final java.lang.String PORT_MIN_TAG
See Also:
Constant Field Values

PORT_MAX_TAG

public static final java.lang.String PORT_MAX_TAG
See Also:
Constant Field Values

PORT_RANGE_INPUT_ONLY_TAG

public static final java.lang.String PORT_RANGE_INPUT_ONLY_TAG
See Also:
Constant Field Values

REMOTE_RENDEZVOUS_URI_TAG

public static final java.lang.String REMOTE_RENDEZVOUS_URI_TAG
See Also:
Constant Field Values
Constructor Detail

ConfigUtils

public ConfigUtils()
Method Detail

writeConfig

public static void writeConfig(Config config)
                        throws java.io.IOException
Write a configuration to the default file

Throws:
java.io.IOException

writeConfig

public static void writeConfig(Config config,
                               java.io.File file)
                        throws java.io.IOException
Write a configuration to the specified file

Throws:
java.io.IOException

writeConfig

public static void writeConfig(Config config,
                               java.io.Writer writer)
                        throws java.io.IOException
Throws:
java.io.IOException

readConfig

public static final Config readConfig()
                               throws java.io.IOException
Static constructor and loader for P2PS Config

Returns:
A successfuly loaded Config or null if none exists
Throws:
java.io.IOException

readConfig

public static final Config readConfig(java.io.File file)
                               throws java.io.IOException
Static constructor for P2PS Config from an input file

Returns:
A successfuly loaded Config
Throws:
java.io.IOException

getDefaultFile

public static java.io.File getDefaultFile()
Returns:
the default config file

printConfig

public static void printConfig(Config config)
Outputs the config to the System.out