Relativistic calculations for photonuclear reactions: (I). The direct knockout mechanism