public SessionFactory build() { beforeBuild(); System.getProperties().putAll(configuration.settings); Database database = new Database(configuration); Engine engine = new Engine(database); return engine; }
public void bind(Channel channel) { this.channel = channel; ServerSession old = channel.attr(CHANNEL_SESSION_KEY).get(); if (old != null) { throw new IllegalStateException("session is already existing in channel"); } channel.attr(CHANNEL_SESSION_KEY).set(this); Properties prop = new Properties(); if(this.username != null) { prop.setProperty("user", this.username); } if(this.password != null) { prop.setProperty("password", this.password); } dbSession = server.getEngine().createSession(prop); server.registerSession(this); }
public synchronized static SessionFactory connectEmbedded(String url, Properties prop) { SessionFactory sessionFactory = EMBEDDED_ENGINES.get(url); if (sessionFactory == null) { String configLocation = getConfigLocation(url); sessionFactory = SessionFactoryBuilder.newBuilder().fromXml(configLocation).applySettings(prop).build(); EMBEDDED_ENGINES.put(url, sessionFactory); } return sessionFactory; }
/** * INTERNAL */ public JdbcConnection(String url, Properties ci) throws SQLException { this.ci = ci; this.url = url; this.user = ci.getProperty("user"); this.session = Engine.connectEmbedded(url, ci).createSession(ci); int id = getNextId(TraceObject.CONNECTION); this.trace = session.getTrace(); setTrace(trace, TraceObject.CONNECTION, id); }