/** * Get list of userspace table names * @param controller Unused (set to null). * @param req GetTableNamesRequest * @return GetTableNamesResponse * @throws ServiceException */ @Override public GetTableNamesResponse getTableNames(RpcController controller, GetTableNamesRequest req) throws ServiceException { try { master.checkInitialized(); final String regex = req.hasRegex() ? req.getRegex() : null; final String namespace = req.hasNamespace() ? req.getNamespace() : null; List<TableName> tableNames = master.listTableNames(namespace, regex, req.getIncludeSysTables()); GetTableNamesResponse.Builder builder = GetTableNamesResponse.newBuilder(); if (tableNames != null && tableNames.size() > 0) { // Add the table names to the response for (TableName table: tableNames) { builder.addTableNames(ProtobufUtil.toProtoTableName(table)); } } return builder.build(); } catch (IOException e) { throw new ServiceException(e); } }
/** * Get list of userspace table names * @param controller Unused (set to null). * @param req GetTableNamesRequest * @return GetTableNamesResponse * @throws ServiceException */ @Override public GetTableNamesResponse getTableNames( RpcController controller, GetTableNamesRequest req) throws ServiceException { try { Collection<HTableDescriptor> descriptors = this.tableDescriptors.getAll().values(); GetTableNamesResponse.Builder builder = GetTableNamesResponse.newBuilder(); for (HTableDescriptor descriptor: descriptors) { if (descriptor.getTableName().isSystemTable()) { continue; } builder.addTableNames(ProtobufUtil.toProtoTableName(descriptor.getTableName())); } return builder.build(); } catch (IOException e) { throw new ServiceException(e); } }
/** * Get list of userspace table names * @param controller Unused (set to null). * @param req GetTableNamesRequest * @return GetTableNamesResponse * @throws ServiceException */ @Override public GetTableNamesResponse getTableNames(RpcController controller, GetTableNamesRequest req) throws ServiceException { try { master.checkInitialized(); Collection<HTableDescriptor> descriptors = master.getTableDescriptors().getAll().values(); GetTableNamesResponse.Builder builder = GetTableNamesResponse.newBuilder(); for (HTableDescriptor descriptor: descriptors) { if (descriptor.getTableName().isSystemTable()) { continue; } builder.addTableNames(ProtobufUtil.toProtoTableName(descriptor.getTableName())); } return builder.build(); } catch (IOException e) { throw new ServiceException(e); } }