Search in sources :

Example 1 with ServiceInfoEx

use of org.apache.hadoop.ozone.om.helpers.ServiceInfoEx in project ozone by apache.

the class OzoneManagerProtocolClientSideTranslatorPB method getServiceInfo.

@Override
public ServiceInfoEx getServiceInfo() throws IOException {
    ServiceListRequest req = ServiceListRequest.newBuilder().build();
    OMRequest omRequest = createOMRequest(Type.ServiceList).setServiceListRequest(req).build();
    final ServiceListResponse resp = handleError(submitRequest(omRequest)).getServiceListResponse();
    return new ServiceInfoEx(resp.getServiceInfoList().stream().map(ServiceInfo::getFromProtobuf).collect(Collectors.toList()), resp.getCaCertificate(), resp.getCaCertsList());
}
Also used : ServiceInfo(org.apache.hadoop.ozone.om.helpers.ServiceInfo) OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) ServiceListRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListRequest) ServiceInfoEx(org.apache.hadoop.ozone.om.helpers.ServiceInfoEx) ServiceListResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListResponse)

Example 2 with ServiceInfoEx

use of org.apache.hadoop.ozone.om.helpers.ServiceInfoEx in project ozone by apache.

the class OzoneManagerRequestHandler method getServiceList.

private ServiceListResponse getServiceList(ServiceListRequest request) throws IOException {
    ServiceListResponse.Builder resp = ServiceListResponse.newBuilder();
    ServiceInfoEx serviceInfoEx = impl.getServiceInfo();
    List<OzoneManagerProtocolProtos.ServiceInfo> serviceInfoProtos = new ArrayList<>();
    List<ServiceInfo> serviceInfos = serviceInfoEx.getServiceInfoList();
    for (ServiceInfo info : serviceInfos) {
        serviceInfoProtos.add(info.getProtobuf());
    }
    resp.addAllServiceInfo(serviceInfoProtos);
    if (serviceInfoEx.getCaCertificate() != null) {
        resp.setCaCertificate(serviceInfoEx.getCaCertificate());
    }
    for (String ca : serviceInfoEx.getCaCertPemList()) {
        resp.addCaCerts(ca);
    }
    return resp.build();
}
Also used : ServiceInfo(org.apache.hadoop.ozone.om.helpers.ServiceInfo) ServiceInfoEx(org.apache.hadoop.ozone.om.helpers.ServiceInfoEx) ArrayList(java.util.ArrayList) ServiceListResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListResponse)

Aggregations

ServiceInfo (org.apache.hadoop.ozone.om.helpers.ServiceInfo)2 ServiceInfoEx (org.apache.hadoop.ozone.om.helpers.ServiceInfoEx)2 ServiceListResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListResponse)2 ArrayList (java.util.ArrayList)1 OMRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest)1 ServiceListRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListRequest)1