class HMSManagementRestService {

    @GET
    @Path( "/nodes" )
    @Produces( "application/json" )
    public Map<String, Object[]> getHMSNodes()
        throws HMSRestException
    {

        Map<String, Object[]> nodes = new HashMap<String, Object[]>();
        try
        {

            Object[] hosts = serverConnector.getNodeMap().values().toArray();
            Object[] switches = switchConnector.switchNodeMap.values().toArray();

            List<ServerNode> copyHosts = new ArrayList<ServerNode>();
            List<SwitchNode> copySwitches = new ArrayList<SwitchNode>();

            if ( hosts != null && hosts.length > 0 )
            {
                for ( Object obj : hosts )
                {
                    ServerNode serverNode = (ServerNode) obj;
                    ServerNode copy = (ServerNode) HmsGenericUtil.maskPassword( serverNode );
                    copyHosts.add( copy );
                }
            }

            if ( switches != null && switches.length > 0 )
            {
                for ( Object obj : switches )
                {
                    SwitchNode switchNode = (SwitchNode) obj;
                    SwitchNode copy = (SwitchNode) HmsGenericUtil.maskPassword( switchNode );
                    copySwitches.add( copy );
                }
            }

            nodes.put( Constants.HOSTS, copyHosts.toArray() );
            nodes.put( Constants.SWITCHES, copySwitches.toArray() );

        }
        catch ( Exception e )
        {
            throw new HMSRestException( Status.INTERNAL_SERVER_ERROR.getStatusCode(), "Server Error",
                                        "Error while fetching HMS nodes" );
        }
        return nodes;
    }

}