public static AgentRuntimeInfo fromServer(AgentConfig agentConfig, boolean registeredAlready, String location, Long usablespace, String operatingSystem, boolean supportsBuildCommandProtocol) { if (StringUtils.isEmpty(location)) { throw new RuntimeException("Agent should not register without installation path."); } AgentStatus status = AgentStatus.Pending; if (SystemUtil.isLocalIpAddress(agentConfig.getIpAddress()) || registeredAlready) { status = AgentStatus.Idle; } AgentRuntimeInfo agentRuntimeInfo = new AgentRuntimeInfo(agentConfig.getAgentIdentifier(), status.getRuntimeStatus(), location, null, supportsBuildCommandProtocol); agentRuntimeInfo.setUsableSpace(usablespace); agentRuntimeInfo.operatingSystemName = operatingSystem; return agentRuntimeInfo; }