private GridClientNodeBean createNodeBean(ClusterNode node,boolean mtr,boolean attr){
  assert node != null;
  GridClientNodeBean nodeBean=new GridClientNodeBean();
  nodeBean.setNodeId(node.id());
  nodeBean.setConsistentId(node.consistentId());
  nodeBean.setTcpPort(attribute(node,ATTR_REST_TCP_PORT,0));
  nodeBean.setTcpAddresses(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_ADDRS)));
  nodeBean.setTcpHostNames(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_HOST_NAMES)));
  GridCacheProcessor cacheProc=ctx.cache();
  Map<String,CacheMode> nodeCaches=ctx.discovery().nodeCaches(node);
  Collection<GridClientCacheBean> caches=new ArrayList<>(nodeCaches.size());
  for (  String cacheName : nodeCaches.keySet())   caches.add(createCacheBean(cacheProc.cacheConfiguration(cacheName)));
  nodeBean.setCaches(caches);
  if (mtr) {
    ClusterMetrics metrics=node.metrics();
    GridClientNodeMetricsBean metricsBean=new GridClientNodeMetricsBean();
    metricsBean.setStartTime(metrics.getStartTime());
    metricsBean.setAverageActiveJobs(metrics.getAverageActiveJobs());
    metricsBean.setAverageCancelledJobs(metrics.getAverageCancelledJobs());
    metricsBean.setAverageCpuLoad(metrics.getAverageCpuLoad());
    metricsBean.setAverageJobExecuteTime(metrics.getAverageJobExecuteTime());
    metricsBean.setAverageJobWaitTime(metrics.getAverageJobWaitTime());
    metricsBean.setAverageRejectedJobs(metrics.getAverageRejectedJobs());
    metricsBean.setAverageWaitingJobs(metrics.getAverageWaitingJobs());
    metricsBean.setCurrentActiveJobs(metrics.getCurrentActiveJobs());
    metricsBean.setCurrentCancelledJobs(metrics.getCurrentCancelledJobs());
    metricsBean.setCurrentCpuLoad(metrics.getCurrentCpuLoad());
    metricsBean.setCurrentGcCpuLoad(metrics.getCurrentGcCpuLoad());
    metricsBean.setCurrentDaemonThreadCount(metrics.getCurrentDaemonThreadCount());
    metricsBean.setCurrentIdleTime(metrics.getCurrentIdleTime());
    metricsBean.setCurrentJobExecuteTime(metrics.getCurrentJobExecuteTime());
    metricsBean.setCurrentJobWaitTime(metrics.getCurrentJobWaitTime());
    metricsBean.setCurrentRejectedJobs(metrics.getCurrentRejectedJobs());
    metricsBean.setCurrentThreadCount(metrics.getCurrentThreadCount());
    metricsBean.setCurrentWaitingJobs(metrics.getCurrentWaitingJobs());
    metricsBean.setHeapMemoryCommitted(metrics.getHeapMemoryCommitted());
    metricsBean.setHeapMemoryInitialized(metrics.getHeapMemoryInitialized());
    metricsBean.setHeapMemoryMaximum(metrics.getHeapMemoryMaximum());
    metricsBean.setHeapMemoryUsed(metrics.getHeapMemoryUsed());
    metricsBean.setLastDataVersion(metrics.getLastDataVersion());
    metricsBean.setLastUpdateTime(metrics.getLastUpdateTime());
    metricsBean.setMaximumActiveJobs(metrics.getMaximumActiveJobs());
    metricsBean.setMaximumCancelledJobs(metrics.getMaximumCancelledJobs());
    metricsBean.setMaximumJobExecuteTime(metrics.getMaximumJobExecuteTime());
    metricsBean.setMaximumJobWaitTime(metrics.getMaximumJobWaitTime());
    metricsBean.setMaximumRejectedJobs(metrics.getMaximumRejectedJobs());
    metricsBean.setMaximumThreadCount(metrics.getMaximumThreadCount());
    metricsBean.setMaximumWaitingJobs(metrics.getMaximumWaitingJobs());
    metricsBean.setNodeStartTime(metrics.getNodeStartTime());
    metricsBean.setNonHeapMemoryCommitted(metrics.getNonHeapMemoryCommitted());
    metricsBean.setNonHeapMemoryInitialized(metrics.getNonHeapMemoryInitialized());
    metricsBean.setNonHeapMemoryMaximum(metrics.getNonHeapMemoryMaximum());
    metricsBean.setNonHeapMemoryUsed(metrics.getNonHeapMemoryUsed());
    metricsBean.setStartTime(metrics.getStartTime());
    metricsBean.setTotalCancelledJobs(metrics.getTotalCancelledJobs());
    metricsBean.setTotalCpus(metrics.getTotalCpus());
    metricsBean.setTotalExecutedJobs(metrics.getTotalExecutedJobs());
    metricsBean.setTotalIdleTime(metrics.getTotalIdleTime());
    metricsBean.setTotalRejectedJobs(metrics.getTotalRejectedJobs());
    metricsBean.setTotalStartedThreadCount(metrics.getTotalStartedThreadCount());
    metricsBean.setTotalExecutedTasks(metrics.getTotalExecutedTasks());
    metricsBean.setSentMessagesCount(metrics.getSentMessagesCount());
    metricsBean.setSentBytesCount(metrics.getSentBytesCount());
    metricsBean.setReceivedMessagesCount(metrics.getReceivedMessagesCount());
    metricsBean.setReceivedBytesCount(metrics.getReceivedBytesCount());
    metricsBean.setUpTime(metrics.getUpTime());
    nodeBean.setMetrics(metricsBean);
  }
  if (attr) {
    Map<String,Object> attrs=new HashMap<>(node.attributes());
    attrs.remove(ATTR_CACHE);
    attrs.remove(ATTR_TX_CONFIG);
    attrs.remove(ATTR_SECURITY_SUBJECT);
    attrs.remove(ATTR_SECURITY_CREDENTIALS);
    for (Iterator<Map.Entry<String,Object>> i=attrs.entrySet().iterator(); i.hasNext(); ) {
      Map.Entry<String,Object> e=i.next();
      if (!e.getKey().startsWith("org.apache.ignite.") && !e.getKey().startsWith("plugins.") && System.getProperty(e.getKey()) == null) {
        i.remove();
        continue;
      }
      if (e.getValue() != null) {
        if (e.getValue().getClass().isEnum() || e.getValue() instanceof InetAddress)         e.setValue(e.getValue().toString());
 else         if (e.getValue().getClass().isArray())         i.remove();
      }
    }
    nodeBean.setAttributes(attrs);
  }
  return nodeBean;
}

private GridClientNodeBean createNodeBean ( ClusterNode node , boolean mtr , boolean attr ) { assert node != null ; GridClientNodeBean nodeBean = new GridClientNodeBean ( ) ; nodeBean . setNodeId ( node . id ( ) ) ; nodeBean . setConsistentId ( node . consistentId ( ) ) ; nodeBean . setTcpPort ( attribute ( node , ATTR_REST_TCP_PORT , 0 ) ) ; nodeBean . setTcpAddresses ( nonEmptyList ( node . < Collection < String > > attribute ( ATTR_REST_TCP_ADDRS ) ) ) ; nodeBean . setTcpHostNames ( nonEmptyList ( node . < Collection < String > > attribute ( ATTR_REST_TCP_HOST_NAMES ) ) ) ; GridCacheProcessor cacheProc = ctx . cache ( ) ; Map < String , CacheMode > nodeCaches = ctx . discovery ( ) . nodeCaches ( node ) ; Collection < GridClientCacheBean > caches = new ArrayList < > ( nodeCaches . size ( ) ) ; for ( String cacheName : nodeCaches . keySet ( ) ) caches . add ( createCacheBean ( cacheProc . cacheConfiguration ( cacheName ) ) ) ; nodeBean . setCaches ( caches ) ; if ( mtr ) { ClusterMetrics metrics = node . metrics ( ) ; GridClientNodeMetricsBean metricsBean = new GridClientNodeMetricsBean ( ) ; metricsBean . setStartTime ( metrics . getStartTime ( ) ) ; metricsBean . setAverageActiveJobs ( metrics . getAverageActiveJobs ( ) ) ; metricsBean . setAverageCancelledJobs ( metrics . getAverageCancelledJobs ( ) ) ; metricsBean . setAverageCpuLoad ( metrics . getAverageCpuLoad ( ) ) ; metricsBean . setAverageJobExecuteTime ( metrics . getAverageJobExecuteTime ( ) ) ; metricsBean . setAverageJobWaitTime ( metrics . getAverageJobWaitTime ( ) ) ; metricsBean . setAverageRejectedJobs ( metrics . getAverageRejectedJobs ( ) ) ; metricsBean . setAverageWaitingJobs ( metrics . getAverageWaitingJobs ( ) ) ; metricsBean . setCurrentActiveJobs ( metrics . getCurrentActiveJobs ( ) ) ; metricsBean . setCurrentCancelledJobs ( metrics . getCurrentCancelledJobs ( ) ) ; metricsBean . setCurrentCpuLoad ( metrics . getCurrentCpuLoad ( ) ) ; metricsBean . setCurrentGcCpuLoad ( metrics . getCurrentGcCpuLoad ( ) ) ; metricsBean . setCurrentDaemonThreadCount ( metrics . getCurrentDaemonThreadCount ( ) ) ; metricsBean . setCurrentIdleTime ( metrics . getCurrentIdleTime ( ) ) ; metricsBean . setCurrentJobExecuteTime ( metrics . getCurrentJobExecuteTime ( ) ) ; metricsBean . setCurrentJobWaitTime ( metrics . getCurrentJobWaitTime ( ) ) ; metricsBean . setCurrentRejectedJobs ( metrics . getCurrentRejectedJobs ( ) ) ; metricsBean . setCurrentThreadCount ( metrics . getCurrentThreadCount ( ) ) ; metricsBean . setCurrentWaitingJobs ( metrics . getCurrentWaitingJobs ( ) ) ; metricsBean . setHeapMemoryCommitted ( metrics . getHeapMemoryCommitted ( ) ) ; metricsBean . setHeapMemoryInitialized ( metrics . getHeapMemoryInitialized ( ) ) ; metricsBean . setHeapMemoryMaximum ( metrics . getHeapMemoryMaximum ( ) ) ; metricsBean . setHeapMemoryUsed ( metrics . getHeapMemoryUsed ( ) ) ; metricsBean . setLastDataVersion ( metrics . getLastDataVersion ( ) ) ; metricsBean . setLastUpdateTime ( metrics . getLastUpdateTime ( ) ) ; metricsBean . setMaximumActiveJobs ( metrics . getMaximumActiveJobs ( ) ) ; metricsBean . setMaximumCancelledJobs ( metrics . getMaximumCancelledJobs ( ) ) ; metricsBean . setMaximumJobExecuteTime ( metrics . getMaximumJobExecuteTime ( ) ) ; metricsBean . setMaximumJobWaitTime ( metrics . getMaximumJobWaitTime ( ) ) ; metricsBean . setMaximumRejectedJobs ( metrics . getMaximumRejectedJobs ( ) ) ; metricsBean . setMaximumThreadCount ( metrics . getMaximumThreadCount ( ) ) ; metricsBean . setMaximumWaitingJobs ( metrics . getMaximumWaitingJobs ( ) ) ; metricsBean . setNodeStartTime ( metrics . getNodeStartTime ( ) ) ; metricsBean . setNonHeapMemoryCommitted ( metrics . getNonHeapMemoryCommitted ( ) ) ; metricsBean . setNonHeapMemoryInitialized ( metrics . getNonHeapMemoryInitialized ( ) ) ; metricsBean . setNonHeapMemoryMaximum ( metrics . getNonHeapMemoryMaximum ( ) ) ; metricsBean . setNonHeapMemoryUsed ( metrics . getNonHeapMemoryUsed ( ) ) ; metricsBean . setStartTime ( metrics . getStartTime ( ) ) ; metricsBean . setTotalCancelledJobs ( metrics . getTotalCancelledJobs ( ) ) ; metricsBean . setTotalCpus ( metrics . getTotalCpus ( ) ) ; metricsBean . setTotalExecutedJobs ( metrics . getTotalExecutedJobs ( ) ) ; metricsBean . setTotalIdleTime ( metrics . getTotalIdleTime ( ) ) ; metricsBean . setTotalRejectedJobs ( metrics . getTotalRejectedJobs ( ) ) ; metricsBean . setTotalStartedThreadCount ( metrics . getTotalStartedThreadCount ( ) ) ; metricsBean . setTotalExecutedTasks ( metrics . getTotalExecutedTasks ( ) ) ; metricsBean . setSentMessagesCount ( metrics . getSentMessagesCount ( ) ) ; metricsBean . setSentBytesCount ( metrics . getSentBytesCount ( ) ) ; metricsBean . setReceivedMessagesCount ( metrics . getReceivedMessagesCount ( ) ) ; metricsBean . setReceivedBytesCount ( metrics . getReceivedBytesCount ( ) ) ; metricsBean . setUpTime ( metrics . getUpTime ( ) ) ; nodeBean . setMetrics ( metricsBean ) ; } if ( attr ) { Map < String , Object > attrs = new HashMap < > ( node . attributes ( ) ) ; attrs . remove ( ATTR_CACHE ) ; attrs . remove ( ATTR_TX_CONFIG ) ; attrs . remove ( ATTR_SECURITY_SUBJECT ) ; attrs . remove ( ATTR_SECURITY_CREDENTIALS ) ; for ( Iterator < Map . Entry < String , Object > > i = attrs . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry < String , Object > e = i . next ( ) ; if ( ! e . getKey ( ) . startsWith ( "org.apache.ignite." ) && ! e . getKey ( ) . startsWith ( "plugins." ) && System . getProperty ( e . getKey ( ) ) == null ) { i . remove ( ) ; continue ; } if ( e . getValue ( ) != null ) { if ( e . getValue ( ) . getClass ( ) . isEnum ( ) || e . getValue ( ) instanceof InetAddress ) e . setValue ( e . getValue ( ) . toString ( ) ) ; else if ( e . getValue ( ) . getClass ( ) . isArray ( ) ) i . remove ( ) ; } } nodeBean . setAttributes ( attrs ) ; } return nodeBean ; }
creates node bean out of grid node . notice that cache attribute is handled separately .
