use of org.apache.thrift.transport.TSocket in project metacat by Netflix.
the class CatalogThriftEventHandler method createContext.
/**
* {@inheritDoc}
*/
@Override
public ServerContext createContext(final TProtocol input, final TProtocol output) {
final String userName = "metacat-thrift-interface";
// requestContext.getHeaderString("X-Forwarded-For");
String clientHost = null;
final long requestThreadId = Thread.currentThread().getId();
final TTransport transport = input.getTransport();
if (transport instanceof TSocket) {
final TSocket thriftSocket = (TSocket) transport;
clientHost = thriftSocket.getSocket().getInetAddress().getHostAddress();
}
final CatalogServerRequestContext context = new CatalogServerRequestContext(userName, null, clientHost, null, "hive", requestThreadId);
MetacatContextManager.setContext(context);
return context;
}
use of org.apache.thrift.transport.TSocket in project hive by apache.
the class SecurityUtils method getSSLSocket.
public static TTransport getSSLSocket(String host, int port, int loginTimeout, String trustStorePath, String trustStorePassWord) throws TTransportException {
TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters();
params.setTrustStore(trustStorePath, trustStorePassWord);
params.requireClientAuth(true);
// The underlying SSLSocket object is bound to host:port with the given SO_TIMEOUT and
// SSLContext created with the given params
TSocket tSSLSocket = TSSLTransportFactory.getClientSocket(host, port, loginTimeout, params);
return getSSLSocketWithHttps(tSSLSocket);
}
use of org.apache.thrift.transport.TSocket in project vcell by virtualcell.
the class SimpleClient method main.
public static void main(String[] args) {
try {
TTransport transport;
transport = new TSocket("localhost", 9091);
transport.open();
TProtocol protocol = new TBinaryProtocol(transport);
SimulationService.Client client = new SimulationService.Client(protocol);
perform(client);
transport.close();
} catch (TException x) {
x.printStackTrace();
}
}
use of org.apache.thrift.transport.TSocket in project vcell by virtualcell.
the class BioformatsImageDatasetReader method readImageDatasetChannels.
@Override
public ImageDataset[] readImageDatasetChannels(String imageID, ClientTaskStatusSupport status, boolean bMergeChannels, Integer timeIndex, ISize resize) throws Exception {
try (TTransport transport = new TSocket("localhost", port)) {
transport.open();
TProtocol protocol = new TBinaryProtocol(transport);
ImageDatasetService.Client client = new ImageDatasetService.Client(protocol);
String fileName = imageID;
org.vcell.imagedataset.ISize t_resize = null;
if (resize != null) {
t_resize = new org.vcell.imagedataset.ISize(resize.getX(), resize.getY(), resize.getZ());
}
List<org.vcell.imagedataset.ImageDataset> t_imageDatasetList = client.readImageDatasetChannels(fileName, bMergeChannels, timeIndex, t_resize);
ImageDataset[] imageDatasets = new ImageDataset[t_imageDatasetList.size()];
for (int i = 0; i < t_imageDatasetList.size(); i++) {
imageDatasets[i] = getImageDataset(t_imageDatasetList.get(i));
}
return imageDatasets;
}
}
use of org.apache.thrift.transport.TSocket in project vcell by virtualcell.
the class BioformatsImageDatasetReader method readImageDataset.
@Override
public ImageDataset readImageDataset(String imageID, ClientTaskStatusSupport status) throws Exception {
try (TTransport transport = new TSocket("localhost", port)) {
transport.open();
TProtocol protocol = new TBinaryProtocol(transport);
ImageDatasetService.Client client = new ImageDatasetService.Client(protocol);
String fileName = imageID;
org.vcell.imagedataset.ImageDataset t_imageDataset = client.readImageDataset(fileName);
ImageDataset imageDataset = getImageDataset(t_imageDataset);
return imageDataset;
}
}
Aggregations