use of org.apache.cxf.ws.rm.persistence.jdbc.RMTxStore in project jbossws-cxf by jbossws.
the class RMStoreFeature method initializeProvider.
protected void initializeProvider(InterceptorProvider provider, Bus bus) {
String dataSource = serverDataSource;
RMTxStore rmStore = new RMDataSourceStore();
if (provider instanceof Client) {
try {
Connection con = DriverManager.getConnection("jdbc:derby:./target/wsrmdb;create=true", rmStore.getUserName(), rmStore.getPassword());
rmStore.setConnection(con);
} catch (SQLException e) {
Loggers.ROOT_LOGGER.log(Level.FATAL, "Can't create connection from " + rmStore.getUrl(), e);
throw new WSFException(e);
}
} else {
// server side
if (ctx == null) {
try {
ctx = new InitialContext();
DataSource rmDs = (DataSource) ctx.lookup(dataSource);
rmStore.setDataSource(rmDs);
} catch (NamingException e) {
Loggers.DEPLOYMENT_LOGGER.log(Level.FATAL, "Can't create datasource with " + dataSource, e);
throw new WSFException(e);
}
}
}
rmStore.init();
this.setStore(rmStore);
// force to use RM11 and it can only work with wsa200508 (http://www.w3.org/2005/08/addressing) which is enabled with @Addressing
this.setRMNamespace(RM11Constants.NAMESPACE_URI);
RMAssertion assertion = new RMAssertion();
BaseRetransmissionInterval retransMissionInveral = new BaseRetransmissionInterval();
retransMissionInveral.setMilliseconds(10000L);
assertion.setBaseRetransmissionInterval(retransMissionInveral);
this.setRMAssertion(assertion);
super.initializeProvider(provider, bus);
}
Aggregations