@Override
public SessionConfigs buildSessionsXML(OutputStream dbwsSessionsStream, DBWSBuilder builder) {
SessionConfigs ts = super.buildSessionsXML(dbwsSessionsStream, builder);
String dataSource = builder.getDataSource();
if (dataSource != null) {
DatabaseSessionConfig tmpConfig =
(DatabaseSessionConfig)ts.getSessionConfigs().firstElement();
ProjectConfig orProject = tmpConfig.getPrimaryProject();
LogConfig logConfig = tmpConfig.getLogConfig();
String sessionName = tmpConfig.getName();
DatabaseSessionConfig orSessionConfig = new ServerSessionConfig();
orSessionConfig.setPrimaryProject(orProject);
orSessionConfig.setName(sessionName);
orSessionConfig.setLogConfig(logConfig);
CustomServerPlatformConfig customServerPlatformConfig = new CustomServerPlatformConfig();
customServerPlatformConfig.setEnableJTA(true);
customServerPlatformConfig.setEnableRuntimeServices(true);
customServerPlatformConfig.setServerClassName(
"org.eclipse.persistence.platform.server.jboss.JBossPlatform");
customServerPlatformConfig.setExternalTransactionControllerClass(
"org.eclipse.persistence.transaction.jboss.JBossTransactionController");
orSessionConfig.setServerPlatformConfig(customServerPlatformConfig);
DatabaseLoginConfig dlc = new DatabaseLoginConfig();
dlc.setPlatformClass(builder.getPlatformClassname());
dlc.setExternalConnectionPooling(true);
dlc.setExternalTransactionController(true);
dlc.setDatasource(dataSource);
dlc.setLookupType(JNDIConnector.STRING_LOOKUP);
dlc.setBindAllParameters(true);
dlc.setStreamsForBinding(true);
orSessionConfig.setLoginConfig(dlc);
ts.getSessionConfigs().set(0, orSessionConfig);
}
return ts;
}