Search in sources :

Example 1 with RuleInfoProto

use of org.smartdata.common.protocol.AdminServerProto.RuleInfoProto in project SSM by Intel-bigdata.

the class ClientSmartProtocolServerSideTranslatorPB method listRulesInfo.

@Override
public ListRulesInfoResponseProto listRulesInfo(RpcController controller, ListRulesInfoRequestProto req) throws ServiceException {
    try {
        List<RuleInfo> infos = server.listRulesInfo();
        List<RuleInfoProto> infoProtos = new ArrayList<>();
        for (RuleInfo info : infos) {
            infoProtos.add(PBHelper.convert(info));
        }
        return ListRulesInfoResponseProto.newBuilder().addAllRulesInfo(infoProtos).build();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : ServiceException(com.google.protobuf.ServiceException) ArrayList(java.util.ArrayList) RuleInfoProto(org.smartdata.common.protocol.AdminServerProto.RuleInfoProto) IOException(java.io.IOException) RuleInfo(org.smartdata.common.rule.RuleInfo)

Example 2 with RuleInfoProto

use of org.smartdata.common.protocol.AdminServerProto.RuleInfoProto in project SSM by Intel-bigdata.

the class SmartAdminProtocolAdminSideTranslatorPB method listRulesInfo.

@Override
public List<RuleInfo> listRulesInfo() throws IOException {
    try {
        ListRulesInfoRequestProto req = ListRulesInfoRequestProto.newBuilder().build();
        List<RuleInfoProto> infoProtos = rpcProxy.listRulesInfo(null, req).getRulesInfoList();
        if (infoProtos == null) {
            return null;
        }
        List<RuleInfo> ret = new ArrayList<>();
        for (RuleInfoProto infoProto : infoProtos) {
            ret.add(PBHelper.convert(infoProto));
        }
        return ret;
    } catch (ServiceException e) {
        throw PBHelper.getRemoteException(e);
    }
}
Also used : ListRulesInfoRequestProto(org.smartdata.common.protocol.AdminServerProto.ListRulesInfoRequestProto) ServiceException(com.google.protobuf.ServiceException) ArrayList(java.util.ArrayList) RuleInfoProto(org.smartdata.common.protocol.AdminServerProto.RuleInfoProto) RuleInfo(org.smartdata.common.rule.RuleInfo)

Aggregations

ServiceException (com.google.protobuf.ServiceException)2 ArrayList (java.util.ArrayList)2 RuleInfoProto (org.smartdata.common.protocol.AdminServerProto.RuleInfoProto)2 RuleInfo (org.smartdata.common.rule.RuleInfo)2 IOException (java.io.IOException)1 ListRulesInfoRequestProto (org.smartdata.common.protocol.AdminServerProto.ListRulesInfoRequestProto)1