public class DCNodeConfigData extends java.lang.Object implements ConfigIfc, java.io.Serializable, java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ASCODEBASE |
static java.lang.String |
BACKUP |
static java.lang.String |
BULKIO |
protected java.util.Hashtable |
configFiles
Hashtable containing byte arrays representing secondary configuration
files.
|
static java.lang.String |
DATAFILESIZE |
static java.lang.String |
DEBUG |
protected boolean |
dirtyFlag
True, if a value has changed
|
static java.lang.String |
EXPCHANOPERATOR |
static java.lang.String |
EXPCHANVALUE |
static java.lang.String |
EXPCHANVALUE2 |
static java.lang.String |
FILELEVELTRANSACTION |
static java.lang.String |
INPUTMONTIME |
static java.lang.String |
INPUTMONTIMEUNIT |
static java.lang.String |
LOGFILESIZE |
static java.lang.String |
MONITORINPUT |
static java.lang.String |
NARBACKUP |
static java.lang.String |
NARBACKUPDAYS |
protected java.lang.String |
nodeId
ID for the node that this DCNodeConfigData Object represents
|
static java.lang.String |
NUMCHANNELS |
static java.lang.String |
NUMEXPCHANVALUES |
static java.lang.String |
NUMEXPCHANVALUES2 |
static java.lang.String |
PULLTIME |
static java.lang.String |
PUSHTIME |
static java.lang.String |
RECORDSTATS |
static java.lang.String |
ROUTING |
static java.lang.String |
ROUTINGATTRIBUTE |
protected java.lang.String |
ruleName
Name of the rules file or Class name
|
protected byte[] |
rules
Rules information for the node that this DCNodeConfigData Object contains
configuration information for.
|
static java.lang.String |
RULESFILE |
protected java.lang.String |
secFileName
Name of the file which contains the list of secondary configuration file
names.
|
static java.lang.String |
SECONDARYCFG |
protected java.lang.String |
udcHome
Location of the UDC installation
|
protected boolean |
useFile
Indicates whether the node should use a rules file or a Class
|
protected java.util.Hashtable |
varTable
Hashtable that holds all the variables
|
Constructor and Description |
---|
DCNodeConfigData()
Constructor to be used by GUI to create a DCNodeConfigData with initial
set of default values
|
DCNodeConfigData(java.lang.String inUdcHome,
java.lang.String inNodeId)
Constructor to be used by NodeManager which is aware of the udcHome and
nodeId
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Deep clone the HashTable (varTable)
|
void |
defaultValue(java.lang.String name,
java.lang.String value)
Sets the default value for the given key
|
void |
deleteItem(java.lang.String itemName)
Removes the given item from
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getBackupDir()
Returns the absolute path name for the backup directory for the node
represented by this DCNodeConfigData Object.
|
java.lang.String |
getConfigDir()
Returns the absolute path name for the config directory for the node
represented by this DCNodeConfigData Object.
|
byte[] |
getConfigFile(java.lang.String filename)
Returns the contents of given secondary configuration file name
|
java.util.Enumeration |
getConfigFileNames()
Returns the names of secondary configuration files used by this node.
|
boolean |
getDirty() |
java.lang.String |
getGenConfigFilePathName()
Returns the absolute path name of the rules file containing the "General"
information being used for the node associated with this DCNodeConfigData
Object.
|
java.lang.String |
getHomeDir()
Returns the directory location of the UDC installation.
|
java.lang.String |
getItem(java.lang.String itemName)
Called by the GUI to retrieve items from
|
java.lang.String |
getNodeId() |
java.util.Vector |
getPreferredRules()
Returns the preferred rule set for this node
|
java.lang.String |
getPrefRulesFilePathName()
Returns the absolute path name of the file containing the preferred rules
file names being used for the node associated with this DCNodeConfigData
Object.
|
byte[] |
getRuleClass() |
java.lang.String |
getRuleFilePathName()
Returns the absolute path name of the rules file being used for the node
associated with this DCNodeConfigData Object.
|
java.lang.String |
getRuleName()
Returns the name of the rule file.
|
byte[] |
getRules() |
java.util.Enumeration |
getSettingsKeys()
Returns the set of
String keys used for setting values of
this node. |
boolean |
getUseFile() |
void |
load()
Used by the NodeManager to load the general configuration and rules files
into memory.
|
void |
load(boolean getPasswords) |
protected void |
readConfigFiles()
Builds the
configFiles Hashtable based on the contents of
the "secondary.cfg" file. |
protected byte[] |
readFile(java.lang.String fileSpec)
Returns the contents of the given configuration filename
|
void |
save()
Used by the NodeManager to persist the general configuration and rules
files to disk.
|
protected void |
setBaseDefaults()
Sets the default values for this DCNodeConfigData's general configuration
parameters.
|
void |
setConfigFile(java.lang.String filename,
byte[] data)
Stores a secondary configuration file in this DCNodeConfigData object
|
protected void |
setDefaults()
Should be overridden by derived classes to set node specific default
values.
|
void |
setDirty(boolean d)
Sets value of
dirtyFlag to d |
void |
setHomeDir(java.lang.String inUdcHome)
Sets
udcHome . |
void |
setItem(java.lang.String itemName,
java.lang.String value)
Called by the GUI to add items to
. |
void |
setNodeId(java.lang.String inNodeId)
Used by the NodeManager to set the nodeId for the node associated with
this DCNodeConfigData Object.
|
void |
setPreferredRules(java.util.Vector prefRules)
Sets the preferred rule set for this node.
|
void |
setRuleClass(byte[] ruleClass) |
void |
setRuleFileName(java.lang.String name)
Sets the name of the rule file.
|
void |
setRuleFilePathName(java.lang.String inRuleFilePathName)
Sets the absolute path name of the rules file being used for the node
associated with this DCNodeConfigData Object.
|
void |
setRules(byte[] rules) |
void |
setRulesFromClass(java.io.File ruleClassFile,
java.lang.String classString)
Reads the contents of the given file and sets the rule name to the given
String.
|
void |
setRulesFromClass(java.lang.String inRuleClassName,
java.lang.String asHostName,
int urlPort)
Used by the AdminServer to set the given Class file.
|
void |
setRulesFromFile(java.lang.String inRuleFileName)
Used by the AdminServer to read the given rules file.
|
void |
setUseFile(boolean useFile) |
java.lang.String |
toString() |
protected void |
writeConfigFiles()
Writes out the secondary configuration files to disk.
|
protected void |
writeFile(java.lang.String outputFile,
byte[] bytes)
Writes the given byte stream to the given configuration filename
|
protected java.util.Hashtable varTable
protected java.lang.String nodeId
protected java.lang.String udcHome
protected java.lang.String ruleName
protected java.lang.String secFileName
protected boolean useFile
protected byte[] rules
protected boolean dirtyFlag
protected java.util.Hashtable configFiles
public static final java.lang.String DEBUG
public static final java.lang.String DATAFILESIZE
public static final java.lang.String PUSHTIME
public static final java.lang.String PULLTIME
public static final java.lang.String LOGFILESIZE
public static final java.lang.String RULESFILE
public static final java.lang.String ROUTING
public static final java.lang.String ROUTINGATTRIBUTE
public static final java.lang.String NUMCHANNELS
public static final java.lang.String EXPCHANVALUE
public static final java.lang.String EXPCHANVALUE2
public static final java.lang.String EXPCHANOPERATOR
public static final java.lang.String NUMEXPCHANVALUES
public static final java.lang.String NUMEXPCHANVALUES2
public static final java.lang.String NARBACKUP
public static final java.lang.String BULKIO
public static final java.lang.String NARBACKUPDAYS
public static final java.lang.String BACKUP
public static final java.lang.String ASCODEBASE
public static final java.lang.String SECONDARYCFG
public static final java.lang.String MONITORINPUT
public static final java.lang.String INPUTMONTIME
public static final java.lang.String INPUTMONTIMEUNIT
public static final java.lang.String RECORDSTATS
public static final java.lang.String FILELEVELTRANSACTION
public DCNodeConfigData()
public DCNodeConfigData(java.lang.String inUdcHome, java.lang.String inNodeId) throws java.io.IOException
java.io.IOException
public boolean getDirty()
dirtyFlag
public void setDirty(boolean d)
dirtyFlag
to d
public java.lang.String getConfigDir() throws java.io.IOException
public java.lang.String getBackupDir() throws java.io.IOException
public boolean getUseFile()
public void setUseFile(boolean useFile)
public java.lang.String getRuleFilePathName() throws java.io.IOException
getConfigDir()
+
File.separator
+ "rules.cfg
".java.io.IOException
public java.lang.String getRuleName()
rules.cfg
public void setRuleFileName(java.lang.String name)
rules.cfg
public void setRuleFilePathName(java.lang.String inRuleFilePathName)
inRuleFilePathName
- Absolute path name of the rules file.public byte[] getRules()
public void setRules(byte[] rules)
public byte[] getRuleClass()
public void setRuleClass(byte[] ruleClass)
public java.lang.String getPrefRulesFilePathName() throws java.io.IOException
getConfigDir()
+
File.separator
+ "preferredRules.cfg
".java.io.IOException
public java.lang.String getGenConfigFilePathName() throws java.io.IOException
getConfigDir()
+
File.separator
+ "general.cfg
".java.io.IOException
public void defaultValue(java.lang.String name, java.lang.String value)
name
- name of the configuration parametervalue
- default valuepublic java.lang.String getHomeDir() throws java.io.IOException
udcHome
java.io.IOException
- If udcHome
has not been setpublic void setHomeDir(java.lang.String inUdcHome)
udcHome
. This is used by the NodeManager to set the
directory location of the UDC installation.inUdcHome
- Directory where the UDC program is installedpublic void setNodeId(java.lang.String inNodeId)
inNodeId
- String identifier for the nodepublic java.lang.String getNodeId()
public void setRulesFromFile(java.lang.String inRuleFileName) throws java.io.IOException
inRuleFileName
- name of the rules file to readjava.io.IOException
public void setRulesFromClass(java.io.File ruleClassFile, java.lang.String classString) throws java.lang.ClassNotFoundException
ruleClassFile
- File object representing the NPL class file to be used.classString
- Name of the Java class for ruleClassFile
java.lang.ClassNotFoundException
public void setRulesFromClass(java.lang.String inRuleClassName, java.lang.String asHostName, int urlPort) throws java.lang.ClassNotFoundException
inRuleClassName
- name of the Class to loadjava.lang.ClassNotFoundException
public void load() throws java.io.IOException
udcHome/config/nodeId/general.cfg
java.io.IOException
- If either the general.cfg or ruleName
file
could not be readpublic void load(boolean getPasswords) throws java.io.IOException
java.io.IOException
public void save() throws java.io.IOException
udcHome/config/nodeId/general.cfg
java.io.IOException
- If the config directory does not exist, or either the
general.cfg or rules.cfg file could not be written topublic void deleteItem(java.lang.String itemName)
varTable
public java.util.Enumeration getConfigFileNames()
Enumeration
of the filenamesgetConfigFile(String )
public void setConfigFile(java.lang.String filename, byte[] data)
filename
- The name of the secondary configuration filedata
- A byte array representing the contenst of the filepublic byte[] getConfigFile(java.lang.String filename)
filename
- name of the secondary configuration filebyte[]
representing the contents of the filepublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String getItem(java.lang.String itemName)
varTable
public void setItem(java.lang.String itemName, java.lang.String value)
varTable
. Calls setDirty
if value
is different from the
current value stored at itemName
by calling the
equals()
method.public void setPreferredRules(java.util.Vector prefRules)
[0] display name 1
[1] file name 1
...
When this data is written to and read from disk, it is NOT
placed in varTable
. Rather, the prefix "preferredRules" is
used for each key, and this is stored via a Properties object.public java.util.Vector getPreferredRules()
public java.util.Enumeration getSettingsKeys()
String
keys used for setting values of
this node.Enumeration
of the keys usedsetItem(String, String )
,
getItem(String )
protected byte[] readFile(java.lang.String fileSpec) throws java.io.IOException
fileSpec
; an empty byte array is
returned if the file could not be found.java.io.IOException
protected void writeFile(java.lang.String outputFile, byte[] bytes) throws java.io.IOException
outputFile
- Name of the file to write tobytes
- Contents of the file to be writtenjava.io.IOException
protected void setBaseDefaults()
DEBUG = 1
DATAFILESIZE = 2000
PUSHTIME = 60
PULLTIME = 20
LOGFILESIZE = 10000
BACKUP = false
SECONDARYCFG = "secondary.cfg"
protected void setDefaults()
protected void writeConfigFiles() throws java.io.IOException
getConfigDir()
,
which is generally the node's config
directory.java.io.IOException
protected void readConfigFiles() throws java.io.IOException
configFiles
Hashtable based on the contents of
the "secondary.cfg" file. The "secondary.cfg" file contains a list of all
of the filenames originally stored in configFiles
. By
default, this method assumes that all files were stored in the node's
config
directory (the value returned by
getConfigDir()
. If the "secondary.cfg" file does
not exist (indicating that no secondary files were designated, then the
configFiles
Hashtable is initialized to an empty table.java.io.IOException
public java.lang.Object clone()
clone
in class java.lang.Object