Search in sources :

Example 11 with THttpClient

use of org.apache.thrift.transport.THttpClient in project sw360portal by sw360.

the class Sw360LicenseService method getThriftLicenseClient.

private LicenseService.Iface getThriftLicenseClient() throws TTransportException {
    THttpClient thriftClient = new THttpClient(thriftServerUrl + "/licenses/thrift");
    TProtocol protocol = new TCompactProtocol(thriftClient);
    return new LicenseService.Client(protocol);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) THttpClient(org.apache.thrift.transport.THttpClient) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol) THttpClient(org.apache.thrift.transport.THttpClient)

Example 12 with THttpClient

use of org.apache.thrift.transport.THttpClient in project sw360portal by sw360.

the class Sw360VulnerabilityService method getThriftVulnerabilityClient.

private VulnerabilityService.Iface getThriftVulnerabilityClient() throws TTransportException {
    THttpClient thriftClient = new THttpClient(thriftServerUrl + "/vulnerabilities/thrift");
    TProtocol protocol = new TCompactProtocol(thriftClient);
    return new VulnerabilityService.Client(protocol);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) THttpClient(org.apache.thrift.transport.THttpClient) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol) THttpClient(org.apache.thrift.transport.THttpClient)

Example 13 with THttpClient

use of org.apache.thrift.transport.THttpClient in project sw360portal by sw360.

the class Sw360AttachmentService method getThriftComponentClient.

private ComponentService.Iface getThriftComponentClient() throws TTransportException {
    THttpClient thriftClient = new THttpClient(thriftServerUrl + "/components/thrift");
    TProtocol protocol = new TCompactProtocol(thriftClient);
    return new ComponentService.Client(protocol);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) THttpClient(org.apache.thrift.transport.THttpClient) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol) THttpClient(org.apache.thrift.transport.THttpClient)

Example 14 with THttpClient

use of org.apache.thrift.transport.THttpClient in project sw360portal by sw360.

the class ThriftClients method makeProtocol.

/**
 * Creates a Thrift Compact Protocol object linked to the given address
 */
private static TProtocol makeProtocol(String url, String service) {
    THttpClient thriftClient = null;
    final String destinationAddress = url + service;
    try {
        thriftClient = new THttpClient(destinationAddress);
    } catch (TTransportException e) {
        log.error("cannot connect to backend on " + destinationAddress, e);
    }
    return new TCompactProtocol(thriftClient);
}
Also used : THttpClient(org.apache.thrift.transport.THttpClient) TTransportException(org.apache.thrift.transport.TTransportException) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol)

Example 15 with THttpClient

use of org.apache.thrift.transport.THttpClient in project sw360portal by sw360.

the class TestLicenseClient method main.

public static void main(String[] args) throws TException, IOException {
    THttpClient thriftClient = new THttpClient("http://127.0.0.1:8080/licenses/thrift");
    TProtocol protocol = new TCompactProtocol(thriftClient);
    LicenseService.Iface client = new LicenseService.Client(protocol);
    List<License> licenses = client.getLicenseSummary();
    List<Obligation> obligations = client.getObligations();
    System.out.println("Fetched " + licenses.size() + " licenses from license service");
    System.out.println("Fetched " + obligations.size() + " obligations from license service");
    // final List<License> licenseList = client.getDetailedLicenseSummaryForExport("");
    final List<License> licenseList = client.getDetailedLicenseSummary("", ImmutableList.of("AFL-2.1", "Artistic-1.0"));
    System.out.println(licenseList.toString());
}
Also used : Obligation(org.eclipse.sw360.datahandler.thrift.licenses.Obligation) TProtocol(org.apache.thrift.protocol.TProtocol) LicenseService(org.eclipse.sw360.datahandler.thrift.licenses.LicenseService) License(org.eclipse.sw360.datahandler.thrift.licenses.License) THttpClient(org.apache.thrift.transport.THttpClient) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol) THttpClient(org.apache.thrift.transport.THttpClient)

Aggregations

THttpClient (org.apache.thrift.transport.THttpClient)51 TProtocol (org.apache.thrift.protocol.TProtocol)34 TCompactProtocol (org.apache.thrift.protocol.TCompactProtocol)18 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)12 TJSONProtocol (org.apache.thrift.protocol.TJSONProtocol)9 Test (org.junit.Test)9 TTransport (org.apache.thrift.transport.TTransport)8 Hbase (org.apache.hadoop.hbase.thrift.generated.Hbase)5 DefaultHttpClient (org.apache.http.impl.client.DefaultHttpClient)5 RequestData (org.simbasecurity.api.service.thrift.RequestData)5 ApacheHttpTransport (com.google.api.client.http.apache.ApacheHttpTransport)4 IOException (java.io.IOException)4 PServiceCall (net.morimekta.providence.PServiceCall)4 TestService (net.morimekta.test.providence.service.TestService)4 Client (org.simbasecurity.api.service.thrift.AuthenticationFilterService.Client)4 HashMap (java.util.HashMap)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)3 TCLIService (org.apache.hive.service.rpc.thrift.TCLIService)3 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)3 ActionDescriptor (org.simbasecurity.api.service.thrift.ActionDescriptor)3