The images from the war in the Middle East are being watched carefully in Beijing not with alarm, but with calculation.