package com.sibvisions.apps.showcase; ... ... /** * Session object for Showcase application. */ public class Session extends Application { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // User-defined methods //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Returns access to the database. * * @return the access to the database * @throws Exception if the datasource can not be opened */ public DBAccess getDBAccess() throws Exception { DBAccess dba = (DBAccess)get("dBAccess"); if (dba == null) { IConfiguration cfgSession = SessionContext.getCurrentSessionConfig(); dba = new HSQLDBAccess(); //read the configuration from the config file dba.setConnection(cfgSession.getProperty( "/application/securitymanager/database/url")); dba.setUser(cfgSession.getProperty( "/application/securitymanager/database/username")); dba.setPassword(cfgSession.getProperty( "/application/securitymanager/database/password")); dba.open(); put("dBAccess", dba); } return dba; } /** * Gets the source code access object. * * @return the source access object */ public SourceCode getSourceCode() { SourceCode sc = (SourceCode)get("sourceCode"); if (sc == null) { sc = new SourceCode(); put("sourceCode", sc); } return sc; } } // Session