/** * INTERNAL: * Connect to the datasource, and return the driver level connection object. */ @Override public Object connectToDatasource(Accessor accessor, Session session) throws DatabaseException { return getConnector().connect(prepareProperties(properties), session); }
/** * INTERNAL: * Connect to the datasource, and return the driver level connection object. */ public Object connectToDatasource(Accessor accessor, Session session) throws DatabaseException { return getConnector().connect(prepareProperties(properties), session); }
/** * INTERNAL: * Connect to the datasource, and return the driver level connection object. */ public Object connectToDatasource(Accessor accessor, Session session) throws DatabaseException { return getConnector().connect(prepareProperties(properties), session); }
/** * PUBLIC: * Print all of the connection information. */ public String toString() { StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); writer.write(Helper.getShortClassName(getClass())); writer.println("("); writer.println("\t" + ToStringLocalization.buildMessage("platform", (Object[])null) + "=> " + getDatasourcePlatform()); if (!shouldUseExternalConnectionPooling()) { writer.println("\t" + ToStringLocalization.buildMessage("user_name", (Object[])null) + "=> \"" + getUserName() + "\""); } writer.print("\t"); getConnector().toString(writer); writer.write(")"); return stringWriter.toString(); }
/** * PUBLIC: * Print all of the connection information. */ public String toString() { StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); writer.write(Helper.getShortClassName(getClass())); writer.println("("); writer.println("\t" + ToStringLocalization.buildMessage("platform", (Object[])null) + "=> " + getDatasourcePlatform()); if (!shouldUseExternalConnectionPooling()) { writer.println("\t" + ToStringLocalization.buildMessage("user_name", (Object[])null) + "=> \"" + getUserName() + "\""); } writer.print("\t"); getConnector().toString(writer); writer.write(")"); return stringWriter.toString(); }
/** * PUBLIC: * Print all of the connection information. */ @Override public String toString() { StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); writer.write(Helper.getShortClassName(getClass())); writer.println("("); writer.println("\t" + ToStringLocalization.buildMessage("platform", (Object[])null) + "=> " + getDatasourcePlatform()); if (!shouldUseExternalConnectionPooling()) { writer.println("\t" + ToStringLocalization.buildMessage("user_name", (Object[])null) + "=> \"" + getUserName() + "\""); } writer.print("\t"); getConnector().toString(writer); writer.write(")"); return stringWriter.toString(); }
/** * INTERNAL: * Clone the login. * This also clones the platform as it is internal to the login. */ @Override public DatasourceLogin clone() { DatasourceLogin clone = null; try { clone = (DatasourceLogin)super.clone(); } catch (Exception exception) { throw new AssertionError(exception); } if (getConnector() != null) { clone.setConnector((Connector)getConnector().clone()); } clone.setDatasourcePlatform((Platform)getDatasourcePlatform().clone()); clone.setProperties((Properties)properties.clone()); return clone; }
/** * INTERNAL: * Clone the login. * This also clones the platform as it is internal to the login. */ public DatasourceLogin clone() { DatasourceLogin clone = null; try { clone = (DatasourceLogin)super.clone(); } catch (Exception exception) { // should not happen...do nothing } if (getConnector() != null) { clone.setConnector((Connector)getConnector().clone()); } clone.setDatasourcePlatform((Platform)getDatasourcePlatform().clone()); clone.setProperties((Properties)properties.clone()); return clone; }
/** * INTERNAL: * Clone the login. * This also clones the platform as it is internal to the login. */ public Object clone() { DatasourceLogin clone = null; try { clone = (DatasourceLogin)super.clone(); } catch (Exception exception) { // should not happen...do nothing } if (getConnector() != null) { clone.setConnector((Connector)getConnector().clone()); } clone.setDatasourcePlatform((Platform)getDatasourcePlatform().clone()); clone.setProperties((Properties)properties.clone()); return clone; }
@Override public void customize(Session session) throws Exception { DatasourceLogin login = session.getLogin(); login.setConnector(new ProfilingConnector(login.getConnector())); if (session instanceof ServerSession) { ServerSession serverSession = (ServerSession) session; ConnectionPool pool = serverSession.getReadConnectionPool(); if (pool != null) { Login poolLogin = pool.getLogin(); if (poolLogin instanceof DatasourceLogin) { login = (DatasourceLogin) poolLogin; login.setConnector(new ProfilingConnector(login.getConnector())); } } } } }
/** * In cases where there is no data source, we will use properties to configure the login for * our session. This method gets those properties and sets them on the login. */ protected void updateLoginDefaultConnector(DatasourceLogin login, Map m){ //Login info might be already set with sessions.xml and could be overridden by session customizer after this //If login has default connector then JDBC properties update(override) the login info if ((login.getConnector() instanceof DefaultConnector)) { DatabaseLogin dbLogin = (DatabaseLogin)login; // Note: This call does not checked the stored persistenceUnitInfo or extended properties because // the map passed into this method should represent the full set of properties we expect to process String jdbcDriver = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_DRIVER, m, session); String connectionString = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_URL, m, session); if(connectionString != null) { dbLogin.setConnectionString(connectionString); } if(jdbcDriver != null) { dbLogin.setDriverClassName(jdbcDriver); } } }
((EISConnectionSpec)login.getConnector()).setConnectionSpecObject(connectorValue); if (factoryValue instanceof String) { ((EISConnectionSpec)login.getConnector()).setName((String)factoryValue); } else if (factoryValue != null) { ((EISConnectionSpec)login.getConnector()).setConnectionFactoryObject(factoryValue); if (!(login.getConnector() instanceof JNDIConnector)) { JNDIConnector jndiConnector; if (mainDatasource instanceof DataSourceImpl) {
if (login.getConnector() instanceof DefaultConnector) { oldDefaultConnector = (DefaultConnector) login.getConnector(); if (login.getConnector() instanceof JNDIConnector) { oldJNDIConnector = (JNDIConnector) login.getConnector(); DefaultConnector defaultConnector = (DefaultConnector) newLogin.getConnector(); if (isNewDriverRequired != null) { if (isNewDriverRequired) { JNDIConnector jndiConnector = (JNDIConnector) newLogin.getConnector(); if (isNewDataSourceRequired) { if (dataSource != null) {