NpsSession records current context. It can be directly quoted through the global variable of session.
NpsSession can not be operated by New.
| NpsUser |
GetCurrentUser() Return to currently running user. |
| NpsSite |
GetSite() Return to recently opened website. |
| NpsSite |
GetSite(String id) Return to designated website |
| NpsLog |
GetDefaultLog() Obtain default logger. It will be written into the global nps.log file as default and be simultaneously output in the terminal of application server. For example: the default configuration of Tomcat will be simultaneously output into catalina.out. |
| NpsLog |
CreateLog(String filename) Create your own logger then write it into file designated by filename. The Append mode should be used when writing files. filename will automatically mapped into the root path of currently in-use website. For example, if the root path of current website is c:\web, then the final results of all the three situations below will point to “c:\web\logs\mylog.txt” files: 1.filename=c:\web\logs\mylog.txt 2.filename=c:\logs\mylog.txt 3.filename=/logs/mylog.txt |
| NpsPreparedStatement |
PrepareStatement(String sql) throws Exception Generate “NpsPreparedStatement” object. After binding variables, “ExecuteUpdate” and “ExecuteQuery” will be transferred to implement SQL statement. “ExecuteQuery()” method will return to the object of “NpsResultSet” result set. It will obtain field value through the object of result set. Note:Database connection will adopt the nps connection of DataSource defined in db.xml. |
| void |
Commit() Commit all database changes |
| void |
Rollback() Rollback all database changes |
| void |
SetEnvironmentVar(Object key,Object value) Set system environment variable |
| Object |
GetEnvironmentValue(Object key) Obtain system environment variable |
| String |
GetEnvironmentString(Object key) Obtain system environment variable,return String |
| void |
RemoveEnvironmentVar(Object key) Remove system environment variable |
| void |
SetDebugEnabled() Enter into Debug mode |
| boolean |
IsDebugEnabled() Judge if it is in debug mode. true for yes, false for no |
| String |
GetServerName() Return to currently in-use server based on “hostname(ip address)” format. |
| Date |
GetLastrun() The last runtime |
| int |
GetLastExitStatus() The last exit status. ”0” means exit properly. “1” means abnormal. |