An independent kingdom for much of its long history , Korea was occupied by Japan beginning in 1905 following the Russo-Japanese War .