org.ccnx.ccn.config.SystemConfiguration Class Reference

A class encapsulating a number of system-level default parameters as well as helper functionality for managing log output and printing debug data. More...

List of all members.

Public Types

enum  DEBUGGING_FLAGS { DEBUG_SIGN, DEBUG_VERIFY, DUMP_DAEMONCMD, REPO_EXITDUMP }

Static Public Member Functions

static int getDefaultTimeout ()
 Get system default timeout.
static void setDefaultTimeout (int newTimeout)
 Set system default timeout.
static Object getManagementBean ()
 Obtain the management bean for this runtime if it is available.
static String getLocalHost ()
static String getDefaultEncoding ()
 Order of precedence (highest to lowest):
static void setDefaultEncoding (String encoding)
static boolean checkDebugFlag (DEBUGGING_FLAGS debugFlag)
static void setDebugFlag (DEBUGGING_FLAGS debugFlag, boolean value)
static void setDebugFlag (String debugFlag, boolean value)
static String debugFlagList ()
static void setDebugFlag (String debugFlag)
static void setDebugDataDirectory (String dir)
static void outputDebugData (ContentName name, XMLEncodable data)
static void outputDebugData (ContentName name, byte[] data)
static void outputDebugObject (File dataDir, String postfix, ContentObject object)
static void outputDebugObject (ContentObject object)
static void logObject (String message, ContentObject co)
 Log information about an object at level Level.INFO.
static void logObject (Level level, String message, ContentObject co)
 Log the gory details of an object, including debugging information relevant to object signing.
static String getLoggingConfiguration ()
 Configure logging itself.
static boolean hasLoggingConfigurationProperty (String property)
static String getPID ()
 Gets a process identifier (PID) for the running Java Virtual Machine (JVM) process, if possible.
static boolean disableAccessControl ()
 Allow control of access control at the command line.
static void setAccessControlDisabled (boolean accessControlDisabled)
static String retrievePropertyOrEnvironmentVariable (String javaPropertyName, String environmentVariableName, String defaultValue)
 Retrieve a string that might be stored as an environment variable, or overridden on the command line.

Static Public Attributes

static final String STRING_FALSE = "false"
 String constants, to define these in one place.
static final String STRING_TRUE = "true"
static final int SYSTEM_STOP_TIMEOUT = 30000
 System operation timeout.
static final int MAX_TIMEOUT = 10000
 Very long timeout for network operations, in msec.
static final int EXTRA_LONG_TIMEOUT = 6000
 Extra-long timeout, e.g.
static final int LONG_TIMEOUT = 3000
 Longer timeout, for e.g.
static final int MEDIUM_TIMEOUT = 1000
 Medium timeout, used as system default.
static final int SHORT_TIMEOUT = 300
 Short timeout; for things you expect to exist or not exist locally.
static final String DEFAULT_PROTOCOL = "TCP"
static NetworkProtocol AGENT_PROTOCOL = null
static final String AGENT_PROTOCOL_PROPERTY = "org.ccnx.agent.protocol"
static final String AGENT_PROTOCOL_ENVIRONMENT_VARIABLE = "CCN_AGENT_PROTOCOL"
static final boolean DEFAULT_EXIT_ON_NETWORK_ERROR = false
 Controls whether we should exit on severe errors in the network manager.
static boolean EXIT_ON_NETWORK_ERROR = DEFAULT_EXIT_ON_NETWORK_ERROR
static final String CCN_EXIT_ON_NETWORK_ERROR_PROPERTY = "org.ccnx.ExitOnNetworkError"
static final String CCN_EXIT_ON_NETWORK_ERROR_ENVIRONMENT_VARIABLE = "CCN_EXIT_ON_NETERROR"
static final int INTEREST_REEXPRESSION_DEFAULT = 4000
 Interest reexpression period TODO - This is (currently) an architectual constant.
static final String DEBUG_FLAG_PROPERTY = "com.parc.ccn.DebugFlags"
 Property to set debug flags.
static final String DEBUG_DATA_DIRECTORY_PROPERTY = "com.parc.ccn.DebugDataDirectory"
 Property to set directory to dump debug data.
static String DEBUG_DATA_DIRECTORY = null
static final int CHILD_WAIT_INTERVAL_DEFAULT = 300
static int CHILD_WAIT_INTERVAL = CHILD_WAIT_INTERVAL_DEFAULT
static final int FC_TIMEOUT_DEFAULT = MAX_TIMEOUT
static int FC_TIMEOUT = FC_TIMEOUT_DEFAULT
static final boolean FC_LOCALREPOSITORY_DEFAULT = false
static boolean FC_LOCALREPOSITORY = FC_LOCALREPOSITORY_DEFAULT
static final int CCNDID_DISCOVERY_TIMEOUT_DEFAULT = 4200
static int CCNDID_DISCOVERY_TIMEOUT = CCNDID_DISCOVERY_TIMEOUT_DEFAULT
static int PIPELINE_SIZE = 4
static int PIPELINE_SEGMENTATTEMPTS = 5
static int PIPELINE_RTTFACTOR = 2
static boolean PIPELINE_STATS = false
static boolean OLD_HEADER_NAMES = true
static final int CCND_OP_TIMEOUT_DEFAULT = 4200
static int CCND_OP_TIMEOUT = CCND_OP_TIMEOUT_DEFAULT
static final int CCNX_TIMEOUT_DEFAULT = EXTRA_LONG_TIMEOUT
static final int GLV_ATTEMPT_TIMEOUT_DEFAULT = SHORT_TIMEOUT
static int GLV_ATTEMPT_TIMEOUT = GLV_ATTEMPT_TIMEOUT_DEFAULT
static int SETTABLE_SHORT_TIMEOUT = SHORT_TIMEOUT
static int MAX_DISPATCH_THREADS = 200
static final int NO_TIMEOUT = -1
 No timeout.
static final int GET_LATEST_VERSION_ATTEMPTS = 10
 Set the maximum number of attempts that VersioningProfile.getLatestVersion will try to get a later version of an object.
static final int DEBUG_RADIX = 34
static final String LOGGING_CONFIGURATION_PROPERTY = "com.parc.ccn.LoggingConfiguration"
 TODO: Fix this incorrect comment Property to turn off access control flags.
static final String DETAILED_LOGGER = "DetailedLogger"
 Strings of interest to be set in the logging configuration.
static final String ACCESS_CONTROL_DISABLED_PROPERTY = "com.parc.ccn.DisableAccessControl"
 Property to turn off access control flags.

Static Protected Attributes

static final String CCN_PROTOCOL_PROPERTY = "org.ccnx.protocol"
static HashMap
< DEBUGGING_FLAGS, Boolean > 
DEBUG_FLAG_VALUES = new HashMap<DEBUGGING_FLAGS,Boolean>()
static final String DEFAULT_DEBUG_DATA_DIRECTORY = "./CCN_DEBUG_DATA"
static final String CHILD_WAIT_INTERVAL_PROPERTY = "org.ccnx.EnumList.WaitInterval"
 Tunable timeouts as well as timeout defaults.
static final String FC_TIMEOUT_PROPERTY = "org.ccnx.fc.timeout"
 Default timeout for the flow controller.
static final String FC_LOCALREPOSITORY_PROPERTY = "org.ccnx.fc.localrepository"
 Allow override to only save to a local repository.
static final String FC_LOCALREPOSITORY_ENV_VAR = "FC_LOCALREPOSITORY"
static final String CCNDID_DISCOVERY_TIMEOUT_PROPERTY = "org.ccnx.ccndid.timeout"
 How long to wait for a service discovery timeout in CCNNetworkManager, in ms.
static final String PIPELINE_SIZE_PROPERTY = "org.ccnx.PipelineSize"
 Pipeline size for pipeline in CCNAbstractInputStream Default is 4.
static final String PIPELINE_SIZE_ENV_VAR = "JAVA_PIPELINE_SIZE"
static final String PIPELINE_ATTEMPTS_PROPERTY = "org.ccnx.PipelineAttempts"
 Pipeline segment attempts for pipeline in CCNAbstractInputStream Default is 5.
static final String PIPELINE_ATTEMPTS_ENV_VAR = "JAVA_PIPELINE_ATTEMPTS"
static final String PIPELINE_RTT_PROPERTY = "org.ccnx.PipelineRTTFactor"
 Pipeline round trip time factor for pipeline in CCNAbstractInputStream Default is 2.
static final String PIPELINE_RTT_ENV_VAR = "JAVA_PIPELINE_RTTFACTOR"
static final String PIPELINE_STATS_PROPERTY = "org.ccnx.PipelineStats"
 Pipeline stat printouts in CCNAbstractInputStream Default is off.
static final String PIPELINE_STATS_ENV_VAR = "JAVA_PIPELINE_STATS"
static final String OLD_HEADER_NAMES_PROPERTY = "org.ccnx.OldHeaderNames"
 Backwards-compatible handling of old header names.
static final String OLD_HEADER_NAMES_ENV_VAR = "CCNX_OLD_HEADER_NAMES"
static final String CCND_OP_TIMEOUT_PROPERTY = "org.ccnx.ccnop.timeout"
 Timeout used for communication with local 'ccnd' for control operations.
static final String CCND_OP_TIMEOUT_ENV_VAR = "CCND_OP_TIMEOUT"
static final String CCNX_TIMEOUT_PROPERTY = "org.ccnx.default.timeout"
 System default timeout.
static final String CCNX_TIMEOUT_ENV_VAR = "CCNX_TIMEOUT"
static final String GLV_ATTEMPT_TIMEOUT_PROPERTY = "org.ccnx.glv.attempt.timeout"
 GetLatestVersion attempt timeout.
static final String GLV_ATTEMPT_TIMEOUT_ENV_VAR = "GLV_ATTEMPT_TIMEOUT"
static final String SETTABLE_SHORT_TIMEOUT_PROPERTY = "org.ccnx.short.timeout"
 "Short timeout" that can be set
static final String SETTABLE_SHORT_TIMEOUT_ENV_VAR = "SETTABLE_SHORT_TIMEOUT"
static final String MAX_DISPATCH_THREADS_PROPERTY = "org.ccnx.max.dispatch.threads"
 Dispatch thread limit for network manager.
static final String MAX_DISPATCH_THREADS_ENV_VAR = "CCNX_MAX_DISPATCH_THREADS"
static int _defaultTimeout = CCNX_TIMEOUT_DEFAULT
 Settable system default timeout.
static final String SYSTEM_DEFAULT_ENCODING = BinaryXMLCodec.codecName()
 Can set compile-time default encoding here.
static String DEFAULT_ENCODING = null
 Run-time default.
static final String DEFAULT_ENCODING_PROPERTY
 Command-line property to set default encoding.
static String _loggingConfiguration
static Boolean _accessControlDisabled

Static Package Functions

 [static initializer]
 [static initializer]

Detailed Description

A class encapsulating a number of system-level default parameters as well as helper functionality for managing log output and printing debug data.

Eventually will be supported by an external configuration file for controlling key parameters.

The current basic logging infrastructure uses standard Java logging, controlled only by a system-wide Level value. That value, as well as other logging-related parameters are currently managed by the Log class, but should eventually migrate here. There is a facility for selective logging control, by turning on and off logging for individual named "modules"; though that has not yet been widely utilized. Eventually we should support separate log Level settings for each module when necessary.


Member Function Documentation

static String org.ccnx.ccn.config.SystemConfiguration.getDefaultEncoding (  )  [static]

Order of precedence (highest to lowest):

1) dynamic setting on an individual encoder or decoder, or in a single encode or decode call

2) command-line property

3) compiled-in default

The latter two are handled here, the former in the encoder/decoder machinery itself.

Returns:
static int org.ccnx.ccn.config.SystemConfiguration.getDefaultTimeout (  )  [static]

Get system default timeout.

Returns:
the default timeout.
static String org.ccnx.ccn.config.SystemConfiguration.getLoggingConfiguration (  )  [static]

Configure logging itself.

This is a set of concatenated strings set as a command line property; it can be used to set transparent properties read at various points in the code.

static Object org.ccnx.ccn.config.SystemConfiguration.getManagementBean (  )  [static]

Obtain the management bean for this runtime if it is available.

The class of the management bean is discovered at runtime and there should be no static dependency on any particular bean class.

Returns:
the bean or null if none available
static String org.ccnx.ccn.config.SystemConfiguration.getPID (  )  [static]

Gets a process identifier (PID) for the running Java Virtual Machine (JVM) process, if possible.

Java does not provide a supported way to obtain the operating system (OS) PID in general. This method uses technique(s) for getting the OS PID that are not necessarily portable to all Java execution environments. The PID is returned as a String value. Where possible, the result will be the string representation of an integer that is probably identical to the OS PID of the JVM process that executed this method. In other cases, the result will be an implementation-dependent string name that identifies the JVM instance but does not exactly match the OS PID. The returned value will not contain spaces. If no identifier can be obtained, the result will be null.

Returns:
A Process Identifier (PID) of the JVM (not necessarily the OS PID) or null if not available
See also:
Techniques for Discovering PID
static void org.ccnx.ccn.config.SystemConfiguration.logObject ( Level  level,
String  message,
ContentObject  co 
) [static]

Log the gory details of an object, including debugging information relevant to object signing.

Parameters:
level log Level to control printing of log messages
message message to prefix output with
co ContentObject to print debugging information for
static void org.ccnx.ccn.config.SystemConfiguration.logObject ( String  message,
ContentObject  co 
) [static]

Log information about an object at level Level.INFO.

See logObject(Level, String, ContentObject) for details.

Parameters:
message String to prefix output with
co ContentObject to print debugging information about.
See also:
logObject(Level, String, ContentObject)
static String org.ccnx.ccn.config.SystemConfiguration.retrievePropertyOrEnvironmentVariable ( String  javaPropertyName,
String  environmentVariableName,
String  defaultValue 
) [static]

Retrieve a string that might be stored as an environment variable, or overridden on the command line.

If the command line variable is set, return its (String) value; if not, return the environment variable value if available; Caller should synchronize as appropriate.

Returns:
The value in force for this variable, or null if unset.

Member Data Documentation

final String org.ccnx.ccn.config.SystemConfiguration.ACCESS_CONTROL_DISABLED_PROPERTY = "com.parc.ccn.DisableAccessControl" [static]

Property to turn off access control flags.

Set it to any value and it will turn off access control; used for testing.

final String org.ccnx.ccn.config.SystemConfiguration.CCND_OP_TIMEOUT_PROPERTY = "org.ccnx.ccnop.timeout" [static, protected]

Timeout used for communication with local 'ccnd' for control operations.

An example is Face Creation and Prefix Registration. Should be longer than the interest timeout to permit at least one re-expression. TODO - ccnop would properly be spelled ccndop

final String org.ccnx.ccn.config.SystemConfiguration.CCNDID_DISCOVERY_TIMEOUT_PROPERTY = "org.ccnx.ccndid.timeout" [static, protected]

How long to wait for a service discovery timeout in CCNNetworkManager, in ms.

This should be longer than the interest timeout to permit at least one re-expression.

final String org.ccnx.ccn.config.SystemConfiguration.CHILD_WAIT_INTERVAL_PROPERTY = "org.ccnx.EnumList.WaitInterval" [static, protected]

Tunable timeouts as well as timeout defaults.

Enumerated Name List looping timeout in ms. Default is 300ms

Run-time default.

Set to command line property if given, if not, the system default above.

Initial value:
 
                "com.parc.ccn.data.DefaultEncoding"

Command-line property to set default encoding.

Returns:

Controls whether we should exit on severe errors in the network manager.

This should only be set true in automated tests. In live running code, we hope to be able to recover instead.

Extra-long timeout, e.g.

to get around reexpression timing issues.

final String org.ccnx.ccn.config.SystemConfiguration.GLV_ATTEMPT_TIMEOUT_PROPERTY = "org.ccnx.glv.attempt.timeout" [static, protected]

GetLatestVersion attempt timeout.

TODO This timeout is set to MEDIUM_TIMEOUT to work around the problem in ccnd where some interests take >300ms (and sometimes longer, have seen periodic delays >800ms) when that bug is found and fixed, this can be reduced back to the SHORT_TIMEOUT. long attemptTimeout = SystemConfiguration.SHORT_TIMEOUT;

Interest reexpression period TODO - This is (currently) an architectual constant.

Not all code has been changed to use it.

final String org.ccnx.ccn.config.SystemConfiguration.LOGGING_CONFIGURATION_PROPERTY = "com.parc.ccn.LoggingConfiguration" [static]

TODO: Fix this incorrect comment Property to turn off access control flags.

Set it to any value and it will turn off access control; used for testing.

Longer timeout, for e.g.

waiting for a latest version and being sure you have anything available locally in msec.

Very long timeout for network operations, in msec.

No timeout.

Should be single value used in all places in the code where you want to block forever.

final String org.ccnx.ccn.config.SystemConfiguration.OLD_HEADER_NAMES_PROPERTY = "org.ccnx.OldHeaderNames" [static, protected]

Backwards-compatible handling of old header names.

Current default is true; eventually will be false.

final String org.ccnx.ccn.config.SystemConfiguration.SYSTEM_DEFAULT_ENCODING = BinaryXMLCodec.codecName() [static, protected]

Can set compile-time default encoding here.

Choices are currently "Text" and "Binary", or better yet BinaryXMLCodec.codecName() or TextXMLCodec.codecName().

System operation timeout.

Very long timeout used to wait for system events such as stopping Daemons.


The documentation for this class was generated from the following file:
Generated on Fri May 13 16:27:37 2011 for Content-Centric Networking in Java by  doxygen 1.6.3