use of org.eclipse.persistence.internal.sessions.factories.model.sequencing.SequenceConfig in project eclipselink by eclipse-ee4j.
the class SessionsFactory method processLoginConfig.
/**
* INTERNAL:
* Process the common elements of a Login.
*/
protected void processLoginConfig(LoginConfig loginConfig, DatasourceLogin login) {
// Platform class
String platformClassName = loginConfig.getPlatformClass();
if (platformClassName != null) {
try {
@SuppressWarnings({ "unchecked" }) Class<DatasourcePlatform> platformClass = (Class<DatasourcePlatform>) m_classLoader.loadClass(platformClassName);
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
login.usePlatform(AccessController.doPrivileged(new PrivilegedNewInstanceFromClass<>(platformClass)));
} else {
login.usePlatform(PrivilegedAccessHelper.newInstanceFromClass(platformClass));
}
} catch (Exception exception) {
throw SessionLoaderException.failedToLoadTag("platform-class", platformClassName, exception);
}
}
// Table qualifier
String tableQualifier = loginConfig.getTableQualifier();
if (tableQualifier != null) {
login.setTableQualifier(tableQualifier);
}
// Username - setUserName checks for null
login.setUserName(loginConfig.getUsername());
// Encryption class (must be set before the password)
// XML Schema default is org.eclipse.persistence.internal.security.JCEEncryptor
login.setEncryptionClassName(loginConfig.getEncryptionClass());
// Password is encrypted on the model - setEncryptedPassword checks for null
login.setEncryptedPassword(loginConfig.getEncryptedPassword());
// External connection pool - XML Schema default is false
login.setUsesExternalConnectionPooling(loginConfig.getExternalConnectionPooling());
// External transaction controller - XML Schema default is false
login.setUsesExternalTransactionController(loginConfig.getExternalTransactionController());
// Sequencing - XML Schema default is null
if (loginConfig.getSequencingConfig() != null) {
if (loginConfig.getSequencingConfig().getDefaultSequenceConfig() != null) {
Sequence sequence = buildSequence(loginConfig.getSequencingConfig().getDefaultSequenceConfig());
login.setDefaultSequence(sequence);
}
if ((loginConfig.getSequencingConfig().getSequenceConfigs() != null) && !loginConfig.getSequencingConfig().getSequenceConfigs().isEmpty()) {
Enumeration<SequenceConfig> eSequenceConfigs = loginConfig.getSequencingConfig().getSequenceConfigs().elements();
while (eSequenceConfigs.hasMoreElements()) {
Sequence sequence = buildSequence(eSequenceConfigs.nextElement());
login.addSequence(sequence);
}
}
}
// Properties (assumes they are all valid)
if (loginConfig.getPropertyConfigs() != null) {
Enumeration<PropertyConfig> e = loginConfig.getPropertyConfigs().elements();
while (e.hasMoreElements()) {
PropertyConfig propertyConfig = e.nextElement();
login.getProperties().put(propertyConfig.getName(), propertyConfig.getValue());
}
}
}
Aggregations