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);
}
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);
}
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);
}
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);
}
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());
}
Aggregations