All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----ibs.ebf.server.EbfAgent
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.
Remember: In EbfServer, terms 'Instance' and 'Application'
are used interchangeably.
Note: SessionRecords ARE available for the life of the session.
Note: SessionTables ARE available for the life of the session.
WARNING: This functionality is provided for testing/debugging purpose only.
WARNING: This functionality is provided for testing/debugging purpose only.
WARNING: This functionality is provided for testing/debugging purpose only.
Remember: In EbfServer, names Instance and Application
are used interchangeably.
Remember: In EbfServer, names Instance and Application
are used interchangeably.
Note:
Note:
Note:
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:
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!
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
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.
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.
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
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
Note: SessionResultSets ARE NOT available for the life of the session. It is available
only for the life of current request.
Note: SessionResultSets ARE NOT available for the life of the session. It is available
only for the life of current request.
Note: SessionTables ARE available for the life of the session.
Note: SessionTables ARE available for the life of the session.
Note: SessionTables ARE available for the life of the session.
Note: SessionRecords ARE available for the life of the session.
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).
Note: SysTables ARE available for the life of the Application instance (start - shutdown).
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).
Note: SysRecords ARE available for the life of the Application instance (start - shutdown).
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)
WARNING: This functionality is provided for testing/debugging purpose only.
WARNING: This functionality is provided for testing/debugging purpose only.
WARNING: This functionality is provided for testing/debugging purpose only.
WARNING: This functionality is provided for testing/debugging purpose only.
Example:
public class AppManager extends EbfAgent implements IApp {
.......
.......
}
Console
Response
EbfAgent()
addUserAcl(String, String, String)
authenticateUser()
countErrors()
countSysErrors()
createNewTable(String)
dataFileToTable(String, String, String)
dataFileToTable(String, String, String, String)
evaluateOutput(String)
evaluateOutput(String, File)
File.
evaluateOutput(String, String, File)
File.
execute()
EbfAgent class must override this method.
executeExpression(String)
getApplicationRoot()
getBusinessUnitId()
getBusinessUnitRoot(String)
getColumnCount(ResultSet)
getFormKeysValues()
getFormValue(String)
getFormValue(String, String)
getInstanceRoot()
getIpAddr()
getLoginAttempts()
getLoginId()
getLoginPassword()
getLogWriter()
getPassword()
getQuery(String)
EbfQuery
getSessionId()
getSessionProperties()
getSessionRecord(String)
getSessionResultSet(String)
getSessionTable(String)
getSessionValue(String)
paramname.
getSessionValue(String, String)
paramname.
getSocket(String)
getSysConstantValue(String)
constantname.
getSysConstantValue(String, String)
constantname.
getSysRecord(String)
getSysTable(String)
getUnitConstantValue(String)
constantname.
getUnitConstantValue(String, String)
constantname.
hasErrors()
isAclFeatureOn()
isFormVariable(String)
isSessionVariable(String)
isUserAuthenticated()
loadQuery(String)
log(Object)
logError(Object)
logError(String)
logInfo(String)
newError(String)
newTransaction(boolean)
printContents(IbsTable)
printContents(IbsTable, boolean)
printContents(ResultSet)
Note: A result set can be used only once - if you used it here, it cannot be
used again in your templates.
printContents(ResultSet, boolean)
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
printResponse(String)
remoteExec(String, int, int, String, String, String)
removeSessionTable(String)
removeSessionValue(String)
removeUserAcl(String, String)
resultSetToTable(String, ResultSet)
ResultSetToTable(String, ResultSet)
saveSession()
setAuthentication(boolean)
setLoginAttempt()
setSessionRecord(String, IbsRecord)
setSessionResultSet(String, ResultSet)
setSessionTable(IbsTable)
setSessionTable(String, IbsTable)
setSessionValue(String, String)
setSysRecord(String, IbsRecord)
setSysTable(String, IbsTable)
setTraceLevel(int)
streamToTable(String, BufferedReader)
streamToTable(String, String, BufferedReader)
toPath(String)
unitDataFileToTable(String, String, String, String)
Console
protected static final PrintWriter Console
Response
protected EbfResponse Response
EbfAgent
public EbfAgent()
execute
public abstract int execute()
EbfAgent class must override this method.
getInstanceRoot
protected String getInstanceRoot()
getApplicationRoot
protected String getApplicationRoot()
evaluateOutput
protected int evaluateOutput(String template_name) throws Exception
* 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.
evaluateOutput
protected int evaluateOutput(String template_name,
File output_file) throws Exception
File.
* 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.
evaluateOutput
protected int evaluateOutput(String template_filepath,
String template_name,
File output_file) throws Exception
File.
* 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.
If template_filepath is not supplied (""), system uses default template filepath
for the application.
getSessionId
protected int getSessionId()
executeExpression
protected final int executeExpression(String java_expression)
- 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.
getBusinessUnitRoot
protected final String getBusinessUnitRoot(String unit_id)
getLogWriter
protected final PrintWriter getLogWriter()
logInfo
protected final void logInfo(String msg)
log
protected final void log(Object o)
logError
protected final void logError(String msg)
logError
protected final void logError(Object o)
hasErrors
protected final boolean hasErrors()
newError
protected final void newError(String error_msg)
countErrors
protected final int countErrors()
countSysErrors
protected final int countSysErrors()
setTraceLevel
protected final void setTraceLevel(int level)
getSessionProperties
protected final ISessionProperties getSessionProperties()
isFormVariable
protected boolean isFormVariable(String key)
isSessionVariable
protected boolean isSessionVariable(String key)
getLoginId
protected final String getLoginId()
getLoginPassword
protected final String getLoginPassword()
getLoginAttempts
protected final int getLoginAttempts()
setLoginAttempt
protected void setLoginAttempt()
getIpAddr
protected String getIpAddr()
getPassword
protected String getPassword()
getFormKeysValues
protected IKeys getFormKeysValues()
getBusinessUnitId
protected String getBusinessUnitId()
* 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.
getFormValue
protected String getFormValue(String paramname)
getFormValue
protected String getFormValue(String paramname,
String default_value)
getSessionValue
protected String getSessionValue(String paramname)
paramname. Returns empty
string if given paramname not found in the session variables list.
getSessionValue
protected String getSessionValue(String paramname,
String default_value)
paramname. Return default_value
if given paramname not found in the session variables list.
getUnitConstantValue
protected String getUnitConstantValue(String constantname)
constantname. Returns empty
string if given constantname not found in unit properties.
getUnitConstantValue
protected String getUnitConstantValue(String constantname,
String default_value)
constantname. Returns empty
string if given constantname not found in unit properties.
getSysConstantValue
protected String getSysConstantValue(String constantname)
constantname. Returns empty
string if given constantname not found in unit properties.
getSysConstantValue
protected String getSysConstantValue(String constantname,
String default_value)
constantname. Returns default_value
if given constantname not found in unit properties.
getSocket
protected ISocket getSocket(String socket_id)
getQuery
protected final EbfQuery getQuery(String query_file) throws FileNotFoundException, IOException
EbfQuery
loadQuery
protected final IQuery loadQuery(String query_file) throws InvalidArgumentException, FileNotFoundException, IOException
remoteExec
protected final IConnector remoteExec(String host,
int port,
int timeout_secs,
String exec_cmd,
String params,
String env_vars) throws Exception
* setIdString(..) method to set an identification string
* processRequest() method to send the request
* And getNextLineOfResult() method until an exception is thrown.
createNewTable
protected final IbsTable createNewTable(String unique_table_name)
unitDataFileToTable
protected final IbsTable unitDataFileToTable(String unit_id,
String data_filename,
String param_filepath,
String param_filename) throws Exception
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.
File.seperator to seperate
directories and files.
dataFileToTable
protected final IbsTable dataFileToTable(String data_filepath,
String data_filename,
String param_filename) throws Exception
streamToTable
protected final IbsTable streamToTable(String param_filename,
BufferedReader br) throws Exception
dataFileToTable
protected final IbsTable dataFileToTable(String data_filepath,
String data_filename,
String param_filepath,
String param_filename) throws Exception
File.seperator to seperate directories and files.
streamToTable
protected final IbsTable streamToTable(String param_filepath,
String param_filename,
BufferedReader br) throws Exception
File.seperator to seperate
directories and files.
ResultSetToTable
protected final IbsTable ResultSetToTable(String table_name,
ResultSet rs) throws SQLException
resultSetToTable
protected final IbsTable resultSetToTable(String table_name,
ResultSet rs) throws SQLException
getColumnCount
protected int getColumnCount(ResultSet rs) throws SQLException
newTransaction
protected final EbfTransaction newTransaction(boolean read_only_transaction)
setSessionValue
protected void setSessionValue(String paramname,
String value)
removeSessionValue
protected void removeSessionValue(String key)
setSessionResultSet
protected void setSessionResultSet(String result_set_name,
ResultSet rs)
getSessionResultSet
protected final ResultSet getSessionResultSet(String result_set_name)
setSessionTable
protected final void setSessionTable(String table_name,
IbsTable table)
setSessionTable
protected final void setSessionTable(IbsTable table)
getSessionTable
protected final IbsTable getSessionTable(String table_name)
removeSessionTable
protected void removeSessionTable(String table_name)
setSessionRecord
protected final void setSessionRecord(String record_name,
IbsRecord record)
getSessionRecord
protected final IbsRecord getSessionRecord(String record_name)
setSysTable
protected final void setSysTable(String table_name,
IbsTable table)
getSysTable
protected final IbsTable getSysTable(String table_name)
setSysRecord
protected final void setSysRecord(String record_name,
IbsRecord record)
getSysRecord
protected final IbsRecord getSysRecord(String record_name)
printResponse
protected final void printResponse(String s)
saveSession
protected final boolean saveSession()
setAuthentication
public void setAuthentication(boolean true_or_false)
authenticateUser
protected boolean authenticateUser()
isAclFeatureOn
protected boolean isAclFeatureOn()
isUserAuthenticated
protected boolean isUserAuthenticated()
addUserAcl
protected boolean addUserAcl(String login_id,
String password,
String business_unit_id)
removeUserAcl
protected boolean removeUserAcl(String login_id,
String business_unit_id)
toPath
protected final String toPath(String relative_path) throws Exception
printContents
protected void printContents(ResultSet rs) throws SQLException
Note: A result set can be used only once - if you used it here, it cannot be
used again in your templates.
printContents
protected void printContents(ResultSet rs,
boolean printToClient) throws SQLException
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
printContents
protected void printContents(IbsTable table)
printContents
protected void printContents(IbsTable table,
boolean printToClient)
All Packages Class Hierarchy This Package Previous Next Index