use of com.evolveum.midpoint.xml.ns._public.common.common_3.NodeType in project midpoint by Evolveum.
the class NodeDtoProvider method internalIterator.
@Override
public Iterator<? extends NodeDto> internalIterator(long first, long count) {
Collection<String> selectedOids = getSelectedOids();
getAvailableData().clear();
OperationResult result = new OperationResult(OPERATION_LIST_NODES);
Task task = getTaskManager().createTaskInstance(OPERATION_LIST_NODES);
try {
ObjectPaging paging = createPaging(first, count);
ObjectQuery query = getQuery();
if (query == null) {
query = new ObjectQuery();
}
query.setPaging(paging);
List<PrismObject<NodeType>> nodes = getModel().searchObjects(NodeType.class, query, null, task, result);
for (PrismObject<NodeType> node : nodes) {
getAvailableData().add(createNodeDto(node));
}
result.recordSuccess();
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Unhandled exception when listing nodes", ex);
result.recordFatalError("Couldn't list nodes.", ex);
}
setSelectedOids(selectedOids);
return getAvailableData().iterator();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.NodeType in project midpoint by Evolveum.
the class RNode method toJAXB.
@Override
public NodeType toJAXB(PrismContext prismContext, Collection<SelectorOptions<GetOperationOptions>> options) throws DtoTranslationException {
NodeType object = new NodeType();
RUtil.revive(object, prismContext);
RNode.copyToJAXB(this, object, prismContext, options);
return object;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.NodeType in project midpoint by Evolveum.
the class ExecutionManager method getClusterStatusInformation.
/*
* ==================== NODE-LEVEL METHODS (QUERIES) ====================
*/
public ClusterStatusInformation getClusterStatusInformation(boolean clusterwide, boolean allowCached, OperationResult parentResult) {
OperationResult result = parentResult.createSubresult(ExecutionManager.class.getName() + ".getClusterStatusInformation");
result.addParam("clusterwide", clusterwide);
if (allowCached && clusterwide && lastClusterStatusInformation != null && lastClusterStatusInformation.isFresh(ALLOWED_CLUSTER_STATE_INFORMATION_AGE)) {
result.recordSuccess();
return lastClusterStatusInformation;
}
ClusterStatusInformation retval = new ClusterStatusInformation();
if (clusterwide) {
for (PrismObject<NodeType> node : taskManager.getClusterManager().getAllNodes(result)) {
addNodeAndTaskInformation(retval, node, result);
}
} else {
addNodeAndTaskInformation(retval, taskManager.getClusterManager().getNodePrism(), result);
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("cluster state information = {}", retval.dump());
}
if (clusterwide) {
lastClusterStatusInformation = retval;
}
result.recomputeStatus();
return retval;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.NodeType in project midpoint by Evolveum.
the class JobExecutor method getAvailableNode.
private NodeType getAvailableNode(List<String> allowedNodes, List<String> disallowedNodes, OperationResult result) {
ClusterStatusInformation clusterStatusInformation = taskManagerImpl.getExecutionManager().getClusterStatusInformation(true, false, result);
List<NodeType> matching = clusterStatusInformation.getNodes().stream().filter(node -> passes(node.getNodeIdentifier(), allowedNodes, disallowedNodes) && node.getExecutionStatus() == NodeExecutionStatusType.RUNNING).collect(Collectors.toList());
if (matching.isEmpty()) {
return null;
} else {
return matching.get((int) (Math.random() * matching.size()));
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.NodeType in project midpoint by Evolveum.
the class NodeRegistrar method createNodePrism.
private PrismObject<NodeType> createNodePrism(TaskManagerConfiguration configuration) {
PrismObjectDefinition<NodeType> nodeTypeDef = getPrismContext().getSchemaRegistry().findObjectDefinitionByCompileTimeClass(NodeType.class);
PrismObject<NodeType> nodePrism;
try {
nodePrism = nodeTypeDef.instantiate();
} catch (SchemaException e) {
throw new SystemException(e.getMessage(), e);
}
NodeType node = nodePrism.asObjectable();
node.setNodeIdentifier(configuration.getNodeId());
node.setName(new PolyStringType(configuration.getNodeId()));
node.setHostname(getMyAddress());
node.setJmxPort(configuration.getJmxPort());
node.setClustered(configuration.isClustered());
node.setRunning(true);
node.setLastCheckInTime(getCurrentTime());
node.setBuild(getBuildInformation());
generateInternalNodeIdentifier(node);
return nodePrism;
}
Aggregations