A Commentary, Critical, Practical, and Explanatory on the Old and New Testaments, by Robert Jamieson, A.R. Fausset and David Brown  at sacred-texts.com
psa 127:1The theme of this Psalm, that human enterprises only succeed by the divine blessing, was probably associated with the building of the temple by Solomon, its author. It may have been adopted in this view, as suited to this series especially, as appropriately expressing the sentiments of God's worshippers in relation to the erection of the second temple. (Psa 127:1-5)
suggest the view of the theme given.
psa 127:2so he giveth his beloved sleep--that is, His providential care gives sleep which no efforts of ours can otherwise procure, and this is a reason for trust as to other things (compare Mat 6:26-32).
psa 127:3Posterity is often represented as a blessing from God (Gen 30:2, Gen 30:18; Sa1 1:19-20). Children are represented as the defenders (arrows) of their parents in war, and in litigation.
psa 127:5adversaries in the gate--or place of public business (compare Job 5:4; Psa 69:12).