public OutputStream getSessionsStream(String sessionsFileName) throws FileNotFoundException {
return new FileOutputStream(new File(stageDir, sessionsFileName));
}
public SessionConfigs buildSessionsXML(OutputStream dbwsSessionsStream, DBWSBuilder builder) {
// build basic sessions.xml - no server platform settings, no Datasource settings
SessionConfigs ts = new SessionConfigs();
ts.setVersion(Version.getVersion());
DatabaseSessionConfig orSessionConfig = new DatabaseSessionConfig();
String projectName = builder.getProjectName();
orSessionConfig.setName(projectName + "-" + DBWS_OR_SESSION_NAME_SUFFIX);
ProjectConfig orProjectConfig = builder.buildORProjectConfig();
orSessionConfig.setPrimaryProject(orProjectConfig);
String orSessionCustomizerClassName = builder.getOrSessionCustomizerClassName();
if (orSessionCustomizerClassName != null && !"".equals(orSessionCustomizerClassName)) {
orSessionConfig.setSessionCustomizerClass(orSessionCustomizerClassName);
}
DatabaseLoginConfig dlc = new DatabaseLoginConfig();
dlc.setBindAllParameters(true);
dlc.setStreamsForBinding(true);
dlc.setJdbcBatchWriting(true);
dlc.setConnectionURL(builder.getUrl());
dlc.setDriverClass(builder.getDriver());
dlc.setUsername(builder.getUsername());
dlc.setEncryptedPassword(builder.getPassword());
dlc.setPlatformClass(builder.getPlatformClassname());
orSessionConfig.setLoginConfig(dlc);
DefaultSessionLogConfig orLogConfig = new DefaultSessionLogConfig();
orLogConfig.setLogLevel(builder.getLogLevel());
orSessionConfig.setLogConfig(orLogConfig);
ts.addSessionConfig(orSessionConfig);
DatabaseSessionConfig oxSessionConfig = new DatabaseSessionConfig();
oxSessionConfig.setName(projectName + "-" + DBWS_OX_SESSION_NAME_SUFFIX);
ProjectConfig oxProjectConfig = builder.buildOXProjectConfig();
oxSessionConfig.setPrimaryProject(oxProjectConfig);
DefaultSessionLogConfig oxLogConfig = new DefaultSessionLogConfig();
oxLogConfig.setLogLevel("off");
oxSessionConfig.setLogConfig(oxLogConfig);
String oxSessionCustomizerClassName = builder.getOxSessionCustomizerClassName();
if (oxSessionCustomizerClassName != null && !"".equals(oxSessionCustomizerClassName)) {
oxSessionConfig.setSessionCustomizerClass(oxSessionCustomizerClassName);
}
ts.addSessionConfig(oxSessionConfig);
return ts;
}