The action of ejectment may be maintained in all cases in which the plaintiff is legally entitled to the possession of the premises.