/** * Check the provided map for an object with the given key. If that object is not available, check the * System properties. If it is not available from either location, return the default value. * @param propertyKey * @param defaultValue * @return */ public String getConfigPropertyAsString(String propertyKey, String defaultValue){ return getConfigPropertyAsStringLogDebug(propertyKey, predeployProperties, defaultValue, session); }
public String getConfigPropertyAsString(String propertyKey){ return getConfigPropertyAsStringLogDebug(propertyKey, predeployProperties, session); }
public static String getConfigPropertyAsStringLogDebug(String propertyKey, Map overrides, String defaultValue, AbstractSession session){ String value = getConfigPropertyAsStringLogDebug(propertyKey, overrides, session); if (value == null){ value = defaultValue; session.log(SessionLog.FINEST, SessionLog.PROPERTIES, "property_value_default", new Object[]{propertyKey, value}); } return value; }
protected boolean isValidationOnly(Map m, boolean shouldMergeMap) { if(shouldMergeMap) { m = mergeWithExistingMap(m); } String validationOnlyString = getConfigPropertyAsStringLogDebug(TOPLINK_VALIDATION_ONLY_PROPERTY, m, session); if(validationOnlyString != null) { return Boolean.parseBoolean(validationOnlyString); } else { return false; } }
/** * 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. * @param login * @param m */ protected void updateLoginDefaultConnector(DatasourceLogin login, Map m){ 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(TopLinkProperties.JDBC_DRIVER, m, session); String connectionString = getConfigPropertyAsStringLogDebug(TopLinkProperties.JDBC_URL, m, session); if(connectionString != null) { dbLogin.setConnectionString(connectionString); } if(jdbcDriver != null) { dbLogin.setDriverClassName(jdbcDriver); } } }
protected void processSessionCustomizer(Map m, ClassLoader loader) { String sessionCustomizerClassName = getConfigPropertyAsStringLogDebug(TopLinkProperties.SESSION_CUSTOMIZER, m, session); if(sessionCustomizerClassName == null) { return; } Class sessionCustomizerClass = findClassForProperty(sessionCustomizerClassName, TopLinkProperties.SESSION_CUSTOMIZER, loader); SessionCustomizer sessionCustomizer; try { sessionCustomizer = (SessionCustomizer)sessionCustomizerClass.newInstance(); sessionCustomizer.customize(session); } catch (Exception ex) { throw EntityManagerSetupException.failedWhileProcessingProperty(TopLinkProperties.SESSION_CUSTOMIZER, sessionCustomizerClassName, ex); } }
String tsString = getConfigPropertyAsStringLogDebug(TopLinkProperties.LOGGING_TIMESTAMP, m, session); if (tsString != null) { log.setShouldPrintDate(Boolean.parseBoolean(tsString)); String threadString = getConfigPropertyAsStringLogDebug(TopLinkProperties.LOGGING_THREAD, m, session); if (threadString != null) { log.setShouldPrintThread(Boolean.parseBoolean(threadString)); String sessionString = getConfigPropertyAsStringLogDebug(TopLinkProperties.LOGGING_SESSION, m, session); if (sessionString != null) { log.setShouldPrintSession(Boolean.parseBoolean(sessionString)); String exString = getConfigPropertyAsStringLogDebug(TopLinkProperties.LOGGING_EXCEPTIONS, m, session); if (exString != null) { log.setShouldLogExceptionStackTrace(Boolean.parseBoolean(exString));
/** * Updates server session name if changed. * @return true if the name has changed. */ protected boolean updateSessionName(Map m) { String newName = getConfigPropertyAsStringLogDebug(TopLinkProperties.SESSION_NAME, m, session); if(newName == null || newName.equals(session.getName())) { return false; } removeSessionFromGlobalSessionManager(); session.setName(newName); addSessionToGlobalSessionManager(); return true; }
protected void updatePools(Map m) { String strWriteMin = getConfigPropertyAsStringLogDebug(TopLinkProperties.JDBC_WRITE_CONNECTIONS_MIN, m, session); if(strWriteMin != null) { session.getDefaultConnectionPool().setMinNumberOfConnections(Integer.parseInt(strWriteMin)); String strWriteMax = getConfigPropertyAsStringLogDebug(TopLinkProperties.JDBC_WRITE_CONNECTIONS_MAX, m, session); if(strWriteMax != null) { session.getDefaultConnectionPool().setMaxNumberOfConnections(Integer.parseInt(strWriteMax)); String strReadMin = getConfigPropertyAsStringLogDebug(TopLinkProperties.JDBC_READ_CONNECTIONS_MIN, m, session); if(strReadMin != null) { session.getReadConnectionPool().setMinNumberOfConnections(Integer.parseInt(strReadMin)); String strReadMax = getConfigPropertyAsStringLogDebug(TopLinkProperties.JDBC_READ_CONNECTIONS_MAX, m, session); if(strReadMax != null) { session.getReadConnectionPool().setMaxNumberOfConnections(Integer.parseInt(strReadMax)); String strShouldUseShared = getConfigPropertyAsStringLogDebug(TopLinkProperties.JDBC_READ_CONNECTIONS_SHARED, m,session); if(strShouldUseShared != null) { boolean shouldUseShared = Boolean.parseBoolean(strShouldUseShared);
/** * Make any changes to our ServerSession that can be made after it is created. * @param m */ protected void updateServerSession(Map m, ClassLoader loader) { if (session == null || session.isConnected()) { return; } // In deploy Session name and ServerPlatform could've changed which will affect the loggers. boolean serverPlatformChanged = updateServerPlatform(m, loader); boolean sessionNameChanged = updateSessionName(m); updateLoggers(m, serverPlatformChanged, sessionNameChanged, loader); String shouldBindString = getConfigPropertyAsStringLogDebug(TopLinkProperties.JDBC_BIND_PARAMETERS, m, session); if (shouldBindString != null) { session.getPlatform().setShouldBindAllParameters(Boolean.parseBoolean(shouldBindString)); } updateLogins(m); if(!session.getLogin().shouldUseExternalTransactionController()) { session.getServerPlatform().disableJTA(); } updatePools(m); updateDescriptorCacheSettings(m, loader); // Customizers should be processed last processDescriptorCustomizers(m, loader); processSessionCustomizer(m, loader); }
String user = getConfigPropertyAsStringLogDebug(TopLinkProperties.JDBC_USER, m, session); String password = getConfigPropertyAsStringLogDebug(TopLinkProperties.JDBC_PASSWORD, m, session); if(user != null) { login.setUserName(user); String transTypeString = getConfigPropertyAsStringLogDebug(TopLinkProperties.TRANSACTION_TYPE, m, session); if ( transTypeString != null ){ transactionType = PersistenceUnitTransactionType.valueOf(transTypeString);
String transTypeString = getConfigPropertyAsStringLogDebug(TopLinkProperties.TRANSACTION_TYPE, predeployProperties, session); if ( transTypeString != null ){ transactionType=PersistenceUnitTransactionType.valueOf(transTypeString); EntityManagerFactoryProvider.getConfigPropertyAsStringLogDebug(EntityManagerFactoryProvider.TOPLINK_ORM_THROW_EXCEPTIONS, predeployProperties, "true", session));