Overview | Package | Class | Tree | Index | Help NetCharts Pro (Applets) 7.0
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

netcharts.util
Class NFLoadParams

java.lang.Object
  |
  +--netcharts.util.NFLoadParams

public class NFLoadParams
implements NFDataBeanObserver
The NFLoadParams class is a utility class used to load parameters from various input sources.


Constructor Summary
NFLoadParams(java.awt.Component comp, java.applet.Applet app)
          Create an object used for loading parameters.
 
Method Summary
void addInitialParamsLoadedObserver(NFInitialParamsLoadedObserver ilo)
          Add an NFInitialParamsLoadedObserver to this NFLoadParams.
void clean()
          Clean the parameter database for reuse.
void dataBeanFailure(java.lang.Object db, java.lang.String message)
          This method is called when a databean has a fatal error.
java.util.Hashtable dataBeanGetExtraParams(java.lang.Object db)
          This method is called by a databean that wishes to know if there are any extra parameters available to it.
void dataBeanInformation(java.lang.Object db, java.lang.String info)
          This method is called when a databean has information about its loading to provide.
void dataBeanLoadData(java.lang.Object db, java.lang.Object info, java.lang.String param, java.util.Vector data)
          This method is called by a databean whenever it needs to load data associated with a given data source.
void dataBeanLoadParams(java.lang.Object db, java.lang.Object info, java.lang.Object params)
          This method is called by a databean whenever it needs to load parameters associated with a given data source.
void dataBeanRequestInitialParamsLoadedNotification(java.lang.Object db)
          This method is called by a databean that wishes to be notified of initial parameters being loaded through the NFInitialParamsLoadedObserver interface.
void dataBeanUserInput(java.lang.Object db, java.lang.Object info, java.lang.String action)
          This method is called by a databean whenever the user has interactively entered input.
java.applet.Applet getApp()
          Get the applet object of this NFLoadParams object.
java.lang.String getCDL()
          Get the CDL for this NFLoadParams object.
java.lang.String getCDL(boolean includeAliases)
          Get the CDL for this NFLoadParams object.
java.lang.String getCDL(java.lang.String param, java.lang.Object data)
          Get the CDL representation for the given parameter with the given data.
java.lang.String getCDLForDef(NFParamDef def, java.lang.Object data)
          Get the CDL representation for the given parameter definition with the given data.
java.lang.String getCDLForSymbol(java.lang.Number data, java.util.Hashtable symtable)
          Get the CDL representation for the given symbol data and symbol table.
NFContext getContext()
          Get the context of this NFLoadParams object.
java.util.Hashtable getDataBeanParameters()
          Get the extra parameters to be given to requesting data beans.
NFParam getParam()
          Get the parameter object of this NFLoadParams object.
NFParse getParse()
          Get the parse object of this NFLoadParams object.
NFToken getToken()
          Get the tokenizer object of this NFLoadParams object.
boolean loadData(java.util.Vector errors)
          This method is called by the NFGraph object prior to drawing a chart if loadDataNeeded() returns true.
boolean loadParams(java.applet.Applet app)
          Parse all parameters defined within the <applet> tag of the invoking HTML file.
boolean loadParams(NFDataBean db)
          This method loads the data associated with the given databean.
boolean loadParams(NFParamServ psv)
          Create a new thread to process parameters coming from the server designated in the given NFParamServ object.
boolean loadParams(java.lang.Object obj)
          This method accepts any of the parameter types accepted by the other single value loadParams() methods.
boolean loadParams(java.lang.String script)
          Loads all parameters defined by the given parameter script, which may contain one or more parameter definitions.
boolean loadParams(java.lang.StringBuffer script)
          Loads all parameters defined by the given parameter script, which may contain one or more parameter definitions.
void loadParams(java.lang.String host, int port, java.lang.String args, java.awt.Component comp)
          Load all parameters defined asychronously by an NFParamServer described by the given parameters.
void loadParams(java.lang.String name, java.util.Vector tokens)
          Load the parameter definition given in the token vector for the given parameter name.
boolean loadParams(java.net.URL url)
          Process the given URL and load all parameters defined by it.
java.util.Properties loadRuntimeProperties(java.util.Properties runtimeProperties)
          Load the runtime properties defined in the applet's paramerters into the given Properties object and return that Properties.
boolean reloadNeeded(java.util.Date timestamp)
          Returns true if any of the data sources associated with this chart have changed since the given timestamp.
boolean reloadNeeded(long timestamp)
          Returns true if any of the data sources associated with this chart have changed since the given timestamp.
void removeInitialParamsLoadedObserver(NFInitialParamsLoadedObserver ilo)
          Remove an NFInitialParamsLoadedObserver from this NFLoadParams.
void run()
          This method is executed as a separate thread for each parameter server connection that has been requested.
void setApp(java.applet.Applet app)
          Specify applet associated with the parameter loading process.
void setContext(NFContext context)
          Set the context of this NFLoadParams object.
void setDataBeanParameters(java.util.Hashtable dbParams)
          Set the extra parameters to be given to requesting data beans.
void setParam(NFParam param)
          Assign the given parameter object to the NFLoadParams object.
void setParse(NFParse parse)
          Assign the given parse object to the NFLoadParams object.
void start()
          This method is called to start separate threads for each parameter server connection currently specified.
void stop()
          This method is called to stop all current parameter server threads.
 

Constructor Detail

NFLoadParams

public NFLoadParams(java.awt.Component comp,
                    java.applet.Applet app)
Create an object used for loading parameters. This automatically creates an associated NFParam, NFToken and NFParse object.
Parameters:
comp - Component used as the parent for any dialog windows needed when loading parameters.
app - Applet will be used to resolve pathnames(if no context is set), and load and process images.
Method Detail

setContext

public void setContext(NFContext context)
Set the context of this NFLoadParams object. The context is used to resolve paths and store authentication information.
Parameters:
context - The context to set.

getContext

public NFContext getContext()
Get the context of this NFLoadParams object.
Returns:
The current context.

setParam

public void setParam(NFParam param)
Assign the given parameter object to the NFLoadParams object.
Parameters:
param - The NFParam to set.

getParam

public NFParam getParam()
Get the parameter object of this NFLoadParams object.
Returns:
The current parameter object.

setParse

public void setParse(NFParse parse)
Assign the given parse object to the NFLoadParams object.
Parameters:
param - The NFParse to set.

getParse

public NFParse getParse()
Get the parse object of this NFLoadParams object.
Returns:
The current parse object.

getToken

public NFToken getToken()
Get the tokenizer object of this NFLoadParams object.
Returns:
The current tokenizer object.

setApp

public void setApp(java.applet.Applet app)
Specify applet associated with the parameter loading process. This is used to determine the parent frame for any dialog windows and to determine the CODEBASE as needed.
Parameters:
app - The Applet to set.

getApp

public java.applet.Applet getApp()
Get the applet object of this NFLoadParams object.
Returns:
The current applet object.

loadParams

public boolean loadParams(java.applet.Applet app)
                  throws java.lang.Exception
Parse all parameters defined within the <applet> tag of the invoking HTML file. If a parameter is defined in the <applet> but it is not defined within this parser, it is ignored. If any of the following special parameters are defined in the <applet> tag, they will be processed AFTER all of the named parameters defined in the HTML.
name=NFParamURL     value="URL"
name=NFParamScript  value="script of parameter definitions"
name=NFParamServer  value="hostname:port/arguments"
name=NFFontEncoding value="encoding type"
Parameters:
app - The applet from which to load parameters.
Returns:
true if the loading was successful, false if the parameters could not be retreived from the applet.
Throws:
java.lang.Exception - If there is an error in loading.

loadParams

public boolean loadParams(java.lang.String script)
                  throws java.lang.Exception
Loads all parameters defined by the given parameter script, which may contain one or more parameter definitions.
Parameters:
script - The cdl script from which to load parameters.
Returns:
true if loading was successful.
Throws:
java.lang.Exception - If there is an error in loading.

loadParams

public boolean loadParams(java.lang.StringBuffer script)
                  throws java.lang.Exception
Loads all parameters defined by the given parameter script, which may contain one or more parameter definitions.
Parameters:
script - The cdl script from which to load parameters.
Returns:
true if loading was successful.
Throws:
java.lang.Exception - If there is an error in loading.

loadParams

public boolean loadParams(java.net.URL url)
                  throws java.lang.Exception
Process the given URL and load all parameters defined by it.
Parameters:
url - The url from which to load parameters.
Returns:
true if loading was successful.
Throws:
java.lang.Exception - If there is an error in loading.

loadParams

public void loadParams(java.lang.String host,
                       int port,
                       java.lang.String args,
                       java.awt.Component comp)
               throws java.lang.Exception
Load all parameters defined asychronously by an NFParamServer described by the given parameters. The given <args> string will be sent to the NFParamServer when initially connected. From that point, the NFParamServer can generate any number of parameter expressions, which will be parsed by a background thread. Whenever an "Update" command is sent, any observers of the NFParam object will be notified, which generally means that the display will be updated, using the new parameter definitions received since the last "Update". If an error occurs while processing parameter definitions from the parameter server, then they will be displayed in separate dialog windows associated with the Frame containing the given component <comp>. If comp is null or the dialog cannot be properly displayed for any reason, then the error will be printed on the Java Console. (Similar processing occurs for any STATUS or ERROR commands issued by the parameter server.) Regardless of how an error message is displayed, the input will be flushed to the next semi-colon and the processing of parameter definitions from the server will continue from that point. NOTE: Some browsers prevent a connection to an NFParamServer, on any machine, if the HTML document that invokes the applet is accessed as a local disk file, as opposed to an HTTP server response. NOTE: Parameters will only be read from the server once the invoking applet has called the start() method for this object. If the start() method was called prior to calling this method, then the connection will be made immediately.
Parameters:
host - The parameter server hostname.
port - The parameter server port.
args - The parameter server arguments.
comp - The component from whose Frame dialogs will be created.
Returns:
true if loading was successful.
Throws:
java.lang.Exception - If there is an error in loading.

loadParams

public boolean loadParams(NFParamServ psv)
                  throws java.lang.Exception
Create a new thread to process parameters coming from the server designated in the given NFParamServ object.
Parameters:
psv - The Parameter server.
Returns:
true if loading was successful.
Throws:
java.lang.Exception - If the server is null.

loadParams

public boolean loadParams(NFDataBean db)
                  throws java.lang.Exception
This method loads the data associated with the given databean. This method may be called recursively if during the loading process the databean references another bean. Therefore, this method guards against circular references using a simple depth counter. Furthermore, this method saves the current input stream during the databean load process in order to continue processing when the databean load is done.
Parameters:
db - The DataBean to load.
Throws:
java.lang.Exception - If there is an error in loading.

loadParams

public boolean loadParams(java.lang.Object obj)
                  throws java.lang.Exception
This method accepts any of the parameter types accepted by the other single value loadParams() methods.
Parameters:
obj - The Object to load.
Throws:
java.lang.Exception - If there is an error in loading.

loadParams

public void loadParams(java.lang.String name,
                       java.util.Vector tokens)
               throws java.lang.Exception
Load the parameter definition given in the token vector for the given parameter name.
Parameters:
name - The parameter name.
tokens - The parameter value separated into tokens.

start

public void start()
This method is called to start separate threads for each parameter server connection currently specified.

stop

public void stop()
This method is called to stop all current parameter server threads. The threads may be restarted by calling the start() method.

run

public void run()
This method is executed as a separate thread for each parameter server connection that has been requested. It continuously parses parameters and updates the display, until the remote server terminates the connection or the stop() method is called.
Specified by:
run() in interface java.lang.Runnable

reloadNeeded

public boolean reloadNeeded(long timestamp)
Returns true if any of the data sources associated with this chart have changed since the given timestamp. If so, the entire CDL script should be reloaded (which is best done using the NFChartFile object that was used to load the chart in the first place.)
Parameters:
timestamp - The time on which to base the comparaion.
Returns:
true if reload is need, false otherwise.

reloadNeeded

public boolean reloadNeeded(java.util.Date timestamp)
Returns true if any of the data sources associated with this chart have changed since the given timestamp. If so, the entire CDL script should be reloaded (which is best done using the NFChartFile object that was used to load the chart in the first place.)
Parameters:
timestamp - The time on which to base the comparaion.
Returns:
true if reload is need, false otherwise.

loadData

public boolean loadData(java.util.Vector errors)
                throws java.lang.Exception
This method is called by the NFGraph object prior to drawing a chart if loadDataNeeded() returns true. This allows all data bean objects to load the data referenced by them. Such delayed processing is needed, because the data beans may need to get user input, which can only be done after all of the peer classes have been created and the screen is ready for popup windows. This method simply processes the dbList vector, allowing each data bean found to load data. If a data bean requires user input, this method will terminate immediately after the data bean displays it's user interface windows, with a return value of true. When the user has finished entering the necessary information, the databean will be notified (via it's own mechanism) and will load the data into this object, via the dataBeanLoadData() or dataBeanLoadParams() observer methods defined in this class. Then, the databean will notify this object via the dataBeanUserInput() callback method when all data has been loaded, at which time this object will notify all current observers via their update() methods, passing a String argument of "UserInput". In the case of NFGraph, when it sees "UserInput", it automatically attempts to refresh the display, which may call this method again to process the remaining data beans on the list. If all databeans are processed and no user input is needed, then this method returns false and the chart is ready to be loaded and displayed. If the errors vector is non-null, then any exceptions generated by the databeans will be added to that vector. This allows the caller to handle the exceptions themselves. Otherwise, when the first exception occurs, this method will immediately terminate and throw the exception to the caller.
Parameters:
errors - Errors are placed in this Vector if non-null.
Returns:
true if loading was successful.
Throws:
java.lang.Exception - If there is an error in loading.

getCDLForSymbol

public java.lang.String getCDLForSymbol(java.lang.Number data,
                              java.util.Hashtable symtable)
Get the CDL representation for the given symbol data and symbol table.
Parameters:
data - The symbol data.
symtable - The symbol table.
Returns:
The CDL.

getCDLForDef

public java.lang.String getCDLForDef(NFParamDef def,
                           java.lang.Object data)
Get the CDL representation for the given parameter definition with the given data.
Parameters:
def - The parameter definition.
data - The parameter value.
Returns:
The CDL.

getCDL

public java.lang.String getCDL(java.lang.String param,
                     java.lang.Object data)
Get the CDL representation for the given parameter with the given data.
Parameters:
param - The parameter name.
data - The parameter value.
Returns:
The CDL.

getCDL

public java.lang.String getCDL()
Get the CDL for this NFLoadParams object. Only primary keys and ChartWidth/ChartHeight are checked for load status and returned with their values. All DataBean references are removed from the CDL as well, but the parameters loaded by the DataBeans is still intact. It is best to insure that a set of parameters from all data sources has been loaded before calling this method. This can be accomplished by becoming a NFInitialParamsLoadedObserver of the NFLoadParams.
Returns:
The CDL.

getCDL

public java.lang.String getCDL(boolean includeAliases)
Get the CDL for this NFLoadParams object. Only primary keys and ChartWidth/ChartHeight are checked for load status and returned with their values. All DataBean references are removed from the CDL as well, but the parameters loaded by the DataBeans is still intact. It is best to insure that a set of parameters from all data sources has been loaded before calling this method. This can be accomplished by becoming a NFInitialParamsLoadedObserver of the NFLoadParams.
Parameters:
includeAliases - Whether to include both the normal parameters and their aliases, or just the normal parameters.
Returns:
The CDL.

dataBeanLoadData

public void dataBeanLoadData(java.lang.Object db,
                             java.lang.Object info,
                             java.lang.String param,
                             java.util.Vector data)
                     throws java.lang.Exception
This method is called by a databean whenever it needs to load data associated with a given data source. It simply calls NFParse.dataBeanLoadData() to perform the necessary processing.
Specified by:
dataBeanLoadData in interface NFDataBeanObserver
Parameters:
db - The DataBean.
info - An Object argument.
param - The parameter this data is associated with.
data - The data.
Throws:
java.lang.Exception - If there is an error in loading.

dataBeanLoadParams

public void dataBeanLoadParams(java.lang.Object db,
                               java.lang.Object info,
                               java.lang.Object params)
                       throws java.lang.Exception
This method is called by a databean whenever it needs to load parameters associated with a given data source. The PARAMS parameter should be any single type accepted by the loadParams() method.
Specified by:
dataBeanLoadParams in interface NFDataBeanObserver
Parameters:
db - The DataBean.
info - An Object argument.
params - The parameters.
Throws:
java.lang.Exception - If there is an error in loading.

dataBeanUserInput

public void dataBeanUserInput(java.lang.Object db,
                              java.lang.Object info,
                              java.lang.String action)
                      throws java.lang.Exception
This method is called by a databean whenever the user has interactively entered input. This allows the current object to continue any processing that was previously suspended awaiting the input. This method simply calls NFParam.update() with the "UserInput" status to perform the necessary processing.
Specified by:
dataBeanUserInput in interface NFDataBeanObserver
Parameters:
db - The DataBean.
info - An Object argument.
action - The action.
Throws:
java.lang.Exception - If there is an error in loading.

dataBeanFailure

public void dataBeanFailure(java.lang.Object db,
                            java.lang.String message)
This method is called when a databean has a fatal error.
Specified by:
dataBeanFailure in interface NFDataBeanObserver
Parameters:
db - The DataBean.
message - The error message.

dataBeanInformation

public void dataBeanInformation(java.lang.Object db,
                                java.lang.String info)
This method is called when a databean has information about its loading to provide.
Specified by:
dataBeanInformation in interface NFDataBeanObserver
Parameters:
db - The DataBean.
info - The information.

dataBeanRequestInitialParamsLoadedNotification

public void dataBeanRequestInitialParamsLoadedNotification(java.lang.Object db)
This method is called by a databean that wishes to be notified of initial parameters being loaded through the NFInitialParamsLoadedObserver interface.
Specified by:
dataBeanRequestInitialParamsLoadedNotification in interface NFDataBeanObserver
Parameters:
db - The DataBean.

dataBeanGetExtraParams

public java.util.Hashtable dataBeanGetExtraParams(java.lang.Object db)
This method is called by a databean that wishes to know if there are any extra parameters available to it.
Specified by:
dataBeanGetExtraParams in interface NFDataBeanObserver
Parameters:
db - The DataBean.

setDataBeanParameters

public void setDataBeanParameters(java.util.Hashtable dbParams)
Set the extra parameters to be given to requesting data beans.

getDataBeanParameters

public java.util.Hashtable getDataBeanParameters()
Get the extra parameters to be given to requesting data beans.

addInitialParamsLoadedObserver

public void addInitialParamsLoadedObserver(NFInitialParamsLoadedObserver ilo)
Add an NFInitialParamsLoadedObserver to this NFLoadParams.
Parameters:
ilo - The NFInitialParamsLoadedObserver.

removeInitialParamsLoadedObserver

public void removeInitialParamsLoadedObserver(NFInitialParamsLoadedObserver ilo)
Remove an NFInitialParamsLoadedObserver from this NFLoadParams.
Parameters:
ilo - The NFInitialParamsLoadedObserver.

clean

public void clean()
Clean the parameter database for reuse.

loadRuntimeProperties

public java.util.Properties loadRuntimeProperties(java.util.Properties runtimeProperties)
Load the runtime properties defined in the applet's paramerters into the given Properties object and return that Properties.
Parameters:
runtimeProperties - The Properties to load the runtime properties into; if it is null a new Properties is created.

Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD


Visual Mining, Inc.
2099 Gaither Grove Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2010
All Rights Reserved.

NetCharts ProTM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Jun 29, 2010