All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ibs.ebf.server.EbfAgent

java.lang.Object
   |
   +----ibs.ebf.server.EbfAgent

public abstract class EbfAgent
extends Object
Class EbfAgent is an abstract class. It provides a gateway to EbfServer resources for any EbfServer application class that extends this class.

Each EbfServer application (instance) must have ONE AND ONLY ONE application class. This application class must extend EbfAgent as it's super class.

Example:
public class AppManager extends EbfAgent implements IApp {
.......
.......
}

Remember: In EbfServer, terms 'Instance' and 'Application' are used interchangeably.


Variable Index

 o Console
Console provides a way of printing debug/trace messages to the ebfServer console from within sub-classes of class EbfAgent.
 o Response
Response provides a gateway for sub-classes to print messages directly to the client - without using template engine.

Constructor Index

 o EbfAgent()

Method Index

 o addUserAcl(String, String, String)
Add user authentication to allow user access to a specific business unit.
 o authenticateUser()
Authenticate user.
 o countErrors()
Count number of errors in the Session Error Stack.
 o countSysErrors()
Count number of errors in the System Error Stack.
 o createNewTable(String)
Creates a new IbsTable object and assigns it given unique table name.
 o dataFileToTable(String, String, String)
This method reads given datafile (in the InstanceRoot/data_filepath directory) and converts it to an IbsTable object using the table definition in the given parameter file (param_filename in the InstanceRoot/tables/ directory).
 o dataFileToTable(String, String, String, String)
This method reads given datafile and converts it to an IbsTable object using the table definition in the given parameter file (file path and file name).
 o evaluateOutput(String)
Process given template, format it using session resources, and deliver formatted contents to the client.
 o evaluateOutput(String, File)
Process given template, format it using session resources, and write formatted contents the given File.
 o evaluateOutput(String, String, File)
Process given template, format it using session resources, and write formatted contents the given File.
 o execute()
Sub classes of EbfAgent class must override this method.
 o executeExpression(String)
Execute another Java expression from within current java expression.
 o getApplicationRoot()
Returns path to the root for currently running Ebf instance/application.
 o getBusinessUnitId()
Returns value of the field 'Business Unit Id' from the submitted form.
 o getBusinessUnitRoot(String)
Returns relative path to the specified business unit's directory in the given application/instance.
 o getColumnCount(ResultSet)
Count number of columns in the given ResultSet object.
 o getFormKeysValues()
Returns an IKeys object containing all Header, Data, and Cookie keys ffrom the submitted request.
 o getFormValue(String)
get form field value for given paramname.
 o getFormValue(String, String)
get form field value for given paramname.
 o getInstanceRoot()
Returns path to the root for currently running Ebf instance/application.
 o getIpAddr()
Returns IpAddress of the remote host (Value of REMOTE_HOST in HTTP Header)
 o getLoginAttempts()
Returns the number of times user made an unsuccessful attempts to login.
 o getLoginId()
Returns login id of currently logged in user.
 o getLoginPassword()
Returns login password of currently logged in user.
 o getLogWriter()
Returns a PrintWriter object for the session log file.
 o getPassword()
Returns value of the submitted field 'Password'.
 o getQuery(String)
Loads given query file and returns an EbfQuery  o getSessionId()
Returns Session Id for current session.
 o getSessionProperties()
Obtain session properties object.
 o getSessionRecord(String)
Get IbsTable object from session properties

Note: SessionRecords ARE available for the life of the session.

 o getSessionResultSet(String)
get EbfResultSet object from session properties.
 o getSessionTable(String)
Get IbsTable object from session properties

Note: SessionTables ARE available for the life of the session.

 o getSessionValue(String)
get value of the session variable paramname.
 o getSessionValue(String, String)
get value of the session variable paramname.
 o getSocket(String)
Get an ISocket object for socket_id.
 o getSysConstantValue(String)
get value of the unit constant constantname.
 o getSysConstantValue(String, String)
get value of the system constant constantname.
 o getSysRecord(String)
Get IbsRecord object from system properties.
 o getSysTable(String)
Get IbsTable object from system properties.
 o getUnitConstantValue(String)
get value of the unit constant constantname.
 o getUnitConstantValue(String, String)
get value of the unit constant constantname.
 o hasErrors()
Check if current session has any errors in error stack.
 o isAclFeatureOn()
 o isFormVariable(String)
Checks if given key exists in the form submitted by the user.
 o isSessionVariable(String)
Checks if given key exists in the session/custom values container.
 o isUserAuthenticated()
 o loadQuery(String)
Loads given query file and returns an IQuery object that contains formatted query string, Query name and comments.
 o log(Object)
Write an object 'o' to the session log.
 o logError(Object)
Write an object 'o' to the server error log.
 o logError(String)
Log an error message to the server error log.
 o logInfo(String)
Log information message to the session log.
 o newError(String)
Add an error message to the session errors stack.
 o newTransaction(boolean)
Creates a new EbfTransaction object and returns it.
 o printContents(IbsTable)
Print contents of the IbsTable object to the console - AS IS, WITHOUT ANY FORMATTING

WARNING: This functionality is provided for testing/debugging purpose only.

 o printContents(IbsTable, boolean)
Print contents of the IbsTable object to the console or to the remote client - AS IS, WITHOUT ANY FORMATTING

WARNING: This functionality is provided for testing/debugging purpose only.

 o printContents(ResultSet)
Print contents of the result set to the console - AS IS, WITHOUT ANY FORMATTING
Note: A result set can be used only once - if you used it here, it cannot be used again in your templates.
 o printContents(ResultSet, boolean)
Print contents of the result set to the console or to the remote client - AS IS, WITHOUT ANY FORMATTING
Note: A result set can be used only once - if you used it here, its contents will not be accessible to the template engine when you make call to method evaluateOutput

WARNING: This functionality is provided for testing/debugging purpose only.

 o printResponse(String)
Print a single line response to the client.
 o remoteExec(String, int, int, String, String, String)
Obtains and returns an IConnector object for given parameters.
 o removeSessionTable(String)
This method allows app developer to remove previously set session table from the session properties.
 o removeSessionValue(String)
This method allows app developer to remove previously set session key from the session properties.
 o removeUserAcl(String, String)
Remove user ACL record to prevent user access to a specific business unit.
 o resultSetToTable(String, ResultSet)
This method reads given ResultSet and converts it to an IbsTable object.
 o ResultSetToTable(String, ResultSet)
This method reads given ResultSet and converts it to an IbsTable object. Deprecated.
 o saveSession()
Save current session to the file system.
 o setAuthentication(boolean)
Set authentication to true or false.
 o setLoginAttempt()
Your process simply has to call this method to indicate that there was a failed login attempt by current session.
 o setSessionRecord(String, IbsRecord)
Set given IbsRecord object in session properties for later access during template formatting.
 o setSessionResultSet(String, ResultSet)
Set given EbfResultSet object in session properties for later access during template formatting.
 o setSessionTable(IbsTable)
Set given IbsTable object in session properties for later access during template formatting.
 o setSessionTable(String, IbsTable)
Set given IbsTable object in session properties for later access during template formatting.
 o setSessionValue(String, String)
Set given param and value in session properties for later access during template formatting.
 o setSysRecord(String, IbsRecord)
Set given IbsRecord object in system properties for later access during template formatting.
 o setSysTable(String, IbsTable)
Set given IbsTable object in system properties for later access during template formatting.
 o setTraceLevel(int)
Set trace level to given level.
 o streamToTable(String, BufferedReader)
This method reads given BufferedReader and converts it to an IbsTable object using the table definition in the given parameter file (parameter file name in the InstanceRoot/tables/ directory).
 o streamToTable(String, String, BufferedReader)
This method reads given BufferedReader and converts it to an IbsTable object using the table definition in the given parameter file (file path and file name).
 o toPath(String)
Converts given path to the InstanceRoot+Path and validates if path is a directory.
 o unitDataFileToTable(String, String, String, String)
Use this method if you wish to load a datafile from given unit's datafiles directory.

Variables

 o Console
 protected static final PrintWriter Console
Console provides a way of printing debug/trace messages to the ebfServer console from within sub-classes of class EbfAgent. Use it as ... super.Console.println("something");

 o Response
 protected EbfResponse Response
Response provides a gateway for sub-classes to print messages directly to the client - without using template engine. Use it as .... super.Response.println("something");

Constructors

 o EbfAgent
 public EbfAgent()

Methods

 o execute
 public abstract int execute()
Sub classes of EbfAgent class must override this method.

 o getInstanceRoot
 protected String getInstanceRoot()
Returns path to the root for currently running Ebf instance/application. Results from this method call is same as getApplicationRoot().

Remember: In EbfServer, names Instance and Application are used interchangeably.

Returns:
Path to the root for currently active Ebf instance/application.
 o getApplicationRoot
 protected String getApplicationRoot()
Returns path to the root for currently running Ebf instance/application. Results from this method call is same as getInstanceRoot().

Remember: In EbfServer, names Instance and Application are used interchangeably.

Returns:
Path to the root for currently active Ebf instance/application.
 o evaluateOutput
 protected int evaluateOutput(String template_name) throws Exception
Process given template, format it using session resources, and deliver formatted contents to the client.

Note:
* This method allows you to evaluate a template and write formatted template contents to the client. * Template filepath is standard template filepath for your application - i.e. InstanceRoot/templates/ for compiled template files
and InstanceRoot/templates/src/ for source template files.

Parameters:
template_name - Name of the template to be used for formatting output.
Returns:
An integer indicating status of the evaluate template process. < 0 means evaluation was not successful.
Throws: Throws
exception when unknown error occurs.
 o evaluateOutput
 protected int evaluateOutput(String template_name,
                              File output_file) throws Exception
Process given template, format it using session resources, and write formatted contents the given File.

Note:
* This method allows you to evaluate a template and write formatted template contents to the given File.
* Template filepath is standard template filepath for your application - i.e. InstanceRoot/templates/ for compiled template files
and InstanceRoot/templates/src/ for source template files.

Parameters:
template_name - Name of the template to be used for formatting output.
Returns:
An integer indicating status of the evaluate template process. < 0 means evaluation was not successful.
Throws: Throws
exception when system is unable to write prepared template to the given output file OR an unknown error occurs.
 o evaluateOutput
 protected int evaluateOutput(String template_filepath,
                              String template_name,
                              File output_file) throws Exception
Process given template, format it using session resources, and write formatted contents the given File.

Note:
* This method allows you to evaluate a template and write formatted template contents to the given File.
* Template filepath specified in this method call is assumed to be path where template processor engine can find a compiled template as template_name.frm.
* If compiled template is not found in the given template_filepath, system attempts to load template source file template_name from the template_filepath/src/ directory.

Parameters:
template_filepath - Path where the template (.frm file) can be loaded from.
If template_filepath is not supplied (""), system uses default template filepath for the application.
template_name - Name of the template to be used for formatting output.
Returns:
An integer indicating status of the evaluate template process. < 0 means evaluation was not successful.
Throws: Throws
exception when system is unable to write prepared template to the given output file OR an unknown error occurs.
 o getSessionId
 protected int getSessionId()
Returns Session Id for current session.

Returns:
An integer session id.
 o executeExpression
 protected final int executeExpression(String java_expression)
Execute another Java expression from within current java expression. This allows expression chaining and hands over more power to the developer. However, developer should use this functionality sparingly as excessive use of this may cause unforseen problems in the EbfServer.

One of the most common problems you can expect to see is ... When user hits 'Reload' or 'Refresh' button on the browser, browser resubmits the previous request - the request that resulted in a call to this executeExpression. This will produce unexpected results.

Here is an example:
- User submits a form with a add record request
- This request causes com.yourpackage.AddRecord expression to be executed
- In this expression, you called 'executeExpression(com.yourpackage.showUpdatedList)' expression
- Now user has a updated list in the browser client
- If user hits 'Reload' now, browser will resubmit previous request that resulted in displaying of the updated list
- That means, your com.yourpackage.AddRecord will be called again and it will attempt to add a new record again. In this case, you can expect to see Duplicate Key error from your database.

Conclusion: There is nothing that EbfServer can do about this. It's browser's behavior that's causing this. We just would like to notify you about possibility of you encountering same problem that confused us for-a-while. Good luck!

Parameters:
java_expression - A name of the java expression to be executed. Expression name must be prefixed with the package name(s). (i.e. com.packagename.expressionname )
 o getBusinessUnitRoot
 protected final String getBusinessUnitRoot(String unit_id)
Returns relative path to the specified business unit's directory in the given application/instance.

Returns:
A string containing relative path to the given Business Unit Id.
 o getLogWriter
 protected final PrintWriter getLogWriter()
Returns a PrintWriter object for the session log file. Use this PrintWriter object carefully. It is provided so that if you need to use external Java classes in your Java Expressions, you can still have them write log messages to your session log file.

Returns:
PrintWriter object for the session log
 o logInfo
 protected final void logInfo(String msg)
Log information message to the session log.

Parameters:
msg - A message string.
 o log
 protected final void log(Object o)
Write an object 'o' to the session log.

Parameters:
o - An Object
 o logError
 protected final void logError(String msg)
Log an error message to the server error log.

Parameters:
msg - A message string.
 o logError
 protected final void logError(Object o)
Write an object 'o' to the server error log.

Parameters:
o - An Object
 o hasErrors
 protected final boolean hasErrors()
Check if current session has any errors in error stack.

Returns:
'true' if error found. Otherwise 'false'
 o newError
 protected final void newError(String error_msg)
Add an error message to the session errors stack.

Parameters:
error_msg - An error message string.
 o countErrors
 protected final int countErrors()
Count number of errors in the Session Error Stack.

Returns:
An integer number representing count of errors in session error stack.
 o countSysErrors
 protected final int countSysErrors()
Count number of errors in the System Error Stack.

Returns:
An integer number representing count of errors in system error stack.
 o setTraceLevel
 protected final void setTraceLevel(int level)
Set trace level to given level.

Parameters:
level - An integer number between 0 and 10
 o getSessionProperties
 protected final ISessionProperties getSessionProperties()
Obtain session properties object.

Returns:
ISessionProperties object
 o isFormVariable
 protected boolean isFormVariable(String key)
Checks if given key exists in the form submitted by the user. Returns 'true' if key was found, otherwise returns 'false'.

Parameters:
key - A key submitted by the user.
Returns:
A boolean value
 o isSessionVariable
 protected boolean isSessionVariable(String key)
Checks if given key exists in the session/custom values container. Returns 'true' if key was found, otherwise returns 'false'.

Parameters:
key - A key in the session/custom values container.
Returns:
A boolean value
 o getLoginId
 protected final String getLoginId()
Returns login id of currently logged in user. (Id obtained from the user session object)

Returns:
User login id for current session. Empty string if login id not found.
 o getLoginPassword
 protected final String getLoginPassword()
Returns login password of currently logged in user. (obtained from the user session object)

Returns:
User login password for current session. Empty string if password not found.
 o getLoginAttempts
 protected final int getLoginAttempts()
Returns the number of times user made an unsuccessful attempts to login.

Returns:
An integer number indicating number of attempts.
 o setLoginAttempt
 protected void setLoginAttempt()
Your process simply has to call this method to indicate that there was a failed login attempt by current session. Login Attempt counter is incremented

 o getIpAddr
 protected String getIpAddr()
Returns IpAddress of the remote host (Value of REMOTE_HOST in HTTP Header)

Returns:
A string containing Ip Address of the remote host.
 o getPassword
 protected String getPassword()
Returns value of the submitted field 'Password'. If not found, returns empty string.

Returns:
A string containing submitted 'Password'.
 o getFormKeysValues
 protected IKeys getFormKeysValues()
Returns an IKeys object containing all Header, Data, and Cookie keys ffrom the submitted request.

Returns:
An IKeys object
See Also:
IKeys
 o getBusinessUnitId
 protected String getBusinessUnitId()
Returns value of the field 'Business Unit Id' from the submitted form.
* If business unit id not found in the submitted form, ....
   * It searches session variables for the value of previously submitted business unit id.    * If still not found, it returns the default business unit id as defined in the application (instance) controls.

Returns:
A string containing Business Unit Id.
 o getFormValue
 protected String getFormValue(String paramname)
get form field value for given paramname. Returns empty string if given form field not found in the submitted form.

Parameters:
paramname - Name of the parameter
Returns:
A string value
 o getFormValue
 protected String getFormValue(String paramname,
                               String default_value)
get form field value for given paramname. If not found, return default value.

Parameters:
paramname - Name of the parameter
default_value - Default value to be returned if form field value not found.
Returns:
A string value
 o getSessionValue
 protected String getSessionValue(String paramname)
get value of the session variable paramname. Returns empty string if given paramname not found in the session variables list.

Parameters:
paramname - Name of the parameter
Returns:
A string value
 o getSessionValue
 protected String getSessionValue(String paramname,
                                  String default_value)
get value of the session variable paramname. Return default_value if given paramname not found in the session variables list.

Parameters:
paramname - Name of the parameter
default_value - Default value to be returned if given paramname not found
Returns:
A string value
 o getUnitConstantValue
 protected String getUnitConstantValue(String constantname)
get value of the unit constant constantname. Returns empty string if given constantname not found in unit properties.

Parameters:
constantname - Name of the unit constant
Returns:
A string value
 o getUnitConstantValue
 protected String getUnitConstantValue(String constantname,
                                       String default_value)
get value of the unit constant constantname. Returns empty string if given constantname not found in unit properties.

Parameters:
constantname - Name of the unit constant
default_value - Default value to be returned if given constant not found.
Returns:
A string value
 o getSysConstantValue
 protected String getSysConstantValue(String constantname)
get value of the unit constant constantname. Returns empty string if given constantname not found in unit properties.

Parameters:
constantname - Name of the unit constant
Returns:
A string value
 o getSysConstantValue
 protected String getSysConstantValue(String constantname,
                                      String default_value)
get value of the system constant constantname. Returns default_value if given constantname not found in unit properties.

Parameters:
constantname - Name of the unit constant
default_value - Default value to be returned if given constant not found.
Returns:
A string value
 o getSocket
 protected ISocket getSocket(String socket_id)
Get an ISocket object for socket_id. Call to this method obtains a socket connection from the socket connection pool and returns it as ISocket object. If connection could not be obtained (Socket id invalid OR all sockets currently in use) it returns null. Do not forget to check for if (obj == null) in your code otherwise, you may run into NullPointerException at runtime.

Parameters:
socket_id - A valid connection id (must be defined in connections list)
Returns:
ISocekt A socket connection object of type ISocket.
See Also:
ISocket
 o getQuery
 protected final EbfQuery getQuery(String query_file) throws FileNotFoundException, IOException
Loads given query file and returns an EbfQuery
Returns:
EbfQuery object with given query file loaded.
Throws: FileNotFoundException
If given query file was not found in 'queries' directory
Throws: IOException
If IO error was encountered while loading given query file.
 o loadQuery
 protected final IQuery loadQuery(String query_file) throws InvalidArgumentException, FileNotFoundException, IOException
Loads given query file and returns an IQuery object that contains formatted query string, Query name and comments.

Returns:
An object of type IQuery which can be used to get Query name, query string etc.
Throws: InvalidArgumentException
If given query contained params and needed param values.
Throws: FileNotFoundException
If given query file was not found in 'queries' directory
Throws: IOException
If IO error was encountered while loading given query file.
 o remoteExec
 protected final IConnector remoteExec(String host,
                                       int port,
                                       int timeout_secs,
                                       String exec_cmd,
                                       String params,
                                       String env_vars) throws Exception
Obtains and returns an IConnector object for given parameters. Calling method should capture IConnector object and than call ....
* setIdString(..) method to set an identification string
* processRequest() method to send the request
* And getNextLineOfResult() method until an exception is thrown.

Returns:
An IConnector object for further processing.
See Also:
IConnector
 o createNewTable
 protected final IbsTable createNewTable(String unique_table_name)
Creates a new IbsTable object and assigns it given unique table name. Upon obtaining an IbsTable object, calling method should set column names for the table and specify unique key column for the table.

Parameters:
unique_table_name - A non-duplicate table name for this IbsTable object.
Returns:
An IbsTable object
See Also:
IbsTable
 o unitDataFileToTable
 protected final IbsTable unitDataFileToTable(String unit_id,
                                              String data_filename,
                                              String param_filepath,
                                              String param_filename) throws Exception
Use this method if you wish to load a datafile from given unit's datafiles directory. Method dataFileToTable can also be used instead of this if necessary. However, call to this method saves you from having to build the datafile path for a unit id.

This method reads given datafile from the unitid/datafiles directory and converts it to an IbsTable object using the table definition in the given parameter file (file path and file name).

Parameter file defines the format of the table and also the format for the incoming data (i.e. field seperator, column_names etc.).

You must specify the name and the path of the parameter file and make sure that for each field in the data record loaded from the 'datafile' is mapped to corresponding column in the column_list in the parameter file.

NOTE: parameter filepath specified must be relative to instance root for the EbfServer application. To ensure platform independance, calling process MUST use File.seperator to seperate directories and files.

Parameters:
unit_id - Unit ID. Data file will be loaded from the given unit id's datafiles directory..
data_filename - Name of the data file to be loaded.
param_filepath - File path for the parameters file.
param_filename - Name of the IbsTable Parameter file name.
Throws: Exception
If any error encountered during this process.
See Also:
DataFileToTable, IbsTable
 o dataFileToTable
 protected final IbsTable dataFileToTable(String data_filepath,
                                          String data_filename,
                                          String param_filename) throws Exception
This method reads given datafile (in the InstanceRoot/data_filepath directory) and converts it to an IbsTable object using the table definition in the given parameter file (param_filename in the InstanceRoot/tables/ directory).

Parameter file defines the format of the table and also the format for the incoming data (i.e. field seperator, column_names etc.).

You must specify the name of the parameter file (and it must be located in the InstanceRoot/tables/ directory) and make sure that for each field in the data record loaded from the 'datafile' is mapped to corresponding column in the column_list in the parameter file.

Parameters:
data_filepath - File path for the data file to be loaded.
data_filename - Name of the data file to be loaded.
param_filename - Name of the IbsTable Parameter file name.
Throws: Exception
If any error encountered during this process.
See Also:
DataFileToTable, IbsTable
 o streamToTable
 protected final IbsTable streamToTable(String param_filename,
                                        BufferedReader br) throws Exception
This method reads given BufferedReader and converts it to an IbsTable object using the table definition in the given parameter file (parameter file name in the InstanceRoot/tables/ directory).

Parameter file defines the format of the table and also the format for the incoming data (i.e. field seperator, column_names etc.).

You must specify the name of the parameter file (and it must be located in the InstanceRoot/tables/ directory) and make sure that for each field in the data received from the 'stream' is mapped to corresponding column in the column_list in the parameter file.

Parameters:
param_filename - Name of the IbsTable Parameter file name.
br - A BufferedReader from where system is expected to read data and stream it to the table.
Throws: Exception
If any error encountered during this process.
See Also:
StreamToTable, IbsTable
 o dataFileToTable
 protected final IbsTable dataFileToTable(String data_filepath,
                                          String data_filename,
                                          String param_filepath,
                                          String param_filename) throws Exception
This method reads given datafile and converts it to an IbsTable object using the table definition in the given parameter file (file path and file name).

Parameter file defines the format of the table and also the format for the incoming data (i.e. field seperator, column_names etc.).

You must specify the name and the path of the parameter file and make sure that for each field in the data record loaded from the 'datafile' is mapped to corresponding column in the column_list in the parameter file.

NOTE: parameter filepath specified must be relative to instance root for the EbfServer application. To ensure platform independance, calling process MUST use File.seperator to seperate directories and files.

Parameters:
data_filepath - File path for the data file to be loaded.
data_filename - Name of the data file to be loaded.
param_filepath - File path for the parameters file.
param_filename - Name of the IbsTable Parameter file name.
Throws: Exception
If any error encountered during this process.
See Also:
DataFileToTable, IbsTable
 o streamToTable
 protected final IbsTable streamToTable(String param_filepath,
                                        String param_filename,
                                        BufferedReader br) throws Exception
This method reads given BufferedReader and converts it to an IbsTable object using the table definition in the given parameter file (file path and file name).

Parameter file defines the format of the table and also the format for the incoming data (i.e. field seperator, column_names etc.).

You must specify the name and the path of the parameter file and make sure that for each field in the data received on from the 'stream' is mapped to corresponding column in the column_list in the parameter file.

NOTE: parameter filepath specified must be relative to instance root for the EbfServer application. To ensure platform independance, calling process MUST use File.seperator to seperate directories and files.

Parameters:
param_filepath - File path for the parameters file.
param_filename - Name of the IbsTable Parameter file name.
br - A BufferedReader from where system is expected to read data and stream it to the table.
Throws: Exception
If any error encountered during this process.
See Also:
StreamToTable, IbsTable
 o ResultSetToTable
 protected final IbsTable ResultSetToTable(String table_name,
                                           ResultSet rs) throws SQLException
Note: ResultSetToTable() is deprecated.

This method reads given ResultSet and converts it to an IbsTable object.

Parameters:
table_name - A name for the IbsTable object.
rs - A ResultSet object.
Returns:
An IbsTable object.
Throws: SQLException
If any error encountered during this process.
See Also:
ResultSet, IbsTable
 o resultSetToTable
 protected final IbsTable resultSetToTable(String table_name,
                                           ResultSet rs) throws SQLException
This method reads given ResultSet and converts it to an IbsTable object.

Parameters:
table_name - A name for the IbsTable object.
rs - A ResultSet object.
Returns:
An IbsTable object.
Throws: SQLException
If any error encountered during this process.
See Also:
ResultSet, IbsTable
 o getColumnCount
 protected int getColumnCount(ResultSet rs) throws SQLException
Count number of columns in the given ResultSet object.

Parameters:
rs - A ResultSet object for which columns to be counted.
Returns:
An integer - column count. Returns -1 if ResultSet object is null.
 o newTransaction
 protected final EbfTransaction newTransaction(boolean read_only_transaction)
Creates a new EbfTransaction object and returns it. Use 'beginTransaction' method to obtain IConnection object. Use IConnection as you would use java.sql.Connection. At end of the transaction, commit or rollback the transaction.

Parameters:
read_only_transaction - A boolean value. 'true' if connection to be started as 'READ ONLY' transaction. 'false' otherwise.
Returns:
An EbfTransaction object
See Also:
EbfTransaction, IConnection
 o setSessionValue
 protected void setSessionValue(String paramname,
                                String value)
Set given param and value in session properties for later access during template formatting.

Parameters:
param - Assign a unique name to this param
value - A string
 o removeSessionValue
 protected void removeSessionValue(String key)
This method allows app developer to remove previously set session key from the session properties.

Parameters:
key - A key for the custom values
 o setSessionResultSet
 protected void setSessionResultSet(String result_set_name,
                                    ResultSet rs)
Set given EbfResultSet object in session properties for later access during template formatting.

Note: SessionResultSets ARE NOT available for the life of the session. It is available only for the life of current request.

Parameters:
result_set_name - Assign a unique name to this result set.
rs - A ResultSet object
See Also:
ResultSet
 o getSessionResultSet
 protected final ResultSet getSessionResultSet(String result_set_name)
get EbfResultSet object from session properties.

Note: SessionResultSets ARE NOT available for the life of the session. It is available only for the life of current request.

Parameters:
result_set_name - A name of the requested result set.
Returns:
ResultSet
See Also:
ResultSet
 o setSessionTable
 protected final void setSessionTable(String table_name,
                                      IbsTable table)
Set given IbsTable object in session properties for later access during template formatting. Make sure that given IbsTable object has a unique table name assigned to it. If a SessionTable already exists with the given name, it is overwritten with the new table 'table'.

Note: SessionTables ARE available for the life of the session.

Parameters:
table_name - A table name to be assigned to this IbsTable object.
table - An IbsTable object.
See Also:
IbsTable
 o setSessionTable
 protected final void setSessionTable(IbsTable table)
Set given IbsTable object in session properties for later access during template formatting. Make sure that given IbsTable object has a unique table name assigned to it. If a SessionTable already exists with the given name, it is overwritten with the new table 'table'.

Note: SessionTables ARE available for the life of the session.

Parameters:
table - An IbsTable object.
See Also:
IbsTable
 o getSessionTable
 protected final IbsTable getSessionTable(String table_name)
Get IbsTable object from session properties

Note: SessionTables ARE available for the life of the session.

Parameters:
table_name - Name of the requested table.
Returns:
IbsTable
See Also:
IbsTable
 o removeSessionTable
 protected void removeSessionTable(String table_name)
This method allows app developer to remove previously set session table from the session properties. This helps prevent session properties for any given session from becoming very big. Always remove session table at end of your java expression - if you think that table is not required to be stored (persisted) in the user session.

Parameters:
table_name - Name of the table to be removed from the session properties
 o setSessionRecord
 protected final void setSessionRecord(String record_name,
                                       IbsRecord record)
Set given IbsRecord object in session properties for later access during template formatting. Make sure that given IbsRecord object has a unique record name assigned to it. If a SessionRecord already exists with the given name, it is overwritten with the new record 'record'.

Parameters:
record - An IbsRecord object.
See Also:
IbsRecord
 o getSessionRecord
 protected final IbsRecord getSessionRecord(String record_name)
Get IbsTable object from session properties

Note: SessionRecords ARE available for the life of the session.

Parameters:
table_name - Name of the requested table.
Returns:
IbsTable
See Also:
IbsTable
 o setSysTable
 protected final void setSysTable(String table_name,
                                  IbsTable table)
Set given IbsTable object in system properties for later access during template formatting. Make sure that given IbsTable object has a unique table name assigned to it.

Note: Template engine first looks into the user's session properties for the table with the specified table_name, and if found, that table is used. If not found in user session, then it looks into the system properties for existance of a table with the specified table_name.

Note: SysTables ARE available for the life of the Application instance (start - shutdown).

Parameters:
table_name - A table name to be assigned to this IbsTable object.
table - An IbsTable object.
See Also:
IbsTable
 o getSysTable
 protected final IbsTable getSysTable(String table_name)
Get IbsTable object from system properties. Returns null if table_name was not found.

Note: SysTables ARE available for the life of the Application instance (start - shutdown).

Parameters:
table_name - Name of the requested table.
Returns:
IbsTable
See Also:
IbsTable
 o setSysRecord
 protected final void setSysRecord(String record_name,
                                   IbsRecord record)
Set given IbsRecord object in system properties for later access during template formatting. Make sure that given IbsRecord object has a unique record name assigned to it.

Note: Template engine first looks into the user's session properties for the record with the specified record_name, and if found, that record is used. If not found in user session, then it looks into the system properties for existance of a record with the specified record_name.

Note: SysRecords ARE available for the life of the Application instance (start - shutdown).

Parameters:
record_name - A record name to be assigned to this IbsRecord object.
record - An IbsRecord object.
See Also:
IbsRecord
 o getSysRecord
 protected final IbsRecord getSysRecord(String record_name)
Get IbsRecord object from system properties. Returns null if given record name was not found.

Note: SysRecords ARE available for the life of the Application instance (start - shutdown).

Parameters:
record_name - Name of the requested record.
Returns:
IbsRecord
See Also:
IbsRecord
 o printResponse
 protected final void printResponse(String s)
Print a single line response to the client.

Parameters:
s - A string to be printed on the client.
 o saveSession
 protected final boolean saveSession()
Save current session to the file system.

Returns:
A boolean value indicating whether session was saved or not.
 o setAuthentication
 public void setAuthentication(boolean true_or_false)
Set authentication to true or false.

Use this method to remove user authentication -- whether built-in Ebf ACL mechanism is used or custom access control (login mechanism) is implemented. (When user logs out, you will need to remove authentication. User will still be able to access public resurces, but secured resources will require authentication).

Also, use this method to set user as authenticated when using custom login mechanism (not using built-in Ebf ACL)

Parameters:
true_or_false - 'true' to set user as authenticated. 'false' to remove previously set user authentication (useful when user logs out).
 o authenticateUser
 protected boolean authenticateUser()
Authenticate user. Check if user is authorized to access the system or has been granted access to currently active (in user session) business unit. User must have submitted a login_id and a password (submitted field names must be same as 'LoginId Alias' and 'Password Alias' values defined in Application controls.

Returns:
A boolean value. true if user is authenticated. false otherwise.
 o isAclFeatureOn
 protected boolean isAclFeatureOn()
 o isUserAuthenticated
 protected boolean isUserAuthenticated()
 o addUserAcl
 protected boolean addUserAcl(String login_id,
                              String password,
                              String business_unit_id)
Add user authentication to allow user access to a specific business unit.

Parameters:
login_id - User Login ID
password - User Password
business_unit_id - Business unit id for which user is granted access.
Returns:
A boolean value. true if user authentication added successfully. false otherwise.
 o removeUserAcl
 protected boolean removeUserAcl(String login_id,
                                 String business_unit_id)
Remove user ACL record to prevent user access to a specific business unit.

Parameters:
login_id - User Login ID
password - User Password
business_unit_id - Business unit id for which user access should be removed.
Returns:
A boolean value. true if user authentication added successfully. false otherwise.
 o toPath
 protected final String toPath(String relative_path) throws Exception
Converts given path to the InstanceRoot+Path and validates if path is a directory. If not, throws an exception.

Parameters:
relative_path - A relative path
Returns:
An absolute path that includes Instance Root and the relative_path.
Throws: If
combined path is not a valid directory.
 o printContents
 protected void printContents(ResultSet rs) throws SQLException
Print contents of the result set to the console - AS IS, WITHOUT ANY FORMATTING
Note: A result set can be used only once - if you used it here, it cannot be used again in your templates.

WARNING: This functionality is provided for testing/debugging purpose only.

Parameters:
table - An IbsTable object from which data should be extracted and printed.
Throws: SQLException
In case of any SQL error encountered.
 o printContents
 protected void printContents(ResultSet rs,
                              boolean printToClient) throws SQLException
Print contents of the result set to the console or to the remote client - AS IS, WITHOUT ANY FORMATTING
Note: A result set can be used only once - if you used it here, its contents will not be accessible to the template engine when you make call to method evaluateOutput

WARNING: This functionality is provided for testing/debugging purpose only.

Parameters:
table - An IbsTable object from which data should be extracted and printed.
printToClient - A blloean value. If true, contents of the table will be printed to the remote client. If false, contents will be printed to the console.
Throws: SQLException
In case of any SQL error encountered.
 o printContents
 protected void printContents(IbsTable table)
Print contents of the IbsTable object to the console - AS IS, WITHOUT ANY FORMATTING

WARNING: This functionality is provided for testing/debugging purpose only.

Parameters:
table - An IbsTable object from which data should be extracted and printed.
 o printContents
 protected void printContents(IbsTable table,
                              boolean printToClient)
Print contents of the IbsTable object to the console or to the remote client - AS IS, WITHOUT ANY FORMATTING

WARNING: This functionality is provided for testing/debugging purpose only.

Parameters:
table - An IbsTable object from which data should be extracted and printed.
printToClient - A boolean value. If true, contents of the table will be printed to the remote client. If false, contents will be printed to the console.

All Packages  Class Hierarchy  This Package  Previous  Next  Index