本文整理汇总了Java中org.apache.nifi.controller.status.RemoteProcessGroupStatus类的典型用法代码示例。如果您正苦于以下问题:Java RemoteProcessGroupStatus类的具体用法?Java RemoteProcessGroupStatus怎么用?Java RemoteProcessGroupStatus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RemoteProcessGroupStatus类属于org.apache.nifi.controller.status包,在下文中一共展示了RemoteProcessGroupStatus类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPortStatusList
import org.apache.nifi.controller.status.RemoteProcessGroupStatus; //导入依赖的package包/类
private static List<PortStatus> getPortStatusList(RemoteProcessGroupStatus inputRemoteProcessGroupStatus, FlowController flowController, String rootGroupId,
Function<RemoteProcessGroup, Set<RemoteGroupPort>> portFunction) {
return portFunction.apply(flowController.getGroup(rootGroupId).getRemoteProcessGroup(inputRemoteProcessGroupStatus.getId())).stream().map(r -> {
PortStatus portStatus = new PortStatus();
portStatus.setName(r.getName());
portStatus.setTargetExists(r.getTargetExists());
portStatus.setTargetRunning(r.isTargetRunning());
return portStatus;
}).collect(Collectors.toList());
}
示例2: transformStatusCollection
import org.apache.nifi.controller.status.RemoteProcessGroupStatus; //导入依赖的package包/类
private static <E> Map<String, E> transformStatusCollection(Collection<E> statusCollection) {
Map<String, E> statusMap = new HashMap<>();
for (E status : statusCollection) {
if (status instanceof ProcessorStatus) {
statusMap.put(((ProcessorStatus) status).getId(), status);
} else if (status instanceof ConnectionStatus) {
statusMap.put(((ConnectionStatus) status).getId(), status);
} else if (status instanceof RemoteProcessGroupStatus) {
statusMap.put(((RemoteProcessGroupStatus) status).getId(), status);
} else {
// TODO
}
}
return statusMap;
}
示例3: populateRemoteProcessGroup
import org.apache.nifi.controller.status.RemoteProcessGroupStatus; //导入依赖的package包/类
private void populateRemoteProcessGroup(boolean addBulletins, boolean addAuthIssues) {
when(mockFlowController.getGroup(mockFlowController.getRootGroupId())).thenReturn(processGroup);
RemoteProcessGroup remoteProcessGroup = mock(RemoteProcessGroup.class);
when(processGroup.getRemoteProcessGroup(any())).thenReturn(remoteProcessGroup);
RemoteGroupPort remoteGroupPort = mock(RemoteGroupPort.class);
when(remoteGroupPort.getName()).thenReturn("inputPort");
when(remoteGroupPort.getTargetExists()).thenReturn(true);
when(remoteGroupPort.isTargetRunning()).thenReturn(false);
when(remoteProcessGroup.getInputPorts()).thenReturn(Collections.singleton(remoteGroupPort));
remoteGroupPort = mock(RemoteGroupPort.class);
when(remoteGroupPort.getName()).thenReturn("outputPort");
when(remoteGroupPort.getTargetExists()).thenReturn(true);
when(remoteGroupPort.isTargetRunning()).thenReturn(false);
when(remoteProcessGroup.getOutputPorts()).thenReturn(Collections.singleton(remoteGroupPort));
RemoteProcessGroupStatus remoteProcessGroupStatus = new RemoteProcessGroupStatus();
addRemoteProcessGroupStatus(remoteProcessGroupStatus);
if (addBulletins) {
addBulletins("Bulletin message", remoteProcessGroupStatus.getId());
}
when(rootGroupStatus.getRemoteProcessGroupStatus()).thenReturn(Collections.singletonList(remoteProcessGroupStatus));
}
示例4: addRemoteProcessGroupStatus
import org.apache.nifi.controller.status.RemoteProcessGroupStatus; //导入依赖的package包/类
private void addRemoteProcessGroupStatus(RemoteProcessGroupStatus remoteProcessGroupStatus) {
remoteProcessGroupStatus.setName("rpg1");
remoteProcessGroupStatus.setId("rpg1");
remoteProcessGroupStatus.setTransmissionStatus(TransmissionStatus.Transmitting);
remoteProcessGroupStatus.setActiveRemotePortCount(1);
remoteProcessGroupStatus.setInactiveRemotePortCount(2);
remoteProcessGroupStatus.setActiveThreadCount(3);
remoteProcessGroupStatus.setSentContentSize(4L);
remoteProcessGroupStatus.setSentCount(5);
}
示例5: addRemoteProcessGroup
import org.apache.nifi.controller.status.RemoteProcessGroupStatus; //导入依赖的package包/类
public void addRemoteProcessGroup(RemoteProcessGroupStatus r) {
remoteProcessGroups.put(r.getId(), r);
}
示例6: parseRemoteProcessGroupStatusRequest
import org.apache.nifi.controller.status.RemoteProcessGroupStatus; //导入依赖的package包/类
static RemoteProcessGroupStatusBean parseRemoteProcessGroupStatusRequest(RemoteProcessGroupStatus inputRemoteProcessGroupStatus, String statusTypes, FlowController flowController) {
RemoteProcessGroupStatusBean remoteProcessGroupStatusBean = new RemoteProcessGroupStatusBean();
remoteProcessGroupStatusBean.setName(inputRemoteProcessGroupStatus.getName());
String rootGroupId = flowController.getRootGroupId();
String[] statusSplits = statusTypes.split(",");
List<Bulletin> bulletinList = flowController.getBulletinRepository().findBulletins(
new BulletinQuery.Builder()
.sourceIdMatches(inputRemoteProcessGroupStatus.getId())
.build());
for (String statusType : statusSplits) {
switch (statusType.toLowerCase().trim()) {
case "health":
RemoteProcessGroupHealth remoteProcessGroupHealth = new RemoteProcessGroupHealth();
remoteProcessGroupHealth.setTransmissionStatus(inputRemoteProcessGroupStatus.getTransmissionStatus().name());
remoteProcessGroupHealth.setActivePortCount(inputRemoteProcessGroupStatus.getActiveRemotePortCount());
remoteProcessGroupHealth.setInactivePortCount(inputRemoteProcessGroupStatus.getInactiveRemotePortCount());
remoteProcessGroupHealth.setHasBulletins(!bulletinList.isEmpty());
remoteProcessGroupStatusBean.setRemoteProcessGroupHealth(remoteProcessGroupHealth);
break;
case "bulletins":
remoteProcessGroupStatusBean.setBulletinList(transformBulletins(bulletinList));
break;
case "inputports":
remoteProcessGroupStatusBean.setInputPortStatusList(getPortStatusList(inputRemoteProcessGroupStatus, flowController, rootGroupId, RemoteProcessGroup::getInputPorts));
break;
case "outputports":
remoteProcessGroupStatusBean.setOutputPortStatusList(getPortStatusList(inputRemoteProcessGroupStatus, flowController, rootGroupId, RemoteProcessGroup::getOutputPorts));
break;
case "stats":
RemoteProcessGroupStats remoteProcessGroupStats = new RemoteProcessGroupStats();
remoteProcessGroupStats.setActiveThreads(inputRemoteProcessGroupStatus.getActiveThreadCount());
remoteProcessGroupStats.setSentContentSize(inputRemoteProcessGroupStatus.getSentContentSize());
remoteProcessGroupStats.setSentCount(inputRemoteProcessGroupStatus.getSentCount());
remoteProcessGroupStatusBean.setRemoteProcessGroupStats(remoteProcessGroupStats);
break;
}
}
return remoteProcessGroupStatusBean;
}
示例7: getStatus
import org.apache.nifi.controller.status.RemoteProcessGroupStatus; //导入依赖的package包/类
public static FlowStatusReport getStatus(FlowController flowController, String statusRequest, Logger logger) throws StatusRequestException {
if (statusRequest == null) {
logger.error("Received a status request which was null");
throw new StatusRequestException("Cannot complete status request because the statusRequest is null");
}
if (flowController == null) {
logger.error("Received a status but the Flow Controller is null");
throw new StatusRequestException("Cannot complete status request because the Flow Controller is null");
}
FlowStatusReport flowStatusReport = new FlowStatusReport();
List<String> errorsGeneratingReport = new LinkedList<>();
flowStatusReport.setErrorsGeneratingReport(errorsGeneratingReport);
String[] itemsToReport = statusRequest.split(";");
ProcessGroupStatus rootGroupStatus = flowController.getControllerStatus();
Map<String, ProcessorStatus> processorStatusMap = null;
Map<String, ConnectionStatus> connectionStatusMap = null;
Map<String, RemoteProcessGroupStatus> remoteProcessGroupStatusMap = null;
for (String item : itemsToReport) {
String[] sections = item.split(":");
try {
switch (sections[0].toLowerCase().trim()) {
case "systemdiagnostics":
SystemDiagnosticsStatus systemDiagnosticsStatus = parseSystemDiagnosticsRequest(flowController.getSystemDiagnostics(), sections[1]);
flowStatusReport.setSystemDiagnosticsStatus(systemDiagnosticsStatus);
break;
case "instance":
InstanceStatus instanceStatus = parseInstanceRequest(sections[1], flowController, rootGroupStatus);
flowStatusReport.setInstanceStatus(instanceStatus);
break;
case "remoteprocessgroup":
if (flowStatusReport.getRemoteProcessGroupStatusList() == null) {
List<RemoteProcessGroupStatusBean> remoteProcessGroupStatusList = new LinkedList<>();
flowStatusReport.setRemoteProcessGroupStatusList(remoteProcessGroupStatusList);
}
handleRemoteProcessGroupRequest(sections, rootGroupStatus, flowController, flowStatusReport.getRemoteProcessGroupStatusList(), remoteProcessGroupStatusMap, logger);
break;
case "processor":
if (flowStatusReport.getProcessorStatusList() == null) {
List<ProcessorStatusBean> processorStatusList = new LinkedList<>();
flowStatusReport.setProcessorStatusList(processorStatusList);
}
handleProcessorRequest(sections, rootGroupStatus, flowController, flowStatusReport.getProcessorStatusList(), processorStatusMap, logger);
break;
case "connection":
if (flowStatusReport.getConnectionStatusList() == null) {
List<ConnectionStatusBean> connectionStatusList = new LinkedList<>();
flowStatusReport.setConnectionStatusList(connectionStatusList);
}
handleConnectionRequest(sections, rootGroupStatus, flowStatusReport.getConnectionStatusList(), connectionStatusMap, logger);
break;
case "provenancereporting":
if (flowStatusReport.getRemoteProcessGroupStatusList() == null) {
List<ReportingTaskStatus> reportingTaskStatusList = new LinkedList<>();
flowStatusReport.setReportingTaskStatusList(reportingTaskStatusList);
}
handleReportingTaskRequest(sections, flowController, flowStatusReport.getReportingTaskStatusList(), logger);
break;
case "controllerservices":
if (flowStatusReport.getControllerServiceStatusList() == null) {
List<ControllerServiceStatus> controllerServiceStatusList = new LinkedList<>();
flowStatusReport.setControllerServiceStatusList(controllerServiceStatusList);
}
handleControllerServices(sections, flowController, flowStatusReport.getControllerServiceStatusList(), logger);
break;
}
} catch (Exception e) {
logger.error("Hit exception while requesting status for item '" + item + "'", e);
errorsGeneratingReport.add("Unable to get status for request '" + item + "' due to:" + e);
}
}
return flowStatusReport;
}