package com.csc.library.session; import java.lang.reflect.Method; import javax.naming.Context; import javax.naming.NamingException; import com.csc.library.security.Authorizable; import com.csc.library.utilities.MyLog; /** * @author Developer * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. * To enable and disable the creation of type comments go to * Window>Preferences>Java>Code Generation. */ public class InitialAuthorize { private Authorizable db = null; private String user,pass,dbName; private InitialEnvironment inv = new InitialEnvironment("GLOBAL"); public InitialAuthorize(String user,String pass,String dbName) { this.user = user; this.pass=pass; this.dbName=dbName; } public Authorizable getAuthorize() { try { String ClassName=inv.getValue("authorize-classname"); if(ClassName.length()==0){ db = (Authorizable)Class.forName("com.csc.library.authorize.MyAuthorize").newInstance(); db.setUser(this.user,this.pass,this.dbName); }else{ db=this.getAuthorize(ClassName); } } catch (Exception e) { MyLog.error(this, e); } return this.db; } public Authorizable getAuthorize(String ClassName) { try { db = (Authorizable)Class.forName("com.csc.library.authorize."+ClassName).newInstance(); db.setUser(this.user,this.pass,this.dbName); } catch (Exception e) { MyLog.error(this, e); } return this.db; } }