com.atomikos.icatch.tcc.rest.Server Maven / Gradle / Ivy
/**
* Copyright (C) 2000-2017 Atomikos
*
* LICENSE CONDITIONS
*
* See http://www.atomikos.com/Main/WhichLicenseApplies for details.
*/
package com.atomikos.icatch.tcc.rest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
import com.atomikos.icatch.config.Configuration;
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
/**
* Simple server application to run a TCC/REST coordinator service.
*
* By default, plain HTTP is used. To enable HTTPS:
*
*
* - Construct your own app and create an instance of this class
* - Pass an https://... URL as constructor startup parameter
* - Initialize the CXF bus for HTTPS by setting the default bus (see CXF docs)
* - Call start on the server object
*
*
*/
public class Server {
private String url;
private JAXRSServerFactoryBean sf;
public Server(String url) {
this.url = url;
}
public void start() {
startTransactionCore();
startCoordinatorService();
}
private void startCoordinatorService() {
CoordinatorImp coord = new CoordinatorImp();
sf = new JAXRSServerFactoryBean();
List